|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-03-12 07:42 UTC] 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
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
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.