summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/bug74345.phpt
blob: cc5520676089aeb48f4bca45413285ed01b393ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
Bug #74345: Call trampoline leaked if callback not invoked
--FILE--
<?php

class Test {
    public function __call($name, $args) {
        echo "__call()\n";
    }
}

$name = "foo" . ($x = "bar");
$cb = [new Test, $name];
array_map($cb, []);
array_map($cb, [], []);
try {
    array_map($cb, null);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    array_map($cb, null, null);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
array_filter([], $cb);
array_reduce([], $cb);

$array = [];
array_walk($array, $cb);
array_walk_recursive($array, $cb);
usort($array, $cb);

try {
    preg_replace_callback('/./', $cb, new stdClass);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
===DONE===
--EXPECT--
array_map(): Argument #2 ($array1) must be of type array, null given
array_map(): Argument #2 ($array1) must be of type array, null given
preg_replace_callback(): Argument #3 ($subject) must be of type array|string, stdClass given
===DONE===