diff options
author | Stanislav Malyshev <stas@php.net> | 2010-04-19 19:45:03 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2010-04-19 19:45:03 +0000 |
commit | c93a4f192bb338aa9a22d44276684cf92dfe902d (patch) | |
tree | 4e2aa5c989856d9bafd0415f5d7d0ebd4d9c8458 /Zend/tests/closure_024.phpt | |
parent | 5a211da7af41f82ec123e63990942eae567dfef2 (diff) | |
download | php-git-c93a4f192bb338aa9a22d44276684cf92dfe902d.tar.gz |
restore $this support for closures to its former glory
Diffstat (limited to 'Zend/tests/closure_024.phpt')
-rw-r--r-- | Zend/tests/closure_024.phpt | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Zend/tests/closure_024.phpt b/Zend/tests/closure_024.phpt index 504e81efd9..74083f73bc 100644 --- a/Zend/tests/closure_024.phpt +++ b/Zend/tests/closure_024.phpt @@ -1,16 +1,26 @@ --TEST-- -Closure 024: Trying to clone the Closure object +Closure 024: Clone the Closure object --FILE-- <?php -$a = function () { - return clone function () { - return 1; - }; -}; +$a = 1; +$c = function($add) use(&$a) { return $a+$add; }; -$a(); +$cc = clone $c; +echo $c(10)."\n"; +echo $cc(10)."\n"; + +$a++; + +echo $c(10)."\n"; +echo $cc(10)."\n"; + +echo "Done.\n"; ?> --EXPECTF-- -Fatal error: Trying to clone an uncloneable object of class Closure in %s on line %d +11 +11 +12 +12 +Done.
\ No newline at end of file |