Skip to content

Deprecate ticks #6967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Zend/tests/bug43027.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion Zend/tests/declare_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion Zend/tests/declare_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion Zend/tests/jump12.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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!
2 changes: 2 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion ext/pcntl/tests/signal_closure_handler.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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!
2 changes: 2 additions & 0 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/basic_functions_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion ext/standard/tests/general_functions/bug41037.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion ext/standard/tests/general_functions/bug66094.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions ext/standard/tests/general_functions/closures_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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