[doc-en] master: ext/intl: correct the 8.4.0 Error normalization, it only concerns cloning (#5798)
| From: | Louis-Arnaud via GitHub | Date: | Mon, 31 Aug 2026 07:27:09 +0000 |
| Subject: | [doc-en] master: ext/intl: correct the 8.4.0 Error normalization, it only concerns cloning (#5798) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23670@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-31T09:27:06+02:00
Commit: https://github.com/php/doc-en/commit/66bf3dcc3870f91bda607fe90717a8291d195236
Raw diff: https://github.com/php/doc-en/commit/66bf3dcc3870f91bda607fe90717a8291d195236.diff
ext/intl: correct the 8.4.0 Error normalization, it only concerns cloning (#5798)
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)
Changed paths:
M appendices/migration84/other-changes.xml
M reference/intl/book.xml
Diff:
diff --git a/appendices/migration84/other-changes.xml b/appendices/migration84/other-changes.xml
index fa821809bb80..05ccec6d3b98 100644
--- a/appendices/migration84/other-changes.xml
+++ b/appendices/migration84/other-changes.xml
@@ -551,9 +551,12 @@
<title>Intl</title>
<simpara>
- The behaviour of Intl class has been normalized to always throw
- <exceptionname>Error</exceptionname> exceptions when attempting to use
- a non-initialized object, or when cloning fails.
+ Cloning an Intl object consistently throws an
+ <exceptionname>Error</exceptionname> when the clone cannot be performed,
+ either because the object has not been initialized, or because the
+ underlying ICU clone operation failed. Formerly, most of these classes
+ threw an <exceptionname>Exception</exceptionname> instead, and
+ <classname>Spoofchecker</classname> raised a fatal error.
</simpara>
</sect3>
diff --git a/reference/intl/book.xml b/reference/intl/book.xml
index 45e180457831..eadb85ce721c 100644
--- a/reference/intl/book.xml
+++ b/reference/intl/book.xml
@@ -93,6 +93,18 @@
</listitem>
</itemizedlist>
+ <note>
+ <simpara>
+ As of PHP 8.4.0, cloning an Intl object consistently throws an
+ <exceptionname>Error</exceptionname> when the clone cannot be performed,
+ either because the object has not been initialized (created without
+ invoking its constructor), or because the underlying ICU clone operation
+ failed. Formerly, most of these classes threw an
+ <exceptionname>Exception</exceptionname> instead, and
+ <classname>Spoofchecker</classname> raised a fatal error.
+ </simpara>
+ </note>
+
<!-- {{{ Links -->
<section xml:id="intl.links">
<title>Links</title>