Bug #67355 [NEW]: Problem with named subpattern in a condition on recursion.
From: lingtalfi at gmail dot com
Operating system: MacOSX 10.5.8
PHP version: Irrelevant
Package: PCRE related
Bug Type: Bug
Bug description:Problem with named subpattern in a condition on recursion.
Description:
------------
Using PHP Version 5.5.8 on macOSX 10.8.5
PCRE Library Version 8.33 2013-05-28
I may be wrong,
but I think there is a problem with the PCRE implementation in php.
The php test is here: http://ideone.com/NuORid
The perl equivalent test is here: http://ideone.com/RGHaLK
Now, I know perl and pcre are two different flavours, but in this case,
I was expecting the same behaviour.
About the php test:
I tried to use a condition on a recursion (which is supposed to always
fail at the top level).
The condition has two alternatives: the yes condition and the no
condition.
In the subject, there is no recursion at all, so the second alternative
should be used,
and the first alternative ignored.
It seems that the pattern match only if the first alternative doesn't
use a duplicate named subpattern,
or, alternatively, if a backreference to the named subpattern uses the
numbered version of the
subpattern (and not the name).
Test script:
---------------
http://ideone.com/NuORid
Expected result:
----------------
The script http://ideone.com/NuORid should output
"ok"
Actual result:
--------------
The script http://ideone.com/NuORid outputs "oops"
--
Edit bug report at https://bugs.php.net/bug.php?id=67355&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67355&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67355&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67355&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67355&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67355&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67355&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67355&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67355&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67355&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67355&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67355&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67355&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67355&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67355&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67355&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67355&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67355&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67355&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67355&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67355&r=mysqlcfg
Thread (4 messages)
- lingtalfi at gmail dot com