com php-src: Fix #77827: preg_match does not ignore \r in regex flags: NEWS ext/pcre/php_pcre.c ext/pcre/tests/bug77827.phpt
| From: | Christoph Michael Becker | Date: | Sun, 31 Mar 2019 11:31:54 +0000 |
| Subject: | com php-src: Fix #77827: preg_match does not ignore \r in regex flags: NEWS ext/pcre/php_pcre.c ext/pcre/tests/bug77827.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105426@lists.php.net to get a copy of this message | ||
Commit: 88460c017a06ce8865f1adcc8f70e511cf776e06
Author: Christoph M. Becker <cmbecker69@gmx.de> Sun, 31 Mar 2019 13:31:54 +0200
Parents: 0dbb581cf4d7e99cadda368c9edce5a721dc4036
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=88460c017a06ce8865f1adcc8f70e511cf776e06
Log:
Fix #77827: preg_match does not ignore \r in regex flags
Bugs:
https://bugs.php.net/77827
Changed paths:
M NEWS
M ext/pcre/php_pcre.c
A ext/pcre/tests/bug77827.phpt
Diff:
diff --git a/NEWS b/NEWS
index 81d1727..67028cd 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP NEWS
. Fixed bug #72175 (Impossibility of creating multiple connections to
Interbase with php 7.x). (Nikita)
+- PCRE:
+ . Fixed bug #77827 (preg_match does not ignore \r in regex flags). (requinix,
+ cmb)
+
- phpdbg:
. Fixed bug #76801 (too many open files). (alekitto)
. Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 4cdd8bf..2e82729 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -486,6 +486,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
case ' ':
case '\n':
+ case '\r':
break;
default:
diff --git a/ext/pcre/tests/bug77827.phpt b/ext/pcre/tests/bug77827.phpt
new file mode 100644
index 0000000..c8f8c7a
--- /dev/null
+++ b/ext/pcre/tests/bug77827.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #77827 (preg_match does not ignore \r in regex flags)
+--FILE--
+<?php
+var_dump(
+ preg_match("/foo/i\r", 'FOO'),
+ preg_last_error()
+);
+?>
+===DONE===
+--EXPECT--
+int(1)
+int(0)
+===DONE===