php-src/Zend/tests/class_constant_to_reference_cached.phpt
Nikita Popov 47e85b1b35 Improve class constant fetch fix
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.)
2014-05-29 11:17:33 +02:00

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"