summaryrefslogtreecommitdiff
path: root/ext/pcre/tests/bug27103.phpt
blob: 185225d31082b908fcb384ccd47dd00e6994ff9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Bug #27103 (preg_split('//u') incorrectly splits UTF-8 strings into octets)
--FILE--
<?php
function iter($ar)
{
	foreach ($ar as $c) {
		echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n";
	}
}
$teststr = "\xe2\x82\xac hi there";
iter(preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY));
preg_match_all('/./u', $teststr, $matches);
iter($matches[0]);
?>
--EXPECT--
&euro;: 3
 : 1
h: 1
i: 1
 : 1
t: 1
h: 1
e: 1
r: 1
e: 1
&euro;: 3
 : 1
h: 1
i: 1
 : 1
t: 1
h: 1
e: 1
r: 1
e: 1