Doc #62237 [NEW]: PCRE recursion pattern should be (?&name), not (?P&name)

From: Date: Wed, 06 Jun 2012 05:37:51 +0000
Subject: Doc #62237 [NEW]: PCRE recursion pattern should be (?&name), not (?P&name)
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8430@lists.php.net to get a copy of this message
From: danielklein at airpost dot net Operating system: PHP version: 5.4.3 Package: Documentation problem Bug Type: Documentation Problem Bug description:PCRE recursion pattern should be (?&name), not (?P&name) Description: ------------ Including (?P&name) in a pattern (as described on http://www.php.net/manual/en/regexp.reference.recursive.php) causes an error. Changing it to (?P>name) or (?&name) works as expected (see http://perldoc.perl.org/perlre.html#PCRE%2fPython-Support and elsewhere on the same page). The reference to (?P&name) needs to be changed to (?&name). Test script: --------------- <?php var_export(preg_match('/(?<foo>a)(?P>foo)/', 'aa')); // Good print("\n"); var_export(preg_match('/(?<foo>a)(?&foo)/', 'aa')); // Good print("\n"); var_export(preg_match('/(?<foo>a)(?P&foo)/', 'aa')); // Bad ?> Actual result: -------------- 1 1 Warning: preg_match(): Compilation failed: unrecognized character after (?P at offset ... -- Edit bug report at https://bugs.php.net/bug.php?id=62237&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62237&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62237&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62237&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62237&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62237&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62237&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62237&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62237&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62237&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62237&r=support Expected behavior: https://bugs.php.net/fix.php?id=62237&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62237&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62237&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62237&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62237&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62237&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62237&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62237&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62237&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62237&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62237&r=mysqlcfg

« previous php.doc.bugs (#8430) next »