summaryrefslogtreecommitdiff
path: root/Zend/tests/dynamic_call_non_static.phpt
blob: f73d29a131d6aac6c9158041f83eddd5e69ce29f (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
--TEST--
Dynamic static call of non-static method
--FILE--
<?php
class Foo {
    function test1() {
        $method = ['Foo', 'bar'];
        $method();
    }
    function test2() {
        $method = 'Foo::bar';
        $method();
    }
    function __call($name, $args) {}
}
$x = new Foo;
try {
    $x->test1();
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    $x->test2();
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Non-static method Foo::bar() cannot be called statically
Non-static method Foo::bar() cannot be called statically