Annotation of embedaddon/php/Zend/tests/bug54358.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #54358 (Closure, use and reference)
! 3: --FILE--
! 4: <?php
! 5: class asserter {
! 6: public function call($function) {
! 7: }
! 8: }
! 9:
! 10: $asserter = new asserter();
! 11:
! 12: $closure = function() use ($asserter, &$function) {
! 13: $asserter->call($function = 'md5');
! 14: };
! 15:
! 16: $closure();
! 17:
! 18: var_dump($function);
! 19:
! 20: $closure = function() use ($asserter, $function) {
! 21: $asserter->call($function);
! 22: };
! 23:
! 24: $closure();
! 25:
! 26: var_dump($function);
! 27:
! 28: $closure = function() use ($asserter, $function) {
! 29: $asserter->call($function);
! 30: };
! 31:
! 32: $closure();
! 33:
! 34: var_dump($function);
! 35: ?>
! 36: --EXPECT--
! 37: string(3) "md5"
! 38: string(3) "md5"
! 39: string(3) "md5"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>