]> granicus.if.org Git - php/commitdiff
Fix #76512: \w no longer includes unicode characters
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 21 Jun 2018 17:18:15 +0000 (19:18 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 21 Jun 2018 20:45:08 +0000 (22:45 +0200)
The migration from PCRE to PCRE2 missed to rename once occurrence of
`PCRE_UCP` to `PCRE2_UCP`.  We fix that.  We also revert the changes to
bug52971.phpt which had been incorrectly made in commit a5bc5ae[1].

[1] <http://git.php.net/?p=php-src.git;a=commit;h=a5bc5aed71f7a15f14f33bb31b8e17bf5f327e2d>

NEWS
ext/pcre/php_pcre.c
ext/pcre/tests/bug52971.phpt
ext/pcre/tests/bug76512.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 9307f3f13a2faf3db6119f1edb9b3ed20d3a0b35..6f510ec6b5ed98d2025dd9cf7c496854808cfcea 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ PHP                                                                        NEWS
   . Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
     non-blocking). (Nikita)
 
+- PCRE:
+  . Fixed bug #76512 (\w no longer includes unicode characters). (cmb)
+
 - Standard:
   . Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
     (Laruence)
index ffecc394221fd5f70d5f963e7db67fa778b502cc..9e1a5a6a502d0eaa4a590493d226dd2fffa06701 100644 (file)
@@ -672,8 +672,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
                        case 'u':       coptions |= PCRE2_UTF;
        /* In  PCRE,  by  default, \d, \D, \s, \S, \w, and \W recognize only ASCII
        characters, even in UTF-8 mode. However, this can be changed by setting
-       the PCRE_UCP option. */
-#ifdef PCRE_UCP
+       the PCRE2_UCP option. */
+#ifdef PCRE2_UCP
                                                coptions |= PCRE2_UCP;
 #endif
                                break;
index 130fbf31a28a99f8b3244ab6881bf2e5f108a3e0..552c97e357bcc0beb3c9d1e879b9865f038f370c 100644 (file)
@@ -19,15 +19,8 @@ var_dump($match);
 --EXPECT--
 array(1) {
   [0]=>
-  array(2) {
+  array(1) {
     [0]=>
-    array(2) {
-      [0]=>
-      string(6) "wasser"
-      [1]=>
-      int(17)
-    }
-    [1]=>
     array(2) {
       [0]=>
       string(6) "Wasser"
@@ -38,15 +31,8 @@ array(1) {
 }
 array(1) {
   [0]=>
-  array(2) {
+  array(1) {
     [0]=>
-    array(2) {
-      [0]=>
-      string(8) "ßwasser"
-      [1]=>
-      int(15)
-    }
-    [1]=>
     array(2) {
       [0]=>
       string(7) " Wasser"
diff --git a/ext/pcre/tests/bug76512.phpt b/ext/pcre/tests/bug76512.phpt
new file mode 100644 (file)
index 0000000..cd14ad8
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--\r
+Bug #76512 (\w no longer includes unicode characters)\r
+--FILE--\r
+<?php\r
+var_dump(preg_match('/\w/u', 'ä'));\r
+?>\r
+===DONE===\r
+--EXPECT--\r
+int(1)\r
+===DONE===\r