Skip to content

ext/Intl: Fix IntlIterator::current() on invalid iterators#22495

Merged
LamentXU123 merged 2 commits into
php:masterfrom
LamentXU123:intl-breakconverter
Jun 28, 2026
Merged

ext/Intl: Fix IntlIterator::current() on invalid iterators#22495
LamentXU123 merged 2 commits into
php:masterfrom
LamentXU123:intl-breakconverter

Conversation

@LamentXU123

Copy link
Copy Markdown
Member

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
$it = IntlBreakIterator::createWordInstance('en_US')->getPartsIterator();
var_dump($it->current());

output:

UNKNOWN:0

but I expected

NULL

Reproduce here

@LamentXU123 LamentXU123 marked this pull request as ready for review June 28, 2026 05:05
@LamentXU123 LamentXU123 requested a review from devnexen as a code owner June 28, 2026 05:05
@devnexen

Copy link
Copy Markdown
Member

that s quite a behavior change for a stable branch though

@LamentXU123

Copy link
Copy Markdown
Member Author

Almost boarder line feature rather than a bug fix. Let's target master branch then.

@LamentXU123 LamentXU123 marked this pull request as draft June 28, 2026 05:25
@LamentXU123 LamentXU123 force-pushed the intl-breakconverter branch from eee03dd to a1e4045 Compare June 28, 2026 05:32
@LamentXU123 LamentXU123 changed the base branch from PHP-8.4 to master June 28, 2026 05:32
@LamentXU123 LamentXU123 marked this pull request as ready for review June 28, 2026 05:33
@LamentXU123

LamentXU123 commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

I by the way fix the doc CI by trimming the length into 100 though it is not related in this fix.

@LamentXU123 LamentXU123 merged commit 44b11b7 into php:master Jun 28, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants