Bug #79787 [Opn->Csd]: mb_strimwidth does not trim string
| From: | nikic@php.net | Date: | Wed, 08 Jul 2020 09:23:10 +0000 |
| Subject: | Bug #79787 [Opn->Csd]: mb_strimwidth does not trim string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227884@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79787&edit=1
ID: 79787
Updated by: nikic@php.net
Reported by: x dot xiang at outlook dot com
Summary: mb_strimwidth does not trim string
-Status: Open
+Status: Closed
Type: Bug
Package: mbstring related
Operating System: All
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of x.xiang@outlook.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3d5de7d74660b1ba6ae92a91581f7a50573554dc
Log: Fix bug #79787
Previous Comments:
------------------------------------------------------------------------
[2020-07-04 14:22:12] x dot xiang at outlook dot com
The following pull request has been associated:
Patch Name: Fix bug #79787 : mb_strimwidth does not trim string
On GitHub: https://github.com/php/php-src/pull/5807
Patch: https://github.com/php/php-src/pull/5807.patch
------------------------------------------------------------------------
[2020-07-04 14:08:02] x dot xiang at outlook dot com
Description:
------------
When the string end with full-width character and its width is one greater than the desired trimming
widthï¼trimmaker is alse a half-width character, which will cause mb_strimwidth not to trim.
Affects all stable versions of PHP.
Test script:
---------------
<?php
echo mb_strimwidth("ä¸äºä¸", 0, 4, '.',
'UTF-8')."\n";
echo mb_strimwidth("ä¸äºä¸", 0, 5, '.',
'UTF-8')."\n";
echo mb_strimwidth("ä¸äºä¸", 0, 6, '.',
'UTF-8')."\n";
echo mb_strimwidth("abcdef", 0, 4, '.', 'UTF-8')."\n";
echo mb_strimwidth("abcdef", 0, 5, '.', 'UTF-8')."\n";
echo mb_strimwidth("abcdef", 0, 6, '.', 'UTF-8')."\n";
Expected result:
----------------
ä¸.
ä¸äº.
ä¸äºä¸
abc.
abcd.
abcdef
Actual result:
--------------
ä¸.
ä¸äºä¸
ä¸äºä¸
abc.
abcd.
abcdef
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79787&edit=1