mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
902d64390e
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
41 lines
614 B
PHP
41 lines
614 B
PHP
--TEST--
|
|
ReflectionObject::__toString() : very basic test with dynamic properties
|
|
--FILE--
|
|
<?php
|
|
|
|
#[AllowDynamicProperties]
|
|
class Foo {
|
|
public $bar = 1;
|
|
}
|
|
$f = new foo;
|
|
$f->dynProp = 'hello';
|
|
$f->dynProp2 = 'hello again';
|
|
echo new ReflectionObject($f);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Object of class [ <user> class Foo ] {
|
|
@@ %s
|
|
|
|
- Constants [0] {
|
|
}
|
|
|
|
- Static properties [0] {
|
|
}
|
|
|
|
- Static methods [0] {
|
|
}
|
|
|
|
- Properties [1] {
|
|
Property [ public $bar = 1 ]
|
|
}
|
|
|
|
- Dynamic properties [2] {
|
|
Property [ <dynamic> public $dynProp ]
|
|
Property [ <dynamic> public $dynProp2 ]
|
|
}
|
|
|
|
- Methods [0] {
|
|
}
|
|
}
|