com php-src: Fixed Bug #66094 (unregister_tick_function tries to cast a Closure to a string): NE WS ext/standard/basic_functions.c
ext/standard/tests/ge neral_functions/bug66094.phpt
| From: | Xinchen Hui | Date: | Sun, 17 Nov 2013 09:04:37 +0000 |
| Subject: | com php-src: Fixed Bug #66094 (unregister_tick_function tries to cast a Closure to a string): NE WS ext/standard/basic_functions.c ext/standard/tests/ge neral_functions/bug66094.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73966@lists.php.net to get a copy of this message | ||
Commit: 823e330c75a7ed87dcdcd692f8672420c1abe244
Author: Xinchen Hui <laruence@php.net> Sun, 17 Nov 2013 17:04:37 +0800
Parents: c9cfd98bcdcd92aa0efebda6ab8a3db5605a6796
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=823e330c75a7ed87dcdcd692f8672420c1abe244
Log:
Fixed Bug #66094 (unregister_tick_function tries to cast a Closure to a string)
Bugs:
https://bugs.php.net/66094
Changed paths:
M NEWS
M ext/standard/basic_functions.c
A ext/standard/tests/general_functions/bug66094.phpt
Diff:
diff --git a/NEWS b/NEWS
index 029e975..e06dc83 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 a9ce7de..ba00516 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 0000000..8b33a4f
--- /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