mirror of
https://github.com/php/php-src.git
synced 2026-04-03 14:12:38 +02:00
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
19 lines
375 B
PHP
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) {
|
|
}
|