[php-src] Issue #9613: mb_strpos matches illegal character when haystack is '?'
| From: | youkidearitai | Date: | Mon, 26 Sep 2022 14:11:56 +0000 |
| Subject: | [php-src] Issue #9613: mb_strpos matches illegal character when haystack is '?' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242463@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9613
Author: youkidearitai
### Description
The following code:
```php
<?php
var_dump(mb_strpos("AあいうえおBBcC", "?", 0, "ISO-2022-JP"));
var_dump(mb_stripos("AあいうえおBBcC", "?", 0, "ISO-2022-JP"));
var_dump(mb_strpos("AあいうえおBBcC", "?", 0, "SJIS"));
var_dump(mb_stripos("AあいうえおBBcC", "?", 0, "SJIS"));
```
Resulted in this output:
```
int(1)
int(5)
int(1)
int(5)
```
But I expected this output instead:
```
bool(false)
bool(false)
bool(false)
bool(false)
```
note: mb_stripos is affect mb_substitute_character, but mb_strpos is not affect it is (3v4l: https://3v4l.org/872nB )
### PHP Version
PHP 8.1.x
### Operating System
Ubuntu 20.04 on WSL2