ext/intl: correct the 8.4.0 Error normalization, it only concerns cloning - #5798
Open
lacatoire wants to merge 1 commit into
Open
ext/intl: correct the 8.4.0 Error normalization, it only concerns cloning#5798lacatoire wants to merge 1 commit into
lacatoire wants to merge 1 commit into
Conversation
…ning
Only the clone path changed in 8.4.0. Throwing an Error when a method is
called on a non-initialized Intl object is not new: the macros doing so
date back to 2012 and PHP 8.3 behaves identically. Saying the classes
"always throw" is also falsifiable on 8.4: UConverter::convert() returns
false, ResourceBundle::get() returns null and Collator::getAttribute()
returns -1 on a non-initialized object.
What 8.4.0 changed is the clone handlers, and both of their branches
matter: refusing to clone a non-initialized object, and an initialized
object whose ICU clone() call fails. Formerly most classes threw a base
Exception there, and Spoofchecker raised an uncatchable fatal error.
- reference/intl/book.xml: restate the note accordingly
- appendices/migration84/other-changes.xml: fix the same overstatement in
the migration entry so both places agree
Sources
- php-src 33f1cf202ef ("ext/intl: Various refactoring", php-src#14360):
"Normalize cloning error handling behaviour - Always throw a Error
exception as we cannot progress from here". Only clone paths and idn.c
are touched, no INTL_METHOD_CHECK_STATUS macro.
- UPGRADING (PHP 8.4) section 9, added by cd44826c1af
- Pre-existing Error on use: a5d0c1e21b (2012-08-21), f5b421621d (2012-05-31)
lacatoire
force-pushed
the
intl-uninitialized-error
branch
from
August 26, 2026 09:32
6f09f8b to
be9fb1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only the clone path changed in 8.4.0, so the note is restated accordingly.
Throwing an
Errorwhen a method is called on a non-initialized Intl object is not new: the macros doing so date back to 2012 and PHP 8.3 behaves identically (verified onphp:8.3andphp:8.4withintlbuilt in, acrossCollator,NumberFormatter,MessageFormatter,IntlDateFormatter,IntlCalendar,IntlTimeZone,Spoofchecker,Transliterator,IntlDatePatternGenerator,IntlBreakIterator). Saying the classes always throw is also falsifiable on 8.4:UConverter::convert()returnsfalse,ResourceBundle::get()returnsnullandCollator::getAttribute()returns-1on a non-initialized object.What 8.4.0 changed is the clone handlers, and both of their branches matter:
Cannot clone uninitialized X)clone()call fails (Failed to clone X)Formerly most classes threw a base
Exceptionthere, andSpoofcheckerraised an uncatchable fatal error, which is the part users actually have to adapt theircatchblocks for.reference/intl/book.xml: restate the noteappendices/migration84/other-changes.xml: fix the same overstatement in the migration entry, so the two places agree rather than driftSources
Error33f1cf202ef(php-src#14360) - "Normalize cloning error handling behaviour - Always throw a Error exception as we cannot progress from here". Only clone paths andidn.care touched, noINTL_METHOD_CHECK_STATUSmacro.cd44826c1afErroron use predates 8.4a5d0c1e21b(2012-08-21),f5b421621d(2012-05-31)