xref: /PHP-8.2/ext/pcre/tests/bug42298.phpt (revision a3e6be97)
1--TEST--
2Bug #42298 (pcre gives bogus results with /u)
3--FILE--
4<?php
5$str = "A\xc2\xa3BC";
6preg_match_all('/\S\S/u', $str, $m);	var_dump($m);
7preg_match_all('/\S{2}/u', $str, $m);	var_dump($m);
8
9$str = "A\xe2\x82\xac ";
10preg_match_all('/\W\W/u', $str, $m);	var_dump($m);
11preg_match_all('/\W{2}/u', $str, $m);	var_dump($m);
12
13?>
14--EXPECT--
15array(1) {
16  [0]=>
17  array(2) {
18    [0]=>
19    string(3) "A£"
20    [1]=>
21    string(2) "BC"
22  }
23}
24array(1) {
25  [0]=>
26  array(2) {
27    [0]=>
28    string(3) "A£"
29    [1]=>
30    string(2) "BC"
31  }
32}
33array(1) {
34  [0]=>
35  array(1) {
36    [0]=>
37    string(4) "€ "
38  }
39}
40array(1) {
41  [0]=>
42  array(1) {
43    [0]=>
44    string(4) "€ "
45  }
46}
47