From 186efd3b41657f3a2cf392f27dca3eb67bbbf7f4 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Tue, 18 Aug 2026 08:09:48 +0200 Subject: [PATCH] ext/standard: declare true as the return type of register_tick_function() The function either throws on an invalid callback or appends the entry to the tick list and returns true; php_add_tick_function() returns void, so there is nothing that could report a failure. --- UPGRADING | 3 +++ ext/standard/basic_functions.stub.php | 2 +- ext/standard/basic_functions_arginfo.h | 4 ++-- ext/standard/basic_functions_decl.h | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/UPGRADING b/UPGRADING index b55cb53a2bad..c597dd36674c 100644 --- a/UPGRADING +++ b/UPGRADING @@ -618,6 +618,9 @@ PHP 8.6 UPGRADE NOTES . 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. + . register_tick_function() now declares true as its return type. It has + always returned true on success; an invalid callback throws a TypeError + via ZPP before the function body is reached. . 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 42cb711512b8..3e23934cbc78 100644 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -2063,7 +2063,7 @@ function getprotobyname(string $protocol): int|false {} function getprotobynumber(int $protocol): string|false {} #endif -function register_tick_function(callable $callback, mixed ...$args): bool {} +function register_tick_function(callable $callback, mixed ...$args): true {} function unregister_tick_function(callable $callback): void {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index a057d3d48be3..442085e9d6cc 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit basic_functions.stub.php instead. - * Stub hash: 13b6fd340958d1a7c782c8f5f3685517e62e5edc + * Stub hash: c645e310c00d9f4cb3856c94ee60d06071e28de0 * Has decl header: yes */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) @@ -574,7 +574,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getprotobynumber, 0, 1, MAY_BE_S ZEND_END_ARG_INFO() #endif -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_tick_function, 0, 1, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_tick_function, 0, 1, IS_TRUE, 0) ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() diff --git a/ext/standard/basic_functions_decl.h b/ext/standard/basic_functions_decl.h index ab0a8ec94f7b..f2f234f60cc2 100644 --- a/ext/standard/basic_functions_decl.h +++ b/ext/standard/basic_functions_decl.h @@ -1,8 +1,8 @@ /* This is a generated file, edit basic_functions.stub.php instead. - * Stub hash: 13b6fd340958d1a7c782c8f5f3685517e62e5edc */ + * Stub hash: c645e310c00d9f4cb3856c94ee60d06071e28de0 */ -#ifndef ZEND_BASIC_FUNCTIONS_DECL_13b6fd340958d1a7c782c8f5f3685517e62e5edc_H -#define ZEND_BASIC_FUNCTIONS_DECL_13b6fd340958d1a7c782c8f5f3685517e62e5edc_H +#ifndef ZEND_BASIC_FUNCTIONS_DECL_c645e310c00d9f4cb3856c94ee60d06071e28de0_H +#define ZEND_BASIC_FUNCTIONS_DECL_c645e310c00d9f4cb3856c94ee60d06071e28de0_H typedef enum zend_enum_SortDirection { ZEND_ENUM_SortDirection_Ascending = 1, @@ -20,4 +20,4 @@ typedef enum zend_enum_RoundingMode { ZEND_ENUM_RoundingMode_PositiveInfinity = 8, } zend_enum_RoundingMode; -#endif /* ZEND_BASIC_FUNCTIONS_DECL_13b6fd340958d1a7c782c8f5f3685517e62e5edc_H */ +#endif /* ZEND_BASIC_FUNCTIONS_DECL_c645e310c00d9f4cb3856c94ee60d06071e28de0_H */