|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67355 Problem with named subpattern in a condition on recursion.
Submitted: 2014-05-28 20:10 UTC Modified: 2014-12-30 10:42 UTC
From: lingtalfi at gmail dot com Assigned:
Status: No Feedback Package: PCRE related
PHP Version: Irrelevant OS: MacOSX 10.5.8
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-05-28 20:10 UTC] lingtalfi at gmail dot com
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:
The perl equivalent test is here:

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:

Expected result:
The script should output "ok"

Actual result:
The script outputs "oops"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-29 05:57 UTC]
-Status: Open +Status: Feedback
 [2014-05-29 05:57 UTC]
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-29 06:34 UTC] lingtalfi at gmail dot com
Submitted to pcre
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 04:01:28 2024 UTC