Download src/php/php-src/ext/pcre/tests/bug27103.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 617 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug27103.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/pcre/tests/bug27103.phpt
-
curl -L -o bug27103.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug27103.phpt
617 Bytes
| --TEST-- | |
| Bug #27103 (preg_split('//u') incorrectly splits UTF-8 strings into octets) | |
| --SKIPIF-- | |
| if (@preg_match('/./u', '') === false) { | |
| die('skip no utf8 support in PCRE library'); | |
| } | |
| --FILE-- | |
| 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-- | |
| €: 3 | |
| : 1 | |
| h: 1 | |
| i: 1 | |
| : 1 | |
| t: 1 | |
| h: 1 | |
| e: 1 | |
| r: 1 | |
| e: 1 | |
| €: 3 | |
| : 1 | |
| h: 1 | |
| i: 1 | |
| : 1 | |
| t: 1 | |
| h: 1 | |
| e: 1 | |
| r: 1 | |
| e: 1 | |