--- /dev/null
+--TEST--
+Trying to use lambda in array offset
+--FILE--
+<?php
+
+$test[function(){}] = 1;
+$a{function() { }} = 1;
+
+?>
+--EXPECTF--
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
--- /dev/null
+--TEST--
+Trying to access inexistent static property of Closure
+--FILE--
+<?php
+
+namespace closure;
+
+class closure { static $x = 1;}
+
+$x = __NAMESPACE__;
+var_dump(closure::$x);
+
+var_dump($x::$x);
+
+?>
+--EXPECTF--
+int(1)
+
+Fatal error: Access to undeclared static property: Closure::$x in %s on line %d
--- /dev/null
+--TEST--
+Trying to use lambda as array key
+--FILE--
+<?php
+
+var_dump(array(function() { } => 1));
+
+?>
+--EXPECTF--
+Warning: Illegal offset type in %s on line %d
+array(0) {
+}
--- /dev/null
+--TEST--
+Closure 024: Trying to clone the Closure object
+--FILE--
+<?php
+
+$a = function () {
+ return clone function () {
+ return 1;
+ };
+};
+
+$a();
+
+?>
+--EXPECTF--
+Fatal error: Trying to clone an uncloneable object of class Closure in %s on line %d
--- /dev/null
+--TEST--
+Closure 025: Using closure in create_function()
+--FILE--
+<?php
+
+$a = create_function('$x', 'return function($y) use ($x) { return $x * $y; };');
+
+var_dump($a(2)->__invoke(4));
+
+?>
+--EXPECT--
+int(8)
--- /dev/null
+--TEST--
+Closure 026: Assigning a closure object to an array in $this
+--FILE--
+<?php
+
+class foo {
+ public function __construct() {
+ $a =& $this;
+
+ $a->a[] = function() {
+ return 1;
+ };
+
+ var_dump($this);
+
+ var_dump($this->a[0]());
+ }
+}
+
+$x = new foo;
+
+print "--------------\n";
+
+foreach ($x as $b => $c) {
+ var_dump($b, $c);
+ var_dump($c[0]());
+}
+
+?>
+--EXPECTF--
+object(foo)#%d (1) {
+ ["a"]=>
+ array(1) {
+ [0]=>
+ object(Closure)#%d (0) {
+ }
+ }
+}
+int(1)
+--------------
+string(1) "a"
+array(1) {
+ [0]=>
+ object(Closure)#%d (0) {
+ }
+}
+int(1)
--- /dev/null
+--TEST--
+Closure 027: Testing Closure type-hint
+--FILE--
+<?php
+
+function test(closure $a) {
+ var_dump($a());
+}
+
+
+test(function() { return new stdclass; });
+
+test(function() { });
+
+$a = function($x) use ($y) {};
+test($a);
+
+test(new stdclass);
+
+?>
+--EXPECTF--
+object(stdClass)#%d (0) {
+}
+NULL
+
+Notice: Undefined variable: y in %s on line %d
+
+Warning: Missing argument 1 for (), called in %s on line %d and defined in %s on line %d
+NULL
+
+Catchable fatal error: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s on line %d
--- /dev/null
+--TEST--
+Closure 028: Trying to use lambda directly in foreach
+--FILE--
+<?php
+
+foreach (function(){ return 1; } as $y) {
+ var_dump($y);
+}
+
+print "ok\n";
+
+?>
+--EXPECT--
+ok
--- /dev/null
+--TEST--
+Closure 029: Testing lambda with instanceof operator
+--FILE--
+<?php
+
+var_dump(function() { } instanceof closure);
+var_dump(function(&$x) { } instanceof closure);
+var_dump(@function(&$x) use ($y, $z) { } instanceof closure);
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
--- /dev/null
+--TEST--
+Closure 030: Using lambda with variable variables
+--FILE--
+<?php
+
+$b = function() { return func_get_args(); };
+$a = 'b';
+var_dump($$a(1));
+var_dump($$a->__invoke(2));
+
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(2)
+}
--- /dev/null
+--TEST--
+Using lambda with list()
+--FILE--
+<?php
+
+list($x, $y) = function() { };
+
+var_dump($x, $y);
+
+?>
+--EXPECT--
+NULL
+NULL
--- /dev/null
+--TEST--
+Cloning stdClass
+--FILE--
+<?php
+
+$x[] = clone new stdclass;
+$x[] = clone new stdclass;
+$x[] = clone new stdclass;
+
+$x[0]->a = 1;
+
+var_dump($x);
+
+?>
+--EXPECTF--
+array(3) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ int(1)
+ }
+ [1]=>
+ object(stdClass)#%d (0) {
+ }
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+}