Skip to content

Commit 71d16fe

Browse files
committed
Fix #76512: \w no longer includes unicode characters
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>
1 parent c2a3ab0 commit 71d16fe

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
77
non-blocking). (Nikita)
88

9+
- PCRE:
10+
. Fixed bug #76512 (\w no longer includes unicode characters). (cmb)
11+
912
- Standard:
1013
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
1114
(Laruence)

ext/pcre/php_pcre.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
672672
case 'u': coptions |= PCRE2_UTF;
673673
/* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
674674
characters, even in UTF-8 mode. However, this can be changed by setting
675-
the PCRE_UCP option. */
676-
#ifdef PCRE_UCP
675+
the PCRE2_UCP option. */
676+
#ifdef PCRE2_UCP
677677
coptions |= PCRE2_UCP;
678678
#endif
679679
break;

ext/pcre/tests/bug52971.phpt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@ var_dump($match);
1919
--EXPECT--
2020
array(1) {
2121
[0]=>
22-
array(2) {
22+
array(1) {
2323
[0]=>
24-
array(2) {
25-
[0]=>
26-
string(6) "wasser"
27-
[1]=>
28-
int(17)
29-
}
30-
[1]=>
3124
array(2) {
3225
[0]=>
3326
string(6) "Wasser"
@@ -38,15 +31,8 @@ array(1) {
3831
}
3932
array(1) {
4033
[0]=>
41-
array(2) {
34+
array(1) {
4235
[0]=>
43-
array(2) {
44-
[0]=>
45-
string(8) "ßwasser"
46-
[1]=>
47-
int(15)
48-
}
49-
[1]=>
5036
array(2) {
5137
[0]=>
5238
string(7) " Wasser"

ext/pcre/tests/bug76512.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #76512 (\w no longer includes unicode characters)
3+
--FILE--
4+
<?php
5+
var_dump(preg_match('/\w/u', 'ä'));
6+
?>
7+
===DONE===
8+
--EXPECT--
9+
int(1)
10+
===DONE===

0 commit comments

Comments
 (0)