mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +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
42 lines
610 B
PHP
42 lines
610 B
PHP
--TEST--
|
|
Bug #51822 (Segfault with strange __destruct() for static class variables)
|
|
--FILE--
|
|
<?php
|
|
class DestructableObject
|
|
{
|
|
public function __destruct()
|
|
{
|
|
echo "2\n";
|
|
}
|
|
}
|
|
|
|
class DestructorCreator
|
|
{
|
|
public $test;
|
|
public function __destruct()
|
|
{
|
|
$this->test = new DestructableObject;
|
|
echo "1\n";
|
|
}
|
|
}
|
|
|
|
class Test
|
|
{
|
|
public static $mystatic;
|
|
}
|
|
|
|
// Uncomment this to avoid segfault
|
|
//Test::$mystatic = new DestructorCreator();
|
|
|
|
$x = new Test();
|
|
|
|
if (!isset(Test::$mystatic))
|
|
Test::$mystatic = new DestructorCreator();
|
|
|
|
echo "bla\n";
|
|
?>
|
|
--EXPECT--
|
|
bla
|
|
1
|
|
2
|