警告:preg_match():内部pcre_fullinfo() [英] Warning: preg_match(): Internal pcre_fullinfo()

查看:118
本文介绍了警告:preg_match():内部pcre_fullinfo()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下工作代码:

$test = '123456';

$int = preg_match('/^\d+$/', $test, $matches);

print_r(array($int, $matches));

但是,当我在键盘上执行它时,出现错误消息:

However when I execute it on codepad I get the error:

警告:preg_match():第5行的内部pcre_fullinfo()错误-3

Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 5

但是代码正在我自己的机器上运行(代码应该很好,恕我直言).

But the code is running on my own machine (and the code should be fine IMHO).

我将来需要分发我的代码,因此如果它会根据某些配置而中断,那将是不好的.那么,密码键盘中断的原因是什么?

I need to distribute my code in the future so it would be bad if it would break depending on some config. So what is the reason codepad breaks on it?

推荐答案

通过键盘执行的代码在非常受限的环境中运行:

Code executed via codepad is running in a very restricted environment:

代码执行由基于geordi的主管处理.策略是在ptrace下运行所有​​内容,禁止或忽略许多系统调用.编译器和最终可执行文件都在具有严格资源限制的chroot监狱中执行.主管是用Haskell编写的.

Code execution is handled by a supervisor based on geordi. The strategy is to run everything under ptrace, with many system calls disallowed or ignored. Compilers and final executables are both executed in a chroot jail, with strict resource limits. The supervisor is written in Haskell.

虽然没有什么希望打破正则表达式引擎,但pcre库很可能在内部使用了被键盘环境阻止的东西.没有生产系统会使用如此严格的限制,因此您应该可以安全地在应用程序中使用该代码.

While it's nothing you'd expect to break a regex engine it's very possible that the pcre library uses something internally that is blocked by the codepad environment. No production system uses such severe restrictions so you should be safe to use that code in your application.

错误代码代表"PCRE_ERROR_BADOPTION-什么的值无效". 但是,PHP源中发生错误的代码是rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats);,它使用 what 常量.因此,这显然意味着pcre库在键盘上已损坏.

The error code stands for "PCRE_ERROR_BADOPTION - the value of what was invalid". However, the code in the PHP source where the error occurs is rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats); which uses a constant for what. So it clearly means that the pcre library is broken on codepad.

如果您想完全安全,则可以使用libpcre编写一个小型C程序,以在同一正则表达式上调用该函数.

If you wanted to be completely safe, you could write a small C program using libpcre to call that function on the same regex.

这篇关于警告:preg_match():内部pcre_fullinfo()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆