File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug46409.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #46409 (__invoke method called outside of object context when using array_map)
    3: --FILE--
    4: <?php
    5: class Callback {
    6:     protected $val = 'hello, world';
    7:     
    8:     public function __invoke() {
    9:         return $this->val;
   10:     }
   11: }
   12: 
   13: $cb = new Callback();
   14: echo $cb(),"\n";
   15: $a = array(1, 2);
   16: $b = array_map($cb, $a);
   17: print_r($b);
   18: ?>
   19: --EXPECT--
   20: hello, world
   21: Array
   22: (
   23:     [0] => hello, world
   24:     [1] => hello, world
   25: )

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>