Annotation of embedaddon/php/ext/pcre/tests/bug27103.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #27103 (preg_split('//u') incorrectly splits UTF-8 strings into octets)
                      3: --SKIPIF--
                      4: <?php
                      5: if (@preg_match('/./u', '') === false) {
                      6:        die('skip no utf8 support in PCRE library');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: function iter($ar)
                     12: {
                     13:        foreach ($ar as $c) {
                     14:                echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n";
                     15:        }
                     16: }
                     17: $teststr = "\xe2\x82\xac hi there";
                     18: iter(preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY));
                     19: preg_match_all('/./u', $teststr, $matches);
                     20: iter($matches[0]);
                     21: ?>
                     22: --EXPECT--
                     23: &euro;: 3
                     24:  : 1
                     25: h: 1
                     26: i: 1
                     27:  : 1
                     28: t: 1
                     29: h: 1
                     30: e: 1
                     31: r: 1
                     32: e: 1
                     33: &euro;: 3
                     34:  : 1
                     35: h: 1
                     36: i: 1
                     37:  : 1
                     38: t: 1
                     39: h: 1
                     40: e: 1
                     41: r: 1
                     42: e: 1
                     43: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>