diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /Zend/tests/closure_040.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'Zend/tests/closure_040.phpt')
-rw-r--r-- | Zend/tests/closure_040.phpt | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Zend/tests/closure_040.phpt b/Zend/tests/closure_040.phpt new file mode 100644 index 0000000..a1b6cd6 --- /dev/null +++ b/Zend/tests/closure_040.phpt @@ -0,0 +1,45 @@ +--TEST-- +Closure 040: Rebinding closures, bad arguments +--FILE-- +<?php + +class A { + private $x; + private static $xs = 10; + + public function __construct($v) { + $this->x = $v; + } + + public function getIncrementor() { + return function() { return ++$this->x; }; + } + public function getStaticIncrementor() { + return static function() { return ++static::$xs; }; + } +} + +$a = new A(20); + +$ca = $a->getIncrementor(); +$cas = $a->getStaticIncrementor(); + +$ca->bindTo($a, array()); +$ca->bindTo(array(), 'A'); +$ca->bindTo($a, array(), ""); +$ca->bindTo(); +$cas->bindTo($a, 'A'); + +?> +--EXPECTF-- +Notice: Array to string conversion in %s on line %d + +Warning: Class 'Array' not found in %s on line %d + +Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25 + +Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d + +Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d + +Warning: Cannot bind an instance to a static closure in %s on line %d |