1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 14:12:38 +02:00
Files
archived-php-src/ext/reflection/tests/bug80370.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

19 lines
375 B
PHP

--TEST--
Bug #80370: Segfault on ReflectionProperty::getAttributes of dynamic property
--FILE--
<?php
#[AllowDynamicProperties]
class Foobar {
}
$foobar = new Foobar();
$foobar->bar = 42;
$reflectionObject = new ReflectionObject($foobar);
$reflectionProperty = $reflectionObject->getProperty('bar');
var_dump($reflectionProperty->getAttributes());
--EXPECT--
array(0) {
}