Skip to content

ext/Intl: fix IntlListFormatter object error state after format() failures.#22119

Open
LamentXU123 wants to merge 2 commits into
php:PHP-8.5from
LamentXU123:bug-fix-18
Open

ext/Intl: fix IntlListFormatter object error state after format() failures.#22119
LamentXU123 wants to merge 2 commits into
php:PHP-8.5from
LamentXU123:bug-fix-18

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

@LamentXU123 LamentXU123 commented May 22, 2026

This fixes:

<?php

$formatter = new IntlListFormatter('en_US');

var_dump($formatter->format(["\x80"]));         // bool(false)
var_dump($formatter->getErrorCode());           // int(0)
var_dump($formatter->getErrorMessage());        // string(12) "U_ZERO_ERROR"

var_dump(intl_get_error_code());                // int(10)
var_dump(intl_get_error_message());             // string(...) "IntlListFormatter::format(): Failed to convert string to UTF-16: U_INVALID_CHAR_FOUND"

Which is because IntlListFormatter doesn't pass error status to object but only to global status. Not yet found similar bugs.

Targeting 8.5 as IntlListFormatter is a new feature in 8.5.

To reproduce, see sandbox

@devnexen
Copy link
Copy Markdown
Member

looks legit but I ll have a better look at this in the following days.

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