Annotation of embedaddon/php/Zend/tests/closure_020.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Closure 020: Trying to access private property outside class
3: --FILE--
4: <?php
5:
6: class foo {
7: private $test = 3;
8:
9: public function x() {
10: $a = &$this;
11: $this->a = function() use (&$a) { return $a; };
12: var_dump($this->a->__invoke());
13: var_dump(is_a($this->a, 'closure'));
14: var_dump(is_callable($this->a));
15:
16: return $this->a;
17: }
18: }
19:
20: $foo = new foo;
21: $y = $foo->x();
22: var_dump($y()->test);
23:
24: ?>
25: --EXPECTF--
26: object(foo)#%d (%d) {
27: ["test":"foo":private]=>
28: int(3)
29: ["a"]=>
30: object(Closure)#%d (1) {
31: ["static"]=>
32: array(1) {
33: ["a"]=>
34: *RECURSION*
35: }
36: }
37: }
38: bool(true)
39: bool(true)
40:
41: Fatal error: Cannot access private property foo::$test in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>