summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2013-11-17 17:04:37 +0800
committerXinchen Hui <laruence@php.net>2013-11-17 17:04:37 +0800
commit823e330c75a7ed87dcdcd692f8672420c1abe244 (patch)
tree66270b46f51c1d50d92d1291ecb657c22db54dda
parentc9cfd98bcdcd92aa0efebda6ab8a3db5605a6796 (diff)
downloadphp-git-823e330c75a7ed87dcdcd692f8672420c1abe244.tar.gz
Fixed Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
-rw-r--r--NEWS2
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/tests/general_functions/bug66094.phpt12
3 files changed, 15 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 029e975b64..e06dc8334f 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2013, PHP 5.4.23
- Core:
+ . Fixed bug #66094 (unregister_tick_function tries to cast a Closure to a
+ string). (Laruence)
. Fixed bug #65947 (basename is no more working after fgetcsv in certain
situation). (Laruence)
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