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