mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fixed bug #75355: preg_quote() does not quote # control character
This commit is contained in:
parent
abdece72c2
commit
84235344f9
3 changed files with 23 additions and 0 deletions
6
NEWS
6
NEWS
|
@ -93,6 +93,8 @@ PHP NEWS
|
||||||
|
|
||||||
- PCRE:
|
- PCRE:
|
||||||
. Implemented https://wiki.php.net/rfc/pcre2-migration (Anatol, Dmitry)
|
. Implemented https://wiki.php.net/rfc/pcre2-migration (Anatol, Dmitry)
|
||||||
|
. Fixed bug #75355 (preg_quote() does not quote # control character).
|
||||||
|
(Michael Moravec)
|
||||||
|
|
||||||
- PDO_DBlib:
|
- PDO_DBlib:
|
||||||
. Implemented request #69592 (allow 0-column rowsets to be skipped
|
. Implemented request #69592 (allow 0-column rowsets to be skipped
|
||||||
|
@ -109,6 +111,10 @@ PHP NEWS
|
||||||
- PDO SQLite
|
- PDO SQLite
|
||||||
. Add support for additional open flags
|
. Add support for additional open flags
|
||||||
|
|
||||||
|
- PCRE:
|
||||||
|
. Fixed bug #75355 (preg_quote() does not quote # control character).
|
||||||
|
(Majkl578)
|
||||||
|
|
||||||
- phar:
|
- phar:
|
||||||
. Fixed bug #74991 (include_path has a 4096 char limit in some cases).
|
. Fixed bug #74991 (include_path has a 4096 char limit in some cases).
|
||||||
(bwbroersma)
|
(bwbroersma)
|
||||||
|
|
|
@ -2629,6 +2629,7 @@ static PHP_FUNCTION(preg_quote)
|
||||||
case '|':
|
case '|':
|
||||||
case ':':
|
case ':':
|
||||||
case '-':
|
case '-':
|
||||||
|
case '#':
|
||||||
extra_len++;
|
extra_len++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2678,6 +2679,7 @@ static PHP_FUNCTION(preg_quote)
|
||||||
case '|':
|
case '|':
|
||||||
case ':':
|
case ':':
|
||||||
case '-':
|
case '-':
|
||||||
|
case '#':
|
||||||
*q++ = '\\';
|
*q++ = '\\';
|
||||||
*q++ = c;
|
*q++ = c;
|
||||||
break;
|
break;
|
||||||
|
|
15
ext/pcre/tests/bug75355.phpt
Normal file
15
ext/pcre/tests/bug75355.phpt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #75355 (preg_quote() does not quote # control character)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
var_dump(preg_quote('#'));
|
||||||
|
|
||||||
|
var_dump(preg_match('~^(' . preg_quote('hello#world', '~') . ')\z~x', 'hello#world', $m));
|
||||||
|
|
||||||
|
var_dump($m[1]);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
string(2) "\#"
|
||||||
|
int(1)
|
||||||
|
string(11) "hello#world"
|
Loading…
Add table
Add a link
Reference in a new issue