1--TEST--
2Indirect method call by array - Testing exception and method magics
3--FILE--
4<?php
5
6class foo {
7    static public function abc() {
8        throw new Exception('foo');
9    }
10    public function __call($a, $b) {
11        printf("From %s:\n", __METHOD__);
12        throw new Exception($a);
13    }
14    static public function __callStatic($a, $b) {
15        printf("From %s:\n", __METHOD__);
16        throw new Exception($a);
17    }
18}
19
20
21$arr = array('foo', 'abc');
22
23try {
24    $arr();
25}
26catch (Exception $e) {
27    echo $e->getMessage(), "\n";
28}
29
30$arr = array('foo', '123');
31
32try {
33    $arr();
34}
35catch (Exception $e) {
36    echo $e->getMessage(), "\n";
37}
38
39
40echo "------\n";
41
42$foo = new foo;
43$arr = array($foo, 'abc');
44
45try {
46    $arr();
47}
48catch (Exception $e) {
49    echo $e->getMessage(), "\n";
50}
51
52
53$foo = new foo;
54$arr = array($foo, '123');
55
56try {
57    $arr();
58}
59catch (Exception $e) {
60    echo $e->getMessage(), "\n";
61}
62
63?>
64--EXPECT--
65foo
66From foo::__callStatic:
67123
68------
69foo
70From foo::__call:
71123
72