[php-src] Issue #8980: ltrim with the diacritic symbol U+F007 removes the letter B
| From: | D4ryB3rry | Date: | Tue, 12 Jul 2022 09:59:24 +0000 |
| Subject: | [php-src] Issue #8980: ltrim with the diacritic symbol U+F007 removes the letter B | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241906@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8980
Author: D4ryB3rry
### Description
With uppercase letters the B gets removed.
With lowercase letters n,r,t,x are removed.
To test with lowercase change $baseLetter from 'A' to 'a'.
i don't understand why this happens.
The following code:
```php
<?php
$prepend = ' ';
$symbold = sprintf(' \t\n\r\0\x0B%s,'');
$base = "lücher";
$baseLetter = 'A';
for ($i = 0, $len = 26; $i < $len; $i++) {
var_dump(ltrim($prepend . $baseLetter++ . $base, $symbold));
}
```
Resulted in this output:
```
string(8) "Alücher"
string(7) "lücher"
string(8) "Clücher"
string(8) "Dlücher"
string(8) "Elücher"
string(8) "Flücher"
string(8) "Glücher"
string(8) "Hlücher"
string(8) "Ilücher"
string(8) "Jlücher"
string(8) "Klücher"
string(8) "Llücher"
string(8) "Mlücher"
string(8) "Nlücher"
string(8) "Olücher"
string(8) "Plücher"
string(8) "Qlücher"
string(8) "Rlücher"
string(8) "Slücher"
string(8) "Tlücher"
string(8) "Ulücher"
string(8) "Vlücher"
string(8) "Wlücher"
string(8) "Xlücher"
string(8) "Ylücher"
string(8) "Zlücher"
```
But I expected this output instead:
```
string(8) "Alücher"
string(8) "Blücher"
string(8) "Clücher"
string(8) "Dlücher"
string(8) "Elücher"
string(8) "Flücher"
string(8) "Glücher"
string(8) "Hlücher"
string(8) "Ilücher"
string(8) "Jlücher"
string(8) "Klücher"
string(8) "Llücher"
string(8) "Mlücher"
string(8) "Nlücher"
string(8) "Olücher"
string(8) "Plücher"
string(8) "Qlücher"
string(8) "Rlücher"
string(8) "Slücher"
string(8) "Tlücher"
string(8) "Ulücher"
string(8) "Vlücher"
string(8) "Wlücher"
string(8) "Xlücher"
string(8) "Ylücher"
string(8) "Zlücher"
```
### PHP Version
PHP 8.0.20
### Operating System
Ubuntu 20.04