xref: /PHP-7.2/ext/mbstring/tests/bug49354.phpt (revision 0c974164)
1--TEST--
2Bug #49354 (mb_strcut() cuts wrong length when offset is in the middle of a multibyte character)
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
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--EXPECT--
16string(12) "AåBäCöDü"
17string(11) "åBäCöDü"
18string(11) "åBäCöDü"
19string(9) "BäCöDü"
20string(0) ""
21bool(false)
22