php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lingtalfi at gmail dot com
New email:
PHP Version: OS:

 

 [2014-05-28 20:10 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-29 05:57 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2014-05-29 05:57 UTC] 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-29 06:34 UTC] lingtalfi at gmail dot com
Submitted to pcre 
http://bugs.exim.org/show_bug.cgi?id=1484
 [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: Sat Dec 21 12:01:31 2024 UTC