1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/reflection/tests/bug79820.phpt
Nikita Popov 902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00

24 lines
451 B
PHP

--TEST--
Bug #79820: Use after free when type duplicated into ReflectionProperty gets resolved
--FILE--
<?php
#[AllowDynamicProperties]
class Test {
public stdClass $prop;
}
$rp = new ReflectionProperty(Test::class, 'prop');
$test = new Test;
$test->prop = new stdClass;
var_dump($rp->getType()->getName());
$test->dynProp = 42;
$rp = new ReflectionProperty($test, 'dynProp');
var_dump($rp->getType());
?>
--EXPECT--
string(8) "stdClass"
NULL