mirror of
https://github.com/php/php-src.git
synced 2024-12-17 13:59:28 +08:00
47e85b1b35
Dereference the cached constant for Test::TEST as well (and not just self::TEST). Also improve the phpt file to test this case as well - previously this only manifested with opcache enabled, due to literal sharing. Additionally the Z_TYPE_P != IS_REFERENCE assertion is now moved into the TMP_VAR fetching code (as it applies to more than just property assignments.)
31 lines
448 B
PHP
31 lines
448 B
PHP
--TEST--
|
|
Conversion of a class constant to a reference after it has been cached
|
|
--FILE--
|
|
<?php
|
|
|
|
class Test {
|
|
const TEST = 'TEST';
|
|
|
|
private $prop;
|
|
|
|
public function readConst() {
|
|
$this->prop = self::TEST;
|
|
}
|
|
}
|
|
|
|
function doTest() {
|
|
$obj = new Test;
|
|
$obj->readConst();
|
|
unset($obj);
|
|
var_dump(Test::TEST);
|
|
}
|
|
|
|
doTest();
|
|
eval('class Test2 extends Test {}');
|
|
doTest();
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(4) "TEST"
|
|
string(4) "TEST"
|