Annotation of embedaddon/php/Zend/tests/closure_040.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Closure 040: Rebinding closures, bad arguments
! 3: --FILE--
! 4: <?php
! 5:
! 6: class A {
! 7: private $x;
! 8: private static $xs = 10;
! 9:
! 10: public function __construct($v) {
! 11: $this->x = $v;
! 12: }
! 13:
! 14: public function getIncrementor() {
! 15: return function() { return ++$this->x; };
! 16: }
! 17: public function getStaticIncrementor() {
! 18: return static function() { return ++static::$xs; };
! 19: }
! 20: }
! 21:
! 22: $a = new A(20);
! 23:
! 24: $ca = $a->getIncrementor();
! 25: $cas = $a->getStaticIncrementor();
! 26:
! 27: $ca->bindTo($a, array());
! 28: $ca->bindTo(array(), 'A');
! 29: $ca->bindTo($a, array(), "");
! 30: $ca->bindTo();
! 31: $cas->bindTo($a, 'A');
! 32:
! 33: ?>
! 34: --EXPECTF--
! 35: Notice: Array to string conversion in %s on line %d
! 36:
! 37: Warning: Class 'Array' not found in %s on line %d
! 38:
! 39: Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25
! 40:
! 41: Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d
! 42:
! 43: Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d
! 44:
! 45: Warning: Cannot bind an instance to a static closure in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>