mirror of
https://github.com/php/php-src.git
synced 2024-12-28 11:20:29 +08:00
44 lines
726 B
PHP
44 lines
726 B
PHP
--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"
|
|
}
|