[pcre-dev] [Bug 1484] New: Problem with named subpattern in …

Αρχική Σελίδα
Delete this message
Συντάκτης: ling
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] [Bug 1484] New: Problem with named subpattern in a condition on recursion
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1484
           Summary: Problem with named subpattern in a condition on
                    recursion
           Product: PCRE
           Version: 8.33
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: lingtalfi@???
         QAContact: lingtalfi@???
                CC: pcre-dev@???



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 library.



The test is here (using php): 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"


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email