[php-src] Issue #12457: `zend_memnistr` results are incorrect under certain conditions
| From: | SakiTakamachi | Date: | Tue, 17 Oct 2023 13:36:02 +0000 |
| Subject: | [php-src] Issue #12457: `zend_memnistr` results are incorrect under certain conditions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245593@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12457
Author: SakiTakamachi
### Description
The following code:
```php
<?php
var_dump(stripos('aaBBBBBbb', 'b'));
```
Resulted in this output:
```
int(7)
```
But I expected this output instead:
```
int(2)
```
This occurs when the following conditions are met:
-
$needle is single character
- (Number of characters from the first lowercase letter to the end) >= (Number of characters from
the beginning to the first uppercase letter)
- Uppercase letters appear before lowercase letters
### PHP Version
PHP8.2+
### Operating System
any