mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
![]() The documentation for mb_strcut states: mb_strcut( string $string, int $start, ?int $length = null, ?string $encoding = null ): string mb_strcut() extracts a substring from a string similarly to mb_substr(), but operates on bytes instead of characters. If the cut position happens to be between two bytes of a multi-byte character, the cut is performed starting from the first byte of that character. My understanding of the $length parameter for mb_strcut is that it specified the range of bytes to extract from $string, and that all characters encoded by those bytes should be included in the returned string, even if that means the returned string would be longer than $length bytes. This can happen either if 1) there is more than one way to encode the same character in $encoding, and one way requires more bytes than the other, or 2) $encoding uses escape sequences. However, discussion with users of mb_strcut indicates that many of them interpret $length as the maximum length of the *returned* string. This is also the historical behavior of the function. Hence, there is no need to modify the behavior of mb_strcut and then remove XFAIL from these test cases afterwards. We can keep the current behavior. |
||
---|---|---|
.. | ||
libmbfl | ||
tests | ||
ucgendat | ||
common_codepoints.txt | ||
config.m4 | ||
config.w32 | ||
CREDITS | ||
gen_rare_cp_bitvec.php | ||
mb_gpc.c | ||
mb_gpc.h | ||
mbstring.c | ||
mbstring.h | ||
mbstring.stub.php | ||
mbstring_arginfo.h | ||
php_mbregex.c | ||
php_mbregex.h | ||
php_onig_compat.h | ||
php_unicode.c | ||
php_unicode.h | ||
rare_cp_bitvec.h | ||
unicode_data.h |