Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed bug #52971 (PCRE-Meta-Characters not working with utf-8)
# 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.
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--TEST-- | ||
Bug #52971 (PCRE-Meta-Characters not working with utf-8) | ||
--SKIPIF-- | ||
<?php if ((double)PCRE_VERSION < 8.1) die('skip PCRE_VERSION >= 8.1 is required!'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$message = 'Der ist ein Süßwasserpool Süsswasserpool ... verschiedene Wassersportmöglichkeiten bei ...'; | ||
|
||
$pattern = '/\bwasser/iu'; | ||
preg_match_all($pattern, $message, $match, PREG_OFFSET_CAPTURE); | ||
var_dump($match); | ||
|
||
$pattern = '/[^\w]wasser/iu'; | ||
preg_match_all($pattern, $message, $match, PREG_OFFSET_CAPTURE); | ||
var_dump($match); | ||
|
||
?> | ||
--EXPECTF-- | ||
array(1) { | ||
[0]=> | ||
array(1) { | ||
[0]=> | ||
array(2) { | ||
[0]=> | ||
string(6) "Wasser" | ||
[1]=> | ||
int(61) | ||
} | ||
} | ||
} | ||
array(1) { | ||
[0]=> | ||
array(1) { | ||
[0]=> | ||
array(2) { | ||
[0]=> | ||
string(7) " Wasser" | ||
[1]=> | ||
int(60) | ||
} | ||
} | ||
} |