From 3dfd732aaf2925fa51ecd7aec22a358b1aa927dd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 10 May 2021 15:24:30 +0200 Subject: [PATCH] Deprecate ticks --- Zend/tests/bug43027.phpt | 3 ++- Zend/tests/declare_005.phpt | 5 ++++- Zend/tests/declare_007.phpt | 5 ++++- Zend/tests/jump12.phpt | 3 ++- Zend/zend_compile.c | 2 ++ ext/pcntl/tests/signal_closure_handler.phpt | 3 ++- ext/standard/basic_functions.stub.php | 2 ++ ext/standard/basic_functions_arginfo.h | 6 +++--- ext/standard/tests/general_functions/bug41037.phpt | 9 ++++++++- ext/standard/tests/general_functions/bug66094.phpt | 7 ++++++- ext/standard/tests/general_functions/closures_002.phpt | 3 +++ .../general_functions/register_tick_function_error.phpt | 5 ++++- .../unregister_tick_function_error.phpt | 5 ++++- 13 files changed, 46 insertions(+), 12 deletions(-) diff --git a/Zend/tests/bug43027.phpt b/Zend/tests/bug43027.phpt index 2cf2d1d6a5564..a43ee74f22b14 100644 --- a/Zend/tests/bug43027.phpt +++ b/Zend/tests/bug43027.phpt @@ -6,5 +6,6 @@ declare(ticks=1); namespace test; echo "ok\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d ok diff --git a/Zend/tests/declare_005.phpt b/Zend/tests/declare_005.phpt index 654f8252e0e65..4965cd1dc957b 100644 --- a/Zend/tests/declare_005.phpt +++ b/Zend/tests/declare_005.phpt @@ -12,6 +12,9 @@ foo(); } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d tick tick diff --git a/Zend/tests/declare_007.phpt b/Zend/tests/declare_007.phpt index 9344402d5cbe4..347d9d5e888a3 100644 --- a/Zend/tests/declare_007.phpt +++ b/Zend/tests/declare_007.phpt @@ -14,6 +14,9 @@ foo(); } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d tick: stdClass 3 tick: stdClass 3 diff --git a/Zend/tests/jump12.phpt b/Zend/tests/jump12.phpt index 3c244d6181995..792e71b9226ae 100644 --- a/Zend/tests/jump12.phpt +++ b/Zend/tests/jump12.phpt @@ -13,7 +13,8 @@ c: print "ok!\n"; goto b; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d ok! ok! ok! diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 884f653ed7245..5cec54596748a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6072,6 +6072,8 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ zend_const_expr_to_zval(&value_zv, value_ast_ptr); FC(declarables).ticks = zval_get_long(&value_zv); zval_ptr_dtor_nogc(&value_zv); + + zend_error(E_DEPRECATED, "declare(ticks) is deprecated"); } else if (zend_string_equals_literal_ci(name, "encoding")) { if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ 0)) { diff --git a/ext/pcntl/tests/signal_closure_handler.phpt b/ext/pcntl/tests/signal_closure_handler.phpt index ebaf84b5521d4..0f4d9bffe1983 100644 --- a/ext/pcntl/tests/signal_closure_handler.phpt +++ b/ext/pcntl/tests/signal_closure_handler.phpt @@ -19,7 +19,8 @@ $i = 0; // dummy echo "Done!\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d Start! Signal handler called! Done! diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 15abe44a0f2b9..d226912a45704 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -361,8 +361,10 @@ function getprotobyname(string $protocol): int|false {} function getprotobynumber(int $protocol): string|false {} #endif +/** @deprecated */ function register_tick_function(callable $callback, mixed ...$args): bool {} +/** @deprecated */ function unregister_tick_function(callable $callback): void {} function is_uploaded_file(string $filename): bool {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 8e06402c0c536..736807dbf07c5 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 the .stub.php file instead. - * Stub hash: 810b8bfbdf037702fcaec2ff81998c2bc2cefae8 */ + * Stub hash: 18acffadf93ba167b53af5b3dd302338a93bf03c */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -3003,8 +3003,8 @@ static const zend_function_entry ext_functions[] = { #if HAVE_GETPROTOBYNUMBER ZEND_FE(getprotobynumber, arginfo_getprotobynumber) #endif - ZEND_FE(register_tick_function, arginfo_register_tick_function) - ZEND_FE(unregister_tick_function, arginfo_unregister_tick_function) + ZEND_DEP_FE(register_tick_function, arginfo_register_tick_function) + ZEND_DEP_FE(unregister_tick_function, arginfo_unregister_tick_function) ZEND_FE(is_uploaded_file, arginfo_is_uploaded_file) ZEND_FE(move_uploaded_file, arginfo_move_uploaded_file) ZEND_FE(parse_ini_file, arginfo_parse_ini_file) diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt index 683b18ec25156..395423d37e71a 100644 --- a/ext/standard/tests/general_functions/bug41037.phpt +++ b/ext/standard/tests/general_functions/bug41037.phpt @@ -18,9 +18,16 @@ declare (ticks=1) { echo "Done\n"; } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d hello + +Deprecated: Function unregister_tick_function() is deprecated in %s on line %d Registered tick function cannot be unregistered while it is being executed Done hello + +Deprecated: Function unregister_tick_function() is deprecated in %s on line %d Registered tick function cannot be unregistered while it is being executed diff --git a/ext/standard/tests/general_functions/bug66094.phpt b/ext/standard/tests/general_functions/bug66094.phpt index d218e70efa7cf..67b21f0e72f82 100644 --- a/ext/standard/tests/general_functions/bug66094.phpt +++ b/ext/standard/tests/general_functions/bug66094.phpt @@ -7,6 +7,11 @@ register_tick_function($closure = function () { echo "Tick!\n"; }); unregister_tick_function($closure); echo "done"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d Tick! + +Deprecated: Function unregister_tick_function() is deprecated in %s on line %d done diff --git a/ext/standard/tests/general_functions/closures_002.phpt b/ext/standard/tests/general_functions/closures_002.phpt index e0ef5121c039a..b2cd215a9cd2a 100644 --- a/ext/standard/tests/general_functions/closures_002.phpt +++ b/ext/standard/tests/general_functions/closures_002.phpt @@ -17,6 +17,9 @@ echo "Done\n"; ?> --EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d Test %d %d diff --git a/ext/standard/tests/general_functions/register_tick_function_error.phpt b/ext/standard/tests/general_functions/register_tick_function_error.phpt index 9eae12c5b6925..60148131c88bd 100644 --- a/ext/standard/tests/general_functions/register_tick_function_error.phpt +++ b/ext/standard/tests/general_functions/register_tick_function_error.phpt @@ -10,5 +10,8 @@ try { echo $exception->getMessage() . "\n"; } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function register_tick_function() is deprecated in %s on line %d register_tick_function(): Argument #1 ($callback) must be a valid callback, function "a" not found or invalid function name diff --git a/ext/standard/tests/general_functions/unregister_tick_function_error.phpt b/ext/standard/tests/general_functions/unregister_tick_function_error.phpt index fd96a4658faa7..4189ee8bd301b 100644 --- a/ext/standard/tests/general_functions/unregister_tick_function_error.phpt +++ b/ext/standard/tests/general_functions/unregister_tick_function_error.phpt @@ -10,5 +10,8 @@ try { echo $exception->getMessage() . "\n"; } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: declare(ticks) is deprecated in %s on line %d + +Deprecated: Function unregister_tick_function() is deprecated in %s on line %d unregister_tick_function(): Argument #1 ($callback) must be a valid callback, function "a" not found or invalid function name