diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2004-01-16 02:29:50 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2004-01-16 02:29:50 +0000 |
| commit | 071565178549a718e9a19c6f659723b22a49cb8f (patch) | |
| tree | c373b2d9698264ea753b4f492fd54d98428844aa | |
| parent | c1ac285760eb9e9aee5bdff5b2b4960274970968 (diff) | |
| download | php-git-071565178549a718e9a19c6f659723b22a49cb8f.tar.gz | |
Fixed Bug #26927 (preg_quote() does not escape \0).
| -rw-r--r-- | ext/pcre/php_pcre.c | 5 | ||||
| -rw-r--r-- | ext/pcre/tests/bug26927.phpt | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 7e85410299..13c28b886d 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -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++ = '\\'; diff --git a/ext/pcre/tests/bug26927.phpt b/ext/pcre/tests/bug26927.phpt new file mode 100644 index 0000000000..25b6b2e572 --- /dev/null +++ b/ext/pcre/tests/bug26927.phpt @@ -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" |
