Skip to content

Commit 30f05c1

Browse files
committed
Promote warnings to exceptions in register_shutdown_handler() function
1 parent 1bb354d commit 30f05c1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Zend/tests/bug41026.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class try_class
77
{
88
static public function main ()
99
{
10-
register_shutdown_function (array ("self", "on_shutdown"));
10+
register_shutdown_function(array ("self", "on_shutdown"));
1111
}
1212

1313
static public function on_shutdown ()
@@ -16,11 +16,13 @@ class try_class
1616
}
1717
}
1818

19-
try_class::main ();
20-
19+
try_class::main();
2120
echo "Done\n";
2221
?>
2322
--EXPECT--
2423
Done
2524

26-
Warning: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in Unknown on line 0
25+
Fatal error: Uncaught ValueError: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in [no active file]:0
26+
Stack trace:
27+
#0 {main}
28+
thrown in [no active file] on line 0

ext/standard/basic_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2840,7 +2840,7 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */
28402840
if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, NULL)) {
28412841
zend_string *function_name
28422842
= zend_get_callable_name(&shutdown_function_entry->arguments[0]);
2843-
php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
2843+
zend_value_error("(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
28442844
zend_string_release_ex(function_name, 0);
28452845
return 0;
28462846
}

0 commit comments

Comments
 (0)