Doc #62237 [Opn->Csd]: PCRE recursion pattern should be (?&name), not (?P&name)
| From: | felipe@php.net | Date: | Thu, 07 Jun 2012 17:38:18 +0000 |
| Subject: | Doc #62237 [Opn->Csd]: PCRE recursion pattern should be (?&name), not (?P&name) | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8433@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62237&edit=1
ID: 62237
Updated by: felipe@php.net
Reported by: danielklein at airpost dot net
Summary: PCRE recursion pattern should be (?&name), not
(?P&name)
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: 5.4.3
-Assigned To:
+Assigned To: felipe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2012-06-07 17:38:05] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=326014
Log: - Fixed bug #62237 (PCRE recursion pattern should be (?&name), not (?P&name))
------------------------------------------------------------------------
[2012-06-06 05:37:51] danielklein at airpost dot net
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 this bug report at https://bugs.php.net/bug.php?id=62237&edit=1