#49333 [Opn->Fbk]: Bug in recursive regex processing
| From: | jani@php.net | Date: | Mon, 24 Aug 2009 14:42:25 +0000 |
| Subject: | #49333 [Opn->Fbk]: Bug in recursive regex processing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141432@lists.php.net to get a copy of this message | ||
ID: 49333
Updated by: jani@php.net
Reported By: inf3rno dot hu at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: Windows XP
PHP Version: 5.2.10
New Comment:
I can not reproduce this either. Can you provide the test script as
downloadable package somewhere?
Previous Comments:
------------------------------------------------------------------------
[2009-08-24 12:21:40] inf3rno dot hu at gmail dot com
I reproduced it on another computer with the latest WAMPServer (Apache
2.2.11, PHP 5.3.0). I copied the code from here.
------------------------------------------------------------------------
[2009-08-24 11:54:12] inf3rno dot hu at gmail dot com
Apache and Php reinstall didn't help. :S
------------------------------------------------------------------------
[2009-08-24 11:20:39] inf3rno dot hu at gmail dot com
Yes, I can reproduce it.
Tried with alternative text editor, but same result. So I think it's
not memory or text editor problem. (Btw. I'll test my computer's memory
soon.)
I'll try it out after a reinstall, maybe some dll files are damaged.
------------------------------------------------------------------------
[2009-08-23 10:54:45] sjoerd@php.net
Could not reproduce. When I run the code example you supplied, I get
the expected result. Are you sure you have submitted the right code
example?
------------------------------------------------------------------------
[2009-08-23 08:10:45] inf3rno dot hu at gmail dot com
Description:
------------
I developed a recursive regex pattern for compile template patterns.
During the tests I found this bug. I managed to restrict it to the
following piece of code.
The count of the numbers, and every character (\n too) counts. So if I
have 11+ characters long string in the 'y'-s block, then it's buggy, but
by 10- character long strings it works fine.
I hope it's a real bug, and not a damage in my computer. :-)
Reproduce code:
---------------
$pattern='%.*?(?:([a-z])(?:.*?(?:(?R).*?)*?\1)?|$)%sD';
$test='
x
0123456789
x
y
01234567890
y';
preg_match_all($pattern,$test,$matches,PREG_SET_ORDER);
var_dump($matches);
Expected result:
----------------
array(3) { [0]=> array(2) { [0]=> string(18) " x 0123456789 x" [1]=>
string(1) "x" } [1]=> array(2) { [0]=> string(19) " y 01234567890 y"
[1]=> string(1) "y" } [2]=> array(1) { [0]=> string(0) "" } }
Actual result:
--------------
array(0) { }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49333&edit=1