]> granicus.if.org Git - php/commitdiff
Fixed Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
authorXinchen Hui <laruence@php.net>
Sun, 17 Nov 2013 09:04:37 +0000 (17:04 +0800)
committerXinchen Hui <laruence@php.net>
Sun, 17 Nov 2013 09:04:37 +0000 (17:04 +0800)
NEWS
ext/standard/basic_functions.c
ext/standard/tests/general_functions/bug66094.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 029e975b64cc97bf320588c48f52bc3c7909672e..e06dc8334fb3dcbf2773932bd58ec10b1b52d037 100644 (file)
--- 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)
 
index a9ce7deefdeea2f6775b082d3dd4ad1b176704b3..ba0051630fb734ec69eabdf97dbbb01b5b1c2105 100644 (file)
@@ -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 (file)
index 0000000..8b33a4f
--- /dev/null
@@ -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