[php-src] Issue #9216: mb_trim missing
| From: | 8ctopus | Date: | Mon, 01 Aug 2022 12:46:17 +0000 |
| Subject: | [php-src] Issue #9216: mb_trim missing | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242093@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9216
Author: 8ctopus
### Description
Hello!
the standard
trim() function has a major flaw as it does not cleanup multibyte spaces.
I see two options to this problem:
- implement mb_trim()
- add support for multibyte spaces to the existing function
Code example in php 8.1.8
```php
// does not work
echo var_dump(trim('小野 ')); // string(9) "小野 "
// temporary solution
echo var_dump(preg_replace("/^\s+|\s+$/u", "", "小野 ")); //
string(6) "小野"
```