Edit report at http://bugs.php.net/bug.php?id=51822&edit=1
ID: 51822 Updated by: fel...@php.net Reported by: daan at react dot com Summary: Segfault with strange __destruct() for static class variables -Status: Feedback +Status: Verified Type: Bug Package: Scripting Engine problem Operating System: Debian Etch PHP Version: 5.2.13 New Comment: In fact I got something on Valgring log: Invalid write & read and: ==5285== Address 0x65f0ba4 is 4 bytes inside a block of size 256 free'd ==5285== at 0x4024866: free (vg_replace_malloc.c:325) ==5285== by 0x83ACBD6: _efree (zend_alloc.c:2308) ==5285== by 0x83CD787: zend_ptr_stack_destroy (zend_ptr_stack.c:74) ==5285== by 0x83BE48B: shutdown_executor (zend_execute_API.c:283) ==5285== by 0x83D05D9: zend_deactivate (zend.c:860) ==5285== by 0x836D12B: php_request_shutdown (main.c:1504) ==5285== by 0x8459950: main (php_cli.c:1346) Previous Comments: ------------------------------------------------------------------------ [2010-05-14 14:58:06] fel...@php.net Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ I cannot reproduce it on 5_2 SVN. ------------------------------------------------------------------------ [2010-05-14 14:38:49] daan at react dot com 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 this bug report at http://bugs.php.net/bug.php?id=51822&edit=1