Bug #77726 [Com]: PCRE2 does not support NULs in patterns
| From: | antonino dot spampinato86 at gmail dot com | Date: | Thu, 18 Feb 2021 02:18:03 +0000 |
| Subject: | Bug #77726 [Com]: PCRE2 does not support NULs in patterns | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232232@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
Comment by: antonino dot spampinato86 at gmail dot com
Reported by: 605036592 at qq dot com
Summary: PCRE2 does not support NULs in patterns
Status: Open
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:
Null pattern nice job https://3v4l.org/LluRm
Previous Comments:
------------------------------------------------------------------------
[2020-10-27 15:19:48] cmb@php.net
> I assume the restriction is purely technical, [â¦]
It seems so. Some code in pcre_get_compiled_regex_cache_ex() is
not binary safe (i.e. it assumes that a NUL byte terminates the
pattern), and there may be further modifications needed to
php_pcre.c.
------------------------------------------------------------------------
[2019-03-13 04:19:41] requinix@php.net
I assume the restriction is purely technical, so if we can lift it with PCRE2 then that's
probably the right answer.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=77726
--
Edit this bug report at https://bugs.php.net/bug.php?id=77726&edit=1