Commit 6aac0a7c687 for php

commit 6aac0a7c687964c4afa561aa34aeca7ffab30ff9
Author: Weilin Du <weilindu@php.net>
Date:   Thu Dec 3 21:16:46 2026 +0800

    ext/intl: Implement Spoofchecker::getAllowedLocales()

diff --git a/NEWS b/NEWS
index aac6185cb06..fb26d646a6d 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,7 @@ PHP                                                                        NEWS

 - Intl:
   . Added IntlNumberFormatter::toSkeleton(). (Weilin Du)
+  . Added Spoofchecker::getAllowedLocales(). (Weilin Du)
   . Added Spoofchecker::getRestrictionLevel(). (Weilin Du)
   . Added Collator::getRules() and collator_get_rules(). (Weilin Du)
   . Added IntlRelativeDateTimeFormatter for locale-aware relative date and time
diff --git a/UPGRADING b/UPGRADING
index 994b4fd0cf6..af6faa51bff 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -171,6 +171,8 @@ PHP 8.7 UPGRADE NOTES
     the rules cannot be converted to UTF-8.
   . Added IntlNumberFormatter::toSkeleton() to export the formatter settings
     as a normalized, locale-independent ICU number skeleton.
+  . Added Spoofchecker::getAllowedLocales() to retrieve the configured locale
+    list.
   . Added Spoofchecker::getRestrictionLevel() to retrieve the configured
     restriction level as one of the Spoofchecker restriction level constants.
   . Added grapheme_str_pad() to pad a string to a length counted in grapheme
diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php
index 0232f5ccbe4..61d6e7b40b1 100644
--- a/ext/intl/spoofchecker/spoofchecker.stub.php
+++ b/ext/intl/spoofchecker/spoofchecker.stub.php
@@ -73,6 +73,8 @@ public function areConfusable(string $string1, string $string2, &$errorCode = nu
     /** @tentative-return-type */
     public function setAllowedLocales(string $locales): void {}

+    public function getAllowedLocales(): string {}
+
     /** @tentative-return-type */
     public function setChecks(int $checks): void {}

diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h
index 550096605ea..90483fd79a5 100644
Binary files a/ext/intl/spoofchecker/spoofchecker_arginfo.h and b/ext/intl/spoofchecker/spoofchecker_arginfo.h differ
diff --git a/ext/intl/spoofchecker/spoofchecker_main.cpp b/ext/intl/spoofchecker/spoofchecker_main.cpp
index cbadf6f3d1b..2293da91282 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.cpp
+++ b/ext/intl/spoofchecker/spoofchecker_main.cpp
@@ -116,6 +116,25 @@ PHP_METHOD(Spoofchecker, setAllowedLocales)
 }
 /* }}} */

+/* {{{ Get the configured list of allowed locales. */
+PHP_METHOD(Spoofchecker, getAllowedLocales)
+{
+	SPOOFCHECKER_METHOD_INIT_VARS;
+
+	ZEND_PARSE_PARAMETERS_NONE();
+
+	SPOOFCHECKER_METHOD_FETCH_OBJECT;
+
+	const char *locales = uspoof_getAllowedLocales(co->uspoof, SPOOFCHECKER_ERROR_CODE_P(co));
+	if (UNEXPECTED(locales == nullptr)) {
+		intl_error_set_code(nullptr, SPOOFCHECKER_ERROR_CODE(co));
+		zend_throw_exception(IntlException_ce_ptr, "Failed to retrieve allowed locales", 0);
+		RETURN_THROWS();
+	}
+	RETURN_STRING(locales);
+}
+/* }}} */
+
 /* {{{ Set the checks to run */
 PHP_METHOD(Spoofchecker, setChecks)
 {
diff --git a/ext/intl/tests/spoofchecker_get_allowed_locales.phpt b/ext/intl/tests/spoofchecker_get_allowed_locales.phpt
new file mode 100644
index 00000000000..0fbb8ddcf81
--- /dev/null
+++ b/ext/intl/tests/spoofchecker_get_allowed_locales.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Spoofchecker::getAllowedLocales() reflects changes to the checker
+--EXTENSIONS--
+intl
+--FILE--
+<?php
+$checker = new Spoofchecker();
+var_dump($checker->getAllowedLocales());
+
+$checker->setAllowedLocales('en');
+$locales = $checker->getAllowedLocales();
+$checker->setAllowedLocales('');
+var_dump($checker->getAllowedLocales(), $locales);
+?>
+--EXPECT--
+string(0) ""
+string(0) ""
+string(2) "en"
diff --git a/ext/intl/tests/spoofchecker_get_allowed_locales_unconstructed.phpt b/ext/intl/tests/spoofchecker_get_allowed_locales_unconstructed.phpt
new file mode 100644
index 00000000000..fe4c2074e5f
--- /dev/null
+++ b/ext/intl/tests/spoofchecker_get_allowed_locales_unconstructed.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Spoofchecker::getAllowedLocales() rejects an unconstructed object
+--EXTENSIONS--
+intl
+--FILE--
+<?php
+$checker = new class extends Spoofchecker {
+    public function __construct() {}
+};
+
+try {
+    $checker->getAllowedLocales();
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+Found unconstructed Spoofchecker