Commit f89291a94f8 for php.net

commit f89291a94f8ee886b2d5da6851726f846e351bed
Author: Louis-Arnaud <la.catoire@gmail.com>
Date:   Fri Aug 21 21:58:21 2026 +0200

    ext/standard: declare true as the return type of header_register_callback() (#23402)

    The function has a single non-throwing exit, RETURN_TRUE (main/SAPI.c).
    The false return disappeared in PHP 8.0.0: until then an invalid callback
    was rejected with RETURN_FALSE, whereas the zend_parse_parameters() 'f'
    specifier introduced there throws a TypeError. Registering a callback
    after the headers have been sent, the one case where the callback is
    knowingly discarded, also returns true.

    ksort(), asort() and natsort() already declare true in the same stub.

diff --git a/UPGRADING b/UPGRADING
index b2c488220f2..d8fc594e82f 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -615,6 +615,9 @@ PHP 8.6 UPGRADE NOTES
     returned.

 - Standard:
+  . header_register_callback() now declares true as its return type. It has not
+    been able to return false since PHP 8.0.0, where passing an invalid
+    callback started throwing a TypeError instead.
   . ini_get_all() now includes a "builtin_default_value" element for each
     directive when $details is true. It holds the built-in default value of the
     directive (or null if it has none), independent of values set in php.ini,
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index c87e2243340..42cb711512b 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -1505,7 +1505,7 @@ function set_time_limit(int $seconds): bool {}

 /* main/SAPI.c */

-function header_register_callback(callable $callback): bool {}
+function header_register_callback(callable $callback): true {}

 /* main/output.c */

diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index ab8c57d4e8d..a057d3d48be 100644
Binary files a/ext/standard/basic_functions_arginfo.h and b/ext/standard/basic_functions_arginfo.h differ
diff --git a/ext/standard/basic_functions_decl.h b/ext/standard/basic_functions_decl.h
index 02203be0df4..ab0a8ec94f7 100644
Binary files a/ext/standard/basic_functions_decl.h and b/ext/standard/basic_functions_decl.h differ