1--TEST--
2Test properties with array default values using class constants as keys and values.
3--FILE--
4<?php
5  class X
6  {
7      // Static and instance array using class constants
8      public static $sa_x = array(B::KEY => B::VALUE);
9      public $a_x = array(B::KEY => B::VALUE);
10  }
11
12  class B
13  {
14      const KEY = "key";
15      const VALUE = "value";
16
17      // Static and instance array using class constants with self
18      public static $sa_b = array(self::KEY => self::VALUE);
19      public $a_b = array(self::KEY => self::VALUE);
20  }
21
22  class C extends B
23  {
24      // Static and instance array using class constants with parent
25      public static $sa_c_parent = array(parent::KEY => parent::VALUE);
26      public $a_c_parent = array(parent::KEY => parent::VALUE);
27
28      // Static and instance array using class constants with self (constants should be inherited)
29      public static $sa_c_self = array(self::KEY => self::VALUE);
30      public $a_c_self = array(self::KEY => self::VALUE);
31
32      // Should also include inherited properties from B.
33  }
34
35  echo "\nStatic properties:\n";
36  var_dump(X::$sa_x, B::$sa_b, C::$sa_b, C::$sa_c_parent, C::$sa_c_self);
37
38  echo "\nInstance properties:\n";
39  $x = new x;
40  $b = new B;
41  $c = new C;
42  var_dump($x, $b, $c);
43?>
44--EXPECTF--
45Static properties:
46array(1) {
47  ["key"]=>
48  string(5) "value"
49}
50array(1) {
51  ["key"]=>
52  string(5) "value"
53}
54array(1) {
55  ["key"]=>
56  string(5) "value"
57}
58array(1) {
59  ["key"]=>
60  string(5) "value"
61}
62array(1) {
63  ["key"]=>
64  string(5) "value"
65}
66
67Instance properties:
68object(X)#%d (1) {
69  ["a_x"]=>
70  array(1) {
71    ["key"]=>
72    string(5) "value"
73  }
74}
75object(B)#%d (1) {
76  ["a_b"]=>
77  array(1) {
78    ["key"]=>
79    string(5) "value"
80  }
81}
82object(C)#%d (3) {
83  ["a_b"]=>
84  array(1) {
85    ["key"]=>
86    string(5) "value"
87  }
88  ["a_c_parent"]=>
89  array(1) {
90    ["key"]=>
91    string(5) "value"
92  }
93  ["a_c_self"]=>
94  array(1) {
95    ["key"]=>
96    string(5) "value"
97  }
98}
99