Doc #77316 [Opn->Ver]: (?X) produces warning: Compilation failed: unrecognized character after (? or (
| From: | cmb@php.net | Date: | Tue, 18 Dec 2018 19:10:46 +0000 |
| Subject: | Doc #77316 [Opn->Ver]: (?X) produces warning: Compilation failed: unrecognized character after (? or ( | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16220@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77316&edit=1
ID: 77316
Updated by: cmb@php.net
Reported by: sp at fp dot de
Summary: (?X) produces warning: Compilation failed:
unrecognized character after (? or (
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: PCRE related
PHP Version: 7.3.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> "The current patch reverts the behavior to the meaning of 'X'
> how it was in PCRE"
This is about the X *modifier*, not about the internal option.
So yes, this is a documentation issue.
Previous Comments:
------------------------------------------------------------------------
[2018-12-18 18:35:07] sp at fp dot de
Description:
------------
Using the PCRE_EXTRA modifier as an internal option setting inside the pattern string now produces a
warning:
"Warning: preg_match(): Compilation failed: unrecognized character after (? or (?- at offset
2"
I'm not really sure if this is intentional, as the RFC states:
"The current patch reverts the behavior to the meaning of 'X' how it was in
PCRE"
https://wiki.php.net/rfc/pcre2-migration
If it indeed is intentional, then at least the documentation should be updated accordingly:
http://php.net/manual/en/regexp.reference.internal-options.php
Test script:
---------------
preg_match('/(?X)/', '');
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77316&edit=1