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

From: Date: Thu, 29 May 2014 05:57:03 +0000
Subject: Bug #67355 [Opn->Fbk]: Problem with named subpattern in a condition on recursion.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185962@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: rasmus@php.net Reported by: lingtalfi at gmail dot com Summary: Problem with named subpattern in a condition on recursion. -Status: Open +Status: Feedback Type: Bug Package: PCRE related Operating System: MacOSX 10.5.8 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#185962) next »