File size: 641 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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--
new self / new parent in constant expression
--FILE--
<?php

class A {
    public static function invalid($x = new parent) {
    }
}
class B extends A {
    public static function method($x = new self, $y = new parent) {
        var_dump($x, $y);
    }
}

function invalid($x = new self) {}

B::method();

try {
    invalid();
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

try {
    B::invalid();
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
object(B)#1 (0) {
}
object(A)#2 (0) {
}
Cannot access "self" when no class scope is active
Cannot access "parent" when current class scope has no parent