ID:               42424
 Updated by:       [EMAIL PROTECTED]
 Reported By:      adam-phpbugs at adam dot gs
-Status:           Open
+Status:           Bogus
 Bug Type:         PCRE related
 Operating System: Any
 PHP Version:      5.2.3
 New Comment:

In PHP 5.2.0 two new PCRE ini options were added to prevent possible
stack overflows and crashes. One of them is pcre.backtrack_limit.
When you set it high enough your script works as it did earlier (where
no such limits existed!)

$ php -dpcre.backtrack_limit=100001 t.php
int(1)
int(1)
int(1)
int(1)



Previous Comments:
------------------------------------------------------------------------

[2007-08-25 13:16:29] adam-phpbugs at adam dot gs

Description:
------------
PHP5/PCRE will fail to match on long strings when UNGREEDY, the
boundary 
is around 100k of data.

FWIW, same results if you change x* to x+ down there.

Reproduce code:
---------------
<?php
$data=sprintf("<span>%s</span>",str_repeat("x",99996));
var_dump(preg_match("#<span>(x*?)</span>#",$data));

$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*?)</span>#",$data));

$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*)</span>#U",$data));

$data=sprintf("<span>%s</span>",str_repeat("x",99997));
var_dump(preg_match("#<span>(x*)</span>#",$data));
?>

Expected result:
----------------
all 4 expressions should match, this is what occurs with PHP 4.4.7.




Actual result:
--------------
under PHP 5.2.3:
only the first and 4th expression match
under PHP 4.4.7:
all 4 match.






------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42424&edit=1

Reply via email to