View Issue Details

IDProjectCategoryView StatusLast Update
0000580XdebugUncategorizedpublic2014-02-27 19:01
ReporterDaan Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionunable to reproduce 
Product Version2.0.0dev 
Summary0000580: Segfault with nested __destruct() calls
Description

Actual version used: Xdebug v2.0.5, PHP 5.2.13

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.

See also: http://bugs.php.net/bug.php?id=51822

Additional Information

<?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';

TagsNo tags attached.
Operating SystemDebian Etch
PHP Version5.2.10

Activities

Daan

2010-06-10 13:05

reporter   ~0001491

Bug was a PHP bug, solved in PHP codebase (see http://bugs.php.net/bug.php?id=51822)

derick

2010-06-12 13:15

administrator   ~0001492

There is still a bug here in Xdebug as well:

5.2.13-dev with Xdebug-SVN:

bla==5566== Invalid read of size 8
==5566== at 0xC6DEB08: xdebug_execute (xdebug.c:1099)
==5566== by 0x8828BC: zend_call_function (zend_execute_API.c:1049)
==5566== by 0x8AB10B: zend_call_method (zend_interfaces.c:88)
==5566== by 0x8B3B33: zend_objects_destroy_object (zend_objects.c:101)
==5566== by 0x8B826B: zend_objects_store_del_ref_by_handle (zend_objects_API.c:198)
==5566== by 0x8B8131: zend_objects_store_del_ref (zend_objects_API.c:169)
==5566== by 0x88EBF4: _zval_dtor_func (zend_variables.c:51)
==5566== by 0x87F1AE: _zval_dtor (zend_variables.h:35)
==5566== by 0x88007E: _zval_ptr_dtor (zend_execute_API.c:414)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== by 0x89E473: zend_hash_destroy (zend_hash.c:526)
==5566== by 0x8B38B0: zend_object_std_dtor (zend_objects.c:45)
==5566== Address 0xbb24110 is 0 bytes inside a block of size 24 free'd
==5566== at 0x4C21DBC: free (vg_replace_malloc.c:325)
==5566== by 0x8708AD: _efree (zend_alloc.c:2308)
==5566== by 0x87F424: safe_free_zval_ptr_rel (zend_execute.h:70)
==5566== by 0x8800A2: _zval_ptr_dtor (zend_execute_API.c:415)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== by 0x89E848: zend_hash_apply_deleter (zend_hash.c:611)
==5566== by 0x89E9CE: zend_hash_graceful_reverse_destroy (zend_hash.c:646)
==5566== by 0x87FB24: shutdown_executor (zend_execute_API.c:239)
==5566== by 0x890665: zend_deactivate (zend.c:860)
==5566== by 0x836EB6: php_request_shutdown (main.c:1504)
==5566== by 0x91B34E: main (php_cli.c:1346)
==5566==
==5566== Invalid read of size 4
==5566== at 0x89CA06: _zend_is_inconsistent (zend_hash.c:53)
==5566== by 0x89F3EF: zend_hash_find (zend_hash.c:875)
==5566== by 0xC6DEB21: xdebug_execute (xdebug.c:1099)
==5566== by 0x8828BC: zend_call_function (zend_execute_API.c:1049)
==5566== by 0x8AB10B: zend_call_method (zend_interfaces.c:88)
==5566== by 0x8B3B33: zend_objects_destroy_object (zend_objects.c:101)
==5566== by 0x8B826B: zend_objects_store_del_ref_by_handle (zend_objects_API.c:198)
==5566== by 0x8B8131: zend_objects_store_del_ref (zend_objects_API.c:169)
==5566== by 0x88EBF4: _zval_dtor_func (zend_variables.c:51)
==5566== by 0x87F1AE: _zval_dtor (zend_variables.h:35)
==5566== by 0x88007E: _zval_ptr_dtor (zend_execute_API.c:414)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== Address 0xbb241b4 is 68 bytes inside a block of size 72 free'd
==5566== at 0x4C21DBC: free (vg_replace_malloc.c:325)
==5566== by 0x8708AD: _efree (zend_alloc.c:2308)
==5566== by 0x88EBDD: _zval_dtor_func (zend_variables.c:43)
==5566== by 0x87F1AE: _zval_dtor (zend_variables.h:35)
==5566== by 0x88007E: _zval_ptr_dtor (zend_execute_API.c:414)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== by 0x89E848: zend_hash_apply_deleter (zend_hash.c:611)
==5566== by 0x89E9CE: zend_hash_graceful_reverse_destroy (zend_hash.c:646)
==5566== by 0x87FB24: shutdown_executor (zend_execute_API.c:239)
==5566== by 0x890665: zend_deactivate (zend.c:860)
==5566== by 0x836EB6: php_request_shutdown (main.c:1504)
==5566== by 0x91B34E: main (php_cli.c:1346)
==5566==
==5566== Invalid read of size 4
==5566== at 0x89CA15: _zend_is_inconsistent (zend_hash.c:56)
==5566== by 0x89F3EF: zend_hash_find (zend_hash.c:875)
==5566== by 0xC6DEB21: xdebug_execute (xdebug.c:1099)
==5566== by 0x8828BC: zend_call_function (zend_execute_API.c:1049)
==5566== by 0x8AB10B: zend_call_method (zend_interfaces.c:88)
==5566== by 0x8B3B33: zend_objects_destroy_object (zend_objects.c:101)
==5566== by 0x8B826B: zend_objects_store_del_ref_by_handle (zend_objects_API.c:198)
==5566== by 0x8B8131: zend_objects_store_del_ref (zend_objects_API.c:169)
==5566== by 0x88EBF4: _zval_dtor_func (zend_variables.c:51)
==5566== by 0x87F1AE: _zval_dtor (zend_variables.h:35)
==5566== by 0x88007E: _zval_ptr_dtor (zend_execute_API.c:414)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== Address 0xbb241b4 is 68 bytes inside a block of size 72 free'd
==5566== at 0x4C21DBC: free (vg_replace_malloc.c:325)
==5566== by 0x8708AD: _efree (zend_alloc.c:2308)
==5566== by 0x88EBDD: _zval_dtor_func (zend_variables.c:43)
==5566== by 0x87F1AE: _zval_dtor (zend_variables.h:35)
==5566== by 0x88007E: _zval_ptr_dtor (zend_execute_API.c:414)
==5566== by 0x88EF44: _zval_ptr_dtor_wrapper (zend_variables.c:174)
==5566== by 0x89E848: zend_hash_apply_deleter (zend_hash.c:611)
==5566== by 0x89E9CE: zend_hash_graceful_reverse_destroy (zend_hash.c:646)
==5566== by 0x87FB24: shutdown_executor (zend_execute_API.c:239)
==5566== by 0x890665: zend_deactivate (zend.c:860)
==5566== by 0x836EB6: php_request_shutdown (main.c:1504)
==5566== by 0x91B34E: main (php_cli.c:1346)
==5566==

derick

2014-02-27 19:01

administrator   ~0002677

Can no longer reproduce, at least not with 5.2.18 and Xdebug 2.2.3.

Issue History

Date Modified Username Field Change
2010-05-14 13:19 Daan New Issue
2010-05-14 13:19 Daan Operating System => Debian Etch
2010-05-14 13:19 Daan PHP Version => 5.2.10
2010-05-14 13:19 Daan Xdebug Version => 2.0.5
2010-06-10 13:05 Daan Note Added: 0001491
2010-06-12 13:15 derick Note Added: 0001492
2014-02-27 19:01 derick Note Added: 0002677
2014-02-27 19:01 derick Status new => resolved
2014-02-27 19:01 derick Resolution open => unable to reproduce
2014-02-27 19:01 derick Assigned To => derick
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized