summaryrefslogtreecommitdiff
path: root/tests/classes/constants_basic_006.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/classes/constants_basic_006.phpt')
-rw-r--r--tests/classes/constants_basic_006.phpt65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/classes/constants_basic_006.phpt b/tests/classes/constants_basic_006.phpt
new file mode 100644
index 0000000000..dcdb01bfe4
--- /dev/null
+++ b/tests/classes/constants_basic_006.phpt
@@ -0,0 +1,65 @@
+--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);
+?>
+--EXPECTF--
+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"
+}
+--UEXPECTF--
+unicode(5) "hello"
+array(2) {
+ [u"nasty"]=>
+ unicode(4) "test"
+ [u"hello"]=>
+ unicode(5) "nasty"
+}
+unicode(5) "hello"
+array(2) {
+ [u"nasty"]=>
+ unicode(4) "test"
+ [u"hello"]=>
+ unicode(5) "nasty"
+}
+unicode(5) "hello"
+array(2) {
+ [u"nasty"]=>
+ unicode(4) "test"
+ [u"hello"]=>
+ unicode(5) "nasty"
+} \ No newline at end of file