Bug #67355 [Fbk->NoF]: Problem with named subpattern in a condition on recursion.

From: Date: Tue, 30 Dec 2014 10:42:39 +0000
Subject: Bug #67355 [Fbk->NoF]: Problem with named subpattern in a condition on recursion.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189486@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67355&edit=1

 ID:               67355
 Updated by:       php-bugs@lists.php.net
 Reported by:      lingtalfi at gmail dot com
 Summary:          Problem with named subpattern in a condition on
                   recursion.
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          PCRE related
 Operating System: MacOSX 10.5.8
 PHP Version:      Irrelevant
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2014-05-29 06:34:23] lingtalfi at gmail dot com

Submitted to pcre 
http://bugs.exim.org/show_bug.cgi?id=1484

------------------------------------------------------------------------
[2014-05-29 05:57:03] rasmus@php.net

Please test this using the command line pcretest tool. Most issues filed against PHP and PCRE
aren't PHP-related but rather PCRE-implementation-related. If pcretest and php differ, then it
is a PHP issue. If pcretest shows the same behaviour as PHP and you believe it is a bug, file it
against PCRE.

------------------------------------------------------------------------
[2014-05-28 20:10:54] lingtalfi at gmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=67355&edit=1


Thread (4 messages)

« previous php.bugs (#189486) next »