summaryrefslogtreecommitdiff
path: root/Zend/tests/bug69676_3.phpt
blob: 89f0090884ad9b37cb771142134300e6a4fd58e9 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--TEST--
Bug #69676: Resolution of self::FOO in class constants not correct (variation)
--FILE--
<?php

class P {
    const N = 'P';
}
class A extends P {
    const selfN = self::N;
    const parentN = parent::N;
    const N = 'A';
}
class B extends A {
    const N = 'B';
}

var_dump(B::selfN); // A
var_dump(B::parentN); // P

class A2 {
    const selfN = self::N;
    const N = 'A2';
}
class B2 extends A2 {
    const indSelfN = self::selfN;
    const N = 'B2';
}
class C2 extends B2 {
    const N = 'C2';
}

var_dump(C2::indSelfN); // A2

class A3 {
    const selfN = self::N;
    const N = 'A3';
}
class B3 extends A3 {
    const exprSelfN = "expr" . self::selfN;
    const N = 'B3';
}
class C3 extends B3 {
    const N = 'C3';
}

var_dump(C3::exprSelfN); // exprA3

class A4 {
    const selfN = self::N;
    const N = 'A4';
}
class B4 extends A4 {
    const N = 'B4';
    public $prop = self::selfN;
}
class C4 extends B4 {
    const N = 'C4';
}

var_dump((new C4)->prop); // A4

?>
--EXPECT--
string(1) "A"
string(1) "P"
string(2) "A2"
string(6) "exprA3"
string(2) "A4"