summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2004-02-01 03:03:15 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2004-02-01 03:03:15 +0000
commit65e22c3316585915e249df87c38b6df241aa434d (patch)
tree998cf4f1ca541d9fe1ce6b78fa3152f5945da69c
parent5d9495dfe7c202896e48e269c445e0175a4638aa (diff)
downloadphp-git-65e22c3316585915e249df87c38b6df241aa434d.tar.gz
- Forgot to add test case.
-rw-r--r--ext/pcre/tests/bug27103.phpt37
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/pcre/tests/bug27103.phpt b/ext/pcre/tests/bug27103.phpt
new file mode 100644
index 0000000000..185225d310
--- /dev/null
+++ b/ext/pcre/tests/bug27103.phpt
@@ -0,0 +1,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
+