summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/tests/general_functions/bug66094.phpt12
2 files changed, 13 insertions, 1 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index a9ce7deefd..ba0051630f 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5724,7 +5724,7 @@ PHP_FUNCTION(unregister_tick_function)
return;
}
- if (Z_TYPE_P(function) != IS_ARRAY) {
+ if (Z_TYPE_P(function) != IS_ARRAY && Z_TYPE_P(function) != IS_OBJECT) {
convert_to_string(function);
}
diff --git a/ext/standard/tests/general_functions/bug66094.phpt b/ext/standard/tests/general_functions/bug66094.phpt
new file mode 100644
index 0000000000..8b33a4f4c3
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug66094.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
+--FILE--
+<?php
+declare(ticks=1);
+register_tick_function($closure = function () { echo "Tick!\n"; });
+unregister_tick_function($closure);
+echo "done";
+?>
+--EXPECTF--
+Tick!
+done