今日头条

最新评论

preg_match limit

发布日期:2008-04-25
Description:
------------
The following preg_replace breaks when the string is => 24999
characters. Works perfectly fine with 24998 characters and worked fine
with any strings in PHP 5.1.5.

Reproduce code:
---------------
$string = str_repeat('a', 100000);
echo
preg_replace('#(^.*|.*)(\[(php|html|noparse)\].*\[/\\3])(.*|.*$)#siUe',
'', $string);
?>

Expected result:
----------------
100.000 times 'a'

Actual result:
--------------
nothing

[6 Nov 2006 8:48pm UTC] ludvig dot ericson at gmail dot com

This is because of limits intentionally set, see the ini setting
pcre.backtrack_limit.

[6 Nov 2006 8:50pm UTC] spam at dragy dot de

pcre.backtrack_limit=-1 in php.ini

[14 Nov 2006 7:07pm UTC] tony2001@php.net

I was wrong, there are pcre.backtrack_limit and pcre.recursion_limit
directives, which might be used to control this functionality.

http://bugs.php.net/bug.php?id=39405
看不清楚,更换图片验证码:
是妙文,投一票

<<上一页    返回类目    下一页>>

相关链接

最新评论

点击查看更多最新评论...
我来评两句:

看不清楚,更换图片验证码:      

相关标签

类目最新

最新投票

类目30天排行

类目总排行

潜力小说

设为今日头条
推荐到首页显示
文章操作>>