[php-src] Issue #8128: mb_check_encoding wrong result for 7bit
| From: | divinity76 | Date: | Mon, 21 Feb 2022 10:06:51 +0000 |
| Subject: | [php-src] Issue #8128: mb_check_encoding wrong result for 7bit | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239913@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8128
Author: divinity76
### Description
The following code:
```php
<?php
function is_7bit_clean(string $str):bool{
for($i=0,$imax=strlen($str);$i<$imax;++$i){
if(ord($str[$i]) & (1 << 7)){
return false;
}
}
return true;
}
$str = chr(255);
var_dump(is_7bit_clean($str) === mb_check_encoding($str, '7bit'));
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
bool(true)
```
as of 8.1.2. probably related to GH #7712
### PHP Version
PHP 8.1.2
### Operating System
_No response_