Skip to content

Commit afe4a87

Browse files
committed
Promote register_tick_function() callback validation warning to an exception
1 parent 662afc8 commit afe4a87

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ext/standard/basic_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,9 +4278,9 @@ PHP_FUNCTION(register_tick_function)
42784278

42794279
if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) {
42804280
efree(tick_fe.arguments);
4281-
php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
4281+
zend_type_error("Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
42824282
zend_string_release_ex(function_name, 0);
4283-
RETURN_FALSE;
4283+
return;
42844284
} else if (function_name) {
42854285
zend_string_release_ex(function_name, 0);
42864286
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
register_tick_function only accepts a valid callback as parameter
3+
--FILE--
4+
<?php
5+
declare(ticks=1);
6+
7+
try {
8+
register_tick_function("a");
9+
} catch (TypeError $exception) {
10+
echo $exception->getMessage() . "\n";
11+
}
12+
?>
13+
--EXPECT--
14+
Invalid tick callback 'a' passed

0 commit comments

Comments
 (0)