ID:               36983
 Updated by:       [EMAIL PROTECTED]
 Reported By:      crisp at tweakers dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         PCRE related
 Operating System: all
 PHP Version:      4.4.2
 New Comment:

If there is a problem, it is PCRELib problem.
Please report it to PCRELib developers.


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

[2006-04-05 12:41:15] crisp at tweakers dot net

Description:
------------
It seems that when PCRE needs to backtrack more than 20 characters in
order to evaluate an OR'ed expression the results of a preg_match_all
are incorrect/incomplete.
See below code as an example.

Reproduce code:
---------------
$foo = 'foo# bar# abcdefghijklmnopqrst bla#';
echo '$foo = ', $foo, "\n";

preg_match_all('/([a-y]|z)+#/', $foo, $matches1);
preg_match_all('/([a-y]+|z)+#/', $foo, $matches2);

print_r($matches1[0]);
print_r($matches2[0]);


$foo = 'foo# bar# abcdefghijklmnopqrstu bla#';
echo '$foo = ', $foo, "\n";

preg_match_all('/([a-y]|z)+#/', $foo, $matches1);
preg_match_all('/([a-y]+|z)+#/', $foo, $matches2);

print_r($matches1[0]);
print_r($matches2[0]);


Expected result:
----------------
both expressions for both strings should give the following output:

Array
(
    [0] => foo#
    [1] => bar#
    [2] => bla#
)

Actual result:
--------------
The last expression gives the following output on the last string:

Array
(
    [0] => foo#
    [1] => bar#
)

The last match on bla# is missing in the result for the preg_match_all


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


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

Reply via email to