Annotation of embedaddon/php/Zend/tests/closure_026.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Closure 026: Assigning a closure object to an array in $this
3: --FILE--
4: <?php
5:
6: class foo {
7: public function __construct() {
8: $a =& $this;
9:
10: $a->a[] = function() {
11: return 1;
12: };
13:
14: var_dump($this);
15:
16: var_dump($this->a[0]());
17: }
18: }
19:
20: $x = new foo;
21:
22: print "--------------\n";
23:
24: foreach ($x as $b => $c) {
25: var_dump($b, $c);
26: var_dump($c[0]());
27: }
28:
29: ?>
30: --EXPECTF--
31: object(foo)#%d (1) {
32: ["a"]=>
33: array(1) {
34: [0]=>
1.1.1.2 ! misho 35: object(Closure)#%d (1) {
! 36: ["this"]=>
! 37: *RECURSION*
1.1 misho 38: }
39: }
40: }
41: int(1)
42: --------------
43: string(1) "a"
44: array(1) {
45: [0]=>
1.1.1.2 ! misho 46: object(Closure)#%d (1) {
! 47: ["this"]=>
! 48: object(foo)#%d (1) {
! 49: ["a"]=>
! 50: *RECURSION*
! 51: }
1.1 misho 52: }
53: }
54: int(1)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>