[php-src] PR #22495: ext/Intl: Fix IntlIterator::current() on invalid iterators
| From: | LamentXU123 | Date: | Sun, 28 Jun 2026 05:05:17 +0000 |
| Subject: | [php-src] PR #22495: ext/Intl: Fix IntlIterator::current() on invalid iterators | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36705@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22495
Author: LamentXU123
IntlIterator::current() could expose an undefined zval when called before theiterator
is positioned, or after the iterator becomes invalid.
In these cases we directly returns the undefined zval and cause to a UNKNOWN:0 output
in userland. Generally, a NULL output would be more proper.
```php
<?php
$it = IntlBreakIterator::createWordInstance('en_US')->getPartsIterator();
var_dump($it->current());
```
output:
```
UNKNOWN:0
```
but I expected
```
NULL
```
Reproduce
[here](https://onlinephp.io?s=s7EvyCjg5VLJLFGwVfDMK8lxKkpNzPYsSS1KLMkvsrJKBnJLUsPzi1I884pLEvOSUzXUU_PiQ4PVNXXt0lNLAhKLSophyjU0rXm5yhKL4lNKcws0gGbq2iWXFhWl5pVoaGpaAwA%2C&v=8.5.6)