Commit e4c45064e7d for php

commit e4c45064e7dbb2c96258cf3cc72c0569e8085cdf
Author: Weilin Du <weilindu@php.net>
Date:   Thu Dec 3 21:17:27 2026 +0800

    ext/intl: Implement Spoofchecker::getChecks()

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

 - Intl:
   . Added IntlNumberFormatter::toSkeleton(). (Weilin Du)
+  . Added Spoofchecker::getChecks(). (Weilin Du)
   . Added Spoofchecker::getAllowedLocales(). (Weilin Du)
   . Added Spoofchecker::getRestrictionLevel(). (Weilin Du)
   . Added Collator::getRules() and collator_get_rules(). (Weilin Du)
diff --git a/UPGRADING b/UPGRADING
index af6faa51bff..a65cff85ba1 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -171,6 +171,7 @@ 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::getChecks() to retrieve the enabled checks as a bitmask.
   . Added Spoofchecker::getAllowedLocales() to retrieve the configured locale
     list.
   . Added Spoofchecker::getRestrictionLevel() to retrieve the configured
diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php
index 61d6e7b40b1..f5e957513de 100644
--- a/ext/intl/spoofchecker/spoofchecker.stub.php
+++ b/ext/intl/spoofchecker/spoofchecker.stub.php
@@ -78,6 +78,8 @@ public function getAllowedLocales(): string {}
     /** @tentative-return-type */
     public function setChecks(int $checks): void {}

+    public function getChecks(): int {}
+
     /** @tentative-return-type */
     public function setRestrictionLevel(int $level): void {}

diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h
index 90483fd79a5..f76bf73d54b 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 2293da91282..f7a165462fd 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.cpp
+++ b/ext/intl/spoofchecker/spoofchecker_main.cpp
@@ -156,6 +156,25 @@ PHP_METHOD(Spoofchecker, setChecks)
 }
 /* }}} */

+/* {{{ Get the enabled checks as a bitmask. */
+PHP_METHOD(Spoofchecker, getChecks)
+{
+	SPOOFCHECKER_METHOD_INIT_VARS;
+
+	ZEND_PARSE_PARAMETERS_NONE();
+
+	SPOOFCHECKER_METHOD_FETCH_OBJECT;
+
+	int32_t checks = uspoof_getChecks(co->uspoof, SPOOFCHECKER_ERROR_CODE_P(co));
+	if (U_FAILURE(SPOOFCHECKER_ERROR_CODE(co))) {
+		intl_error_set_code(nullptr, SPOOFCHECKER_ERROR_CODE(co));
+		zend_throw_exception(IntlException_ce_ptr, "Failed to retrieve enabled checks", 0);
+		RETURN_THROWS();
+	}
+	RETURN_LONG(checks);
+}
+/* }}} */
+
 /* TODO Document this method on PHP.net */
 /* {{{ Set the loosest restriction level allowed for strings. */
 PHP_METHOD(Spoofchecker, setRestrictionLevel)
diff --git a/ext/intl/tests/spoofchecker_get_checks.phpt b/ext/intl/tests/spoofchecker_get_checks.phpt
new file mode 100644
index 00000000000..bab0f05172c
--- /dev/null
+++ b/ext/intl/tests/spoofchecker_get_checks.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Spoofchecker::getChecks() reflects changes to the checker
+--EXTENSIONS--
+intl
+--FILE--
+<?php
+$checker = new Spoofchecker();
+$checker->setChecks(Spoofchecker::INVISIBLE);
+var_dump($checker->getChecks() === Spoofchecker::INVISIBLE);
+
+$checker->setAllowedLocales('en');
+var_dump($checker->getChecks() === (Spoofchecker::INVISIBLE | Spoofchecker::CHAR_LIMIT));
+$checker->setAllowedLocales('');
+var_dump($checker->getChecks() === Spoofchecker::INVISIBLE);
+
+$checker->setChecks(0);
+var_dump($checker->getChecks());
+$checker->setAllowedChars('[a-z]');
+var_dump($checker->getChecks() === Spoofchecker::CHAR_LIMIT);
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+int(0)
+bool(true)
diff --git a/ext/intl/tests/spoofchecker_get_checks_unconstructed.phpt b/ext/intl/tests/spoofchecker_get_checks_unconstructed.phpt
new file mode 100644
index 00000000000..e95ef6753a2
--- /dev/null
+++ b/ext/intl/tests/spoofchecker_get_checks_unconstructed.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Spoofchecker::getChecks() rejects an unconstructed object
+--EXTENSIONS--
+intl
+--FILE--
+<?php
+$checker = new class extends Spoofchecker {
+    public function __construct() {}
+};
+
+try {
+    $checker->getChecks();
+} catch (Error $e) {
+    echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+Found unconstructed Spoofchecker