[php-src] Issue #9970: mb_ereg_search_pos fails test "start of string" when using mb_ereg_search_setpos
| From: | dashiad | Date: | Fri, 18 Nov 2022 14:58:52 +0000 |
| Subject: | [php-src] Issue #9970: mb_ereg_search_pos fails test "start of string" when using mb_ereg_search_setpos | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242850@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9970
Author: dashiad
### Description
The following code:
```php
<?php
mb_ereg_search_init("qaaoiuu");
mb_ereg_search_setpos(1);
var_dump(mb_ereg_search_pos("^a{2}(..)u{2}"));
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
array(2) {
[0]=>
int(1)
[1]=>
int(6)
}
```
The "^" modifier is not applying to the start of the whole string either (independently of
"setpos"), as :
```php
<?php
mb_ereg_search_init("aaoiuu");
mb_ereg_search_setpos(1);
var_dump(mb_ereg_search_pos("^a{2}(..)u{2}"));
```
Returns false too (this should be expected).
```
bool(false)
```
Does "^" have a different meaning in the mb_ereg_search functions?
### PHP Version
PHP 8.1.12 and previous versions
### Operating System
_No response_