Return to constants_basic_006.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes |
1.1 ! misho 1: --TEST-- ! 2: Ensure class constants are not evaluated when a class is looked up to resolve inheritance during runtime. ! 3: --FILE-- ! 4: <?php ! 5: class C ! 6: { ! 7: const X = E::A; ! 8: public static $a = array(K => D::V, E::A => K); ! 9: } ! 10: ! 11: eval('class D extends C { const V = \'test\'; }'); ! 12: ! 13: class E extends D ! 14: { ! 15: const A = "hello"; ! 16: } ! 17: ! 18: define('K', "nasty"); ! 19: ! 20: var_dump(C::X, C::$a, D::X, D::$a, E::X, E::$a); ! 21: ?> ! 22: --EXPECTF-- ! 23: string(5) "hello" ! 24: array(2) { ! 25: ["nasty"]=> ! 26: string(4) "test" ! 27: ["hello"]=> ! 28: string(5) "nasty" ! 29: } ! 30: string(5) "hello" ! 31: array(2) { ! 32: ["nasty"]=> ! 33: string(4) "test" ! 34: ["hello"]=> ! 35: string(5) "nasty" ! 36: } ! 37: string(5) "hello" ! 38: array(2) { ! 39: ["nasty"]=> ! 40: string(4) "test" ! 41: ["hello"]=> ! 42: string(5) "nasty" ! 43: }