Annotation of embedaddon/php/Zend/tests/closure_042.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Closure 042: Binding an instance to a non-scoped non-static closures gives it a dummy scope
! 3: --SKIPIF--
! 4: <?php if(!extension_loaded("reflection")) print "skip no reflection"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $c = function() { var_dump($this); };
! 9: $d = $c->bindTo(new stdClass);
! 10: $d();
! 11: $rm = new ReflectionFunction($d);
! 12: var_dump($rm->getClosureScopeClass()->name); //dummy sope is Closure
! 13:
! 14: //should have the same effect
! 15: $d = $c->bindTo(new stdClass, NULL);
! 16: $d();
! 17: $rm = new ReflectionFunction($d);
! 18: var_dump($rm->getClosureScopeClass()->name); //dummy sope is Closure
! 19:
! 20: echo "Done.\n";
! 21:
! 22: --EXPECTF--
! 23: object(stdClass)#%d (0) {
! 24: }
! 25: string(7) "Closure"
! 26: object(stdClass)#%d (0) {
! 27: }
! 28: string(7) "Closure"
! 29: Done.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>