[doc-en] master: ext/intl: document PHP 8.5 changes (#5806)
| From: | Louis-Arnaud via GitHub | Date: | Wed, 02 Sep 2026 08:15:28 +0000 |
| Subject: | [doc-en] master: ext/intl: document PHP 8.5 changes (#5806) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23695@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-09-02T10:15:25+02:00
Commit: https://github.com/php/doc-en/commit/255b4f159662a2915dd5ac7e415148d064ff1c62
Raw diff: https://github.com/php/doc-en/commit/255b4f159662a2915dd5ac7e415148d064ff1c62.diff
ext/intl: document PHP 8.5 changes (#5806)
* ext/intl: document PHP 8.5 changes
- Add Locale::addLikelySubtags() and Locale::minimizeSubtags() methods
- Add grapheme_levenshtein() function
- Locale methods now throw ValueError when locale arguments contain
null bytes
* docs(intl): add missing seealso links to Locale and grapheme pages
Changed paths:
A reference/intl/locale/add-likely-subtags.xml
A reference/intl/locale/minimize-subtags.xml
M reference/intl/locale.xml
Diff:
diff --git a/reference/intl/locale.xml b/reference/intl/locale.xml
index 3ecb571c876a..18a051ebfe4a 100644
--- a/reference/intl/locale.xml
+++ b/reference/intl/locale.xml
@@ -35,7 +35,9 @@
</simpara>
<simpara>
Locales cannot be instantiated as objects. All of the functions/methods
- provided are static.
+ provided are static. Use <methodname>Locale::getDefault</methodname> and
+ <methodname>Locale::setDefault</methodname> to read and write the default
+ locale used by ICU.
</simpara>
<simpara>
The null or empty string obtains the "root" locale. The "root" locale is
@@ -177,6 +179,14 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ <classname>Locale</classname> methods now throw a
+ <exceptionname>ValueError</exceptionname> when a locale argument
+ contains null bytes.
+ </entry>
+ </row>
<row>
<entry>8.4.0</entry>
<entry>
diff --git a/reference/intl/locale/add-likely-subtags.xml
b/reference/intl/locale/add-likely-subtags.xml
new file mode 100644
index 000000000000..fa681a1905fd
--- /dev/null
+++ b/reference/intl/locale/add-likely-subtags.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="locale.addlikelysubtags" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>Locale::addLikelySubtags</refname>
+ <refname>locale_add_likely_subtags</refname>
+ <refpurpose>Add likely subtags to a locale</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <simpara>
+ &style.oop;
+ </simpara>
+ <methodsynopsis role="Locale">
+ <modifier>public</modifier> <modifier>static</modifier> <type
class="union"><type>string</type><type>false</type></type><methodname>Locale::addLikelySubtags</methodname>
+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ &style.procedural;
+ </simpara>
+ <methodsynopsis>
+ <type
class="union"><type>string</type><type>false</type></type><methodname>locale_add_likely_subtags</methodname>
+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Expands a locale tag by adding likely subtags based on the ICU locale data.
+ For example, <literal>en</literal> becomes
<literal>en_Latn_US</literal>.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>locale</parameter></term>
+ <listitem>
+ <simpara>
+ The locale to expand.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns the locale with likely subtags added, or &false; on failure.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> when the
<parameter>locale</parameter>
+ argument contains null bytes.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><methodname>Locale::minimizeSubtags</methodname></member>
+ <member><methodname>Locale::canonicalize</methodname></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/intl/locale/minimize-subtags.xml b/reference/intl/locale/minimize-subtags.xml
new file mode 100644
index 000000000000..9bdaa3f40ae3
--- /dev/null
+++ b/reference/intl/locale/minimize-subtags.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="locale.minimizesubtags" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>Locale::minimizeSubtags</refname>
+ <refname>locale_minimize_subtags</refname>
+ <refpurpose>Remove likely subtags from a locale</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <simpara>
+ &style.oop;
+ </simpara>
+ <methodsynopsis role="Locale">
+ <modifier>public</modifier> <modifier>static</modifier> <type
class="union"><type>string</type><type>false</type></type><methodname>Locale::minimizeSubtags</methodname>
+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ &style.procedural;
+ </simpara>
+ <methodsynopsis>
+ <type
class="union"><type>string</type><type>false</type></type><methodname>locale_minimize_subtags</methodname>
+
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Minimizes a locale tag by removing subtags that can be inferred using the
+ ICU likely subtag data. For example, <literal>en_Latn_US</literal> becomes
+ <literal>en</literal>.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>locale</parameter></term>
+ <listitem>
+ <simpara>
+ The locale to minimize.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns the locale with likely subtags removed, or &false; on failure.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> when the
<parameter>locale</parameter>
+ argument contains null bytes.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><methodname>Locale::addLikelySubtags</methodname></member>
+ <member><methodname>Locale::canonicalize</methodname></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->