xref: /PHP-8.3/ext/mbstring/tests/bug49354.phpt (revision 39131219)
1--TEST--
2Bug #49354 (mb_strcut() cuts wrong length when offset is in the middle of a multibyte character)
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7$crap = 'AåBäCöDü';
8var_dump(mb_strcut($crap, 0, 100, 'UTF-8'));
9var_dump(mb_strcut($crap, 1, 100, 'UTF-8'));
10var_dump(mb_strcut($crap, 2, 100, 'UTF-8'));
11var_dump(mb_strcut($crap, 3, 100, 'UTF-8'));
12var_dump(mb_strcut($crap, 12, 100, 'UTF-8'));
13var_dump(mb_strcut($crap, 13, 100, 'UTF-8'));
14
15?>
16--EXPECT--
17string(12) "AåBäCöDü"
18string(11) "åBäCöDü"
19string(11) "åBäCöDü"
20string(9) "BäCöDü"
21string(0) ""
22string(0) ""
23