summaryrefslogtreecommitdiff
path: root/tests/classes/constants_basic_006.phpt
blob: 904593ea9b3e5abc443141787879ff264f64fa35 (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
--TEST--
Ensure class constants are not evaluated when a class is looked up to resolve inheritance during runtime.
--FILE--
<?php
  class C
  {
      const X = E::A;
      public static $a = array(K => D::V, E::A => K);
  }
  
  eval('class D extends C { const V = \'test\'; }');
  
  class E extends D
  {
      const A = "hello";
  }
  
  define('K', "nasty");
  
  var_dump(C::X, C::$a, D::X, D::$a, E::X, E::$a);
?>
--EXPECT--
string(5) "hello"
array(2) {
  ["nasty"]=>
  string(4) "test"
  ["hello"]=>
  string(5) "nasty"
}
string(5) "hello"
array(2) {
  ["nasty"]=>
  string(4) "test"
  ["hello"]=>
  string(5) "nasty"
}
string(5) "hello"
array(2) {
  ["nasty"]=>
  string(4) "test"
  ["hello"]=>
  string(5) "nasty"
}