Bug->Doc #77726 [Opn]: PCRE does not support NULs in patterns; PHP will warn
| From: | requinix@php.net | Date: | Tue, 12 Mar 2019 08:15:21 +0000 |
| Subject: | Bug->Doc #77726 [Opn]: PCRE does not support NULs in patterns; PHP will warn | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16473@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: Warning: preg_match(): Null byte in regex
+Summary: PCRE does not support NULs in patterns; PHP will
warn
Status: Open
-Type: Bug
+Type: Documentation Problem
-Package: PHP Language Specification
+Package: PCRE related
Operating System: CentOS-7.4-x86_64
PHP Version: 7.2.16
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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