summaryrefslogtreecommitdiff
path: root/Zend/tests/exception_017.phpt
blob: f2f5f964ce8f0cad23c0622a00bb9367f791bd97 (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
--TEST--
Exceptions on improper usage of $this
--FILE--
<?php
abstract class C {
    abstract static function foo();
}

function foo(callable $x) {
}

try {
    C::foo();
} catch (Error $e) {
    echo $e, "\n\n";
}

try {
    foo("C::foo");
} catch (Error $e) {
    echo $e, "\n\n";
}

C::foo();
?>
--EXPECTF--
Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}

TypeError: foo(): Argument #1 ($x) must be of type callable, string given, called in %s:%d
Stack trace:
#0 %s(%d): foo('C::foo')
#1 {main}


Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d