mirror of
https://github.com/php/php-src.git
synced 2025-01-22 03:34:19 +08:00
Fixed Bug #26927 (preg_quote() does not escape \0).
This commit is contained in:
parent
c1ac285760
commit
0715651785
@ -1388,6 +1388,11 @@ PHP_FUNCTION(preg_quote)
|
||||
*q++ = c;
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
*q++ = '\\';
|
||||
*q++ = '0';
|
||||
break;
|
||||
|
||||
default:
|
||||
if (quote_delim && c == delim_char)
|
||||
*q++ = '\\';
|
||||
|
11
ext/pcre/tests/bug26927.phpt
Normal file
11
ext/pcre/tests/bug26927.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #26927 (preg_quote() does not escape \0)
|
||||
--FILE--
|
||||
<?php
|
||||
$str = "a\000b";
|
||||
$str_quoted = preg_quote($str);
|
||||
var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
string(4) "a\0b"
|
Loading…
Reference in New Issue
Block a user