1--TEST-- 2Bug #51822 (Segfault with strange __destruct() for static class variables) 3--FILE-- 4<?php 5class DestructableObject 6{ 7 public function __destruct() 8 { 9 echo "2\n"; 10 } 11} 12 13class DestructorCreator 14{ 15 public $test; 16 public function __destruct() 17 { 18 $this->test = new DestructableObject; 19 echo "1\n"; 20 } 21} 22 23class Test 24{ 25 public static $mystatic; 26} 27 28// Uncomment this to avoid segfault 29//Test::$mystatic = new DestructorCreator(); 30 31$x = new Test(); 32 33if (!isset(Test::$mystatic)) 34 Test::$mystatic = new DestructorCreator(); 35 36echo "bla\n"; 37?> 38--EXPECT-- 39bla 401 412 42