From: Operating system: Debian Etch PHP version: 5.2.13 Package: Scripting Engine problem Bug Type: Bug Bug description:Segfault with strange __destruct() for static class variables
Description: ------------ When a static class variable is assigned a nested destructable object, it behaves differently when assigned before or after the instantiation an object of the class to which the static property belongs. When the variable is assigned after object instantiation, the process segfaults. (tested: PHP 5.3.1 behaves correctly) Test script: --------------- <?php class DestructableObject { public function __destruct() { } } class DestructorCreator { public function __destruct() { $this->test = new DestructableObject; } } 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'; Expected result: ---------------- bla Actual result: -------------- Segfault -- Edit bug report at http://bugs.php.net/bug.php?id=51822&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51822&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51822&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51822&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51822&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51822&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51822&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51822&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51822&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51822&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51822&r=support Expected behavior: http://bugs.php.net/fix.php?id=51822&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51822&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51822&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51822&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51822&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51822&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51822&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51822&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51822&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51822&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51822&r=mysqlcfg