Doc->Bug #77726 [Opn]: PCRE2 now supports NULs in patterns
| From: | requinix@php.net | Date: | Wed, 13 Mar 2019 04:19:41 +0000 |
| Subject: | Doc->Bug #77726 [Opn]: PCRE2 now supports NULs in patterns | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219938@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77726&edit=1
ID: 77726
Updated by: requinix@php.net
Reported by: 605036592 at qq dot com
-Summary: PCRE does not support NULs in patterns; PHP will
warn
+Summary: PCRE2 now supports NULs in patterns
Status: Open
-Type: Documentation Problem
+Type: Bug
Package: PCRE related
Operating System: CentOS-7.4-x86_64
PHP Version: 7.2.16
Block user comment: N
Private report: N
New Comment:
I assume the restriction is purely technical, so if we can lift it with PCRE2 then that's
probably the right answer.
Previous Comments:
------------------------------------------------------------------------
[2019-03-13 04:16:13] 605036592 at qq dot com
hello cmb@php.net, I think "/a".chr(0)."bc/" != '/a\\0bc/', so not the
same question!
------------------------------------------------------------------------
[2019-03-12 17:22:17] cmb@php.net
PCRE2 supports NUL bytes in patterns, so we may want to lift the
current restriction. OTOH,
preg_match('/a\\0bc/', 'abc')
already works as expected.
------------------------------------------------------------------------
[2019-03-12 08:15:21] requinix@php.net
PCRE does not support NUL bytes inside pattern strings.
While not a major pain point, this should probably be documented. The introduction says they
can't be delimiters, and the escape sequences page implies it when it mentions non-printing
characters, but besides in the actual pcre.org docs linked to with a vague "some
limitations" warning, I didn't see anywhere else that conclusively stated it.
------------------------------------------------------------------------
[2019-03-12 07:42:53] 605036592 at qq dot com
Description:
------------
when I use preg_match pattern 0x0, Warning: preg_match(): Null byte in regex
regex has match all character, why php not allow 0x0? it's a bug or has any reason?
Test script:
---------------
preg_match("/a".chr(0)."bc/", 'abc');
Expected result:
----------------
I expect preg_match right return 0 or 1 and not warning
Actual result:
--------------
Warning: preg_match(): Null byte in regex
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77726&edit=1