php-src/Zend/tests/update_consts_shadowed_private_prop.phpt
Nikita Popov 58699ffcf1 Fix constant update for shadowed private property
Updating based on the properties info HT will miss private parent
properties that have been shadowed in the child class. Instead,
perform updating directly on the default properties table.

We can't do the same for static properties, because those don't
have a convenient way to look up the property type from the
property offset. However, I don't believe the problem exists for
static properties, because we're always going to be using the
property on the class it was declared on, while children only hold
INDIRECT references. As such, this should be covered by parent
class const updating.

Fixes oss-fuzz #35906.
2021-07-08 10:12:40 +02:00

23 lines
285 B
PHP

--TEST--
Constant updating for shadowed private property
--FILE--
<?php
class Foo {
private $prop = X;
function test() {
var_dump($this->prop);
}
}
class Bar extends Foo {
protected $prop;
}
define('X', 1);
$bar = new Bar;
$bar->test();
?>
--EXPECT--
int(1)