PHP  
 PHP_5_5
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for Zend/tests/bug64896.phpt ('Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)')

Script

1: <?php
2: $bar 
NULL;
3: class 
bad
4:
{
5:     private 
$_private = array();
6:
7:     public function 
__construct()
8:     {
9:         
$this->_private[] = 'php';
10:     }
11:
12:     public function 
__destruct()
13:     {
14:         global 
$bar;
15:         
$bar $this;
16:     }
17: }
18:
19:
$foo = new stdclass;
20:
$foo->foo $foo;
21:
$foo->bad = new bad;
22:
23:
gc_disable();
24:
25:
unserialize(serialize($foo));
26:
gc_collect_cycles();
27:
var_dump($bar); 
28:
/*  will output:
29: object(bad)#4 (1) {
30:   ["_private":"bad":private]=>
31:   &UNKNOWN:0
32: }
33: */
34:
?>
35:

Report

==25317== Invalid read of size 1
==25317==    at 0xC419B9: php_var_dump (var.c:99)
==25317==    by 0xC41929: php_object_property_dump (var.c:82)
==25317==    by 0xE6B566: zend_hash_apply_with_arguments (zend_hash.c:772)
==25317==    by 0xC422A6: php_var_dump (var.c:146)
==25317==    by 0xC425B8: zif_var_dump (var.c:183)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==  Address 0x153acaf4 is 20 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 1
==25317==    at 0xC41AAC: zval_isref_p (zend.h:413)
==25317==    by 0xC41AAC: php_var_dump (var.c:104)
==25317==    by 0xC41929: php_object_property_dump (var.c:82)
==25317==    by 0xE6B566: zend_hash_apply_with_arguments (zend_hash.c:772)
==25317==    by 0xC422A6: php_var_dump (var.c:146)
==25317==    by 0xC425B8: zif_var_dump (var.c:183)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==  Address 0x153acaf5 is 21 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 4
==25317==    at 0xE2CEF4: zval_delref_p (zend.h:409)
==25317==    by 0xE2CEF4: i_zval_ptr_dtor (zend_execute.h:76)
==25317==    by 0xE2CEF4: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf0 is 16 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid write of size 4
==25317==    at 0xE2CEFE: zval_delref_p (zend.h:409)
==25317==    by 0xE2CEFE: i_zval_ptr_dtor (zend_execute.h:76)
==25317==    by 0xE2CEFE: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf0 is 16 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 4
==25317==    at 0xE2CF05: zval_delref_p (zend.h:409)
==25317==    by 0xE2CF05: i_zval_ptr_dtor (zend_execute.h:76)
==25317==    by 0xE2CF05: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf0 is 16 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 4
==25317==    at 0xE2CFEA: zval_refcount_p (zend.h:397)
==25317==    by 0xE2CFEA: i_zval_ptr_dtor (zend_execute.h:86)
==25317==    by 0xE2CFEA: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf0 is 16 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid write of size 1
==25317==    at 0xE2CFFE: zval_unset_isref_p (zend.h:421)
==25317==    by 0xE2CFFE: i_zval_ptr_dtor (zend_execute.h:87)
==25317==    by 0xE2CFFE: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf5 is 21 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 1
==25317==    at 0xE2D020: gc_zval_check_possible_root (zend_gc.h:182)
==25317==    by 0xE2D020: i_zval_ptr_dtor (zend_execute.h:90)
==25317==    by 0xE2D020: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf4 is 20 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 
==25317== Invalid read of size 1
==25317==    at 0xE2D03E: gc_zval_check_possible_root (zend_gc.h:182)
==25317==    by 0xE2D03E: i_zval_ptr_dtor (zend_execute.h:90)
==25317==    by 0xE2D03E: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6A84D: zend_hash_destroy (zend_hash.c:560)
==25317==    by 0xE97DC8: zend_object_std_dtor (zend_objects.c:44)
==25317==    by 0xE9852C: zend_objects_free_object_storage (zend_objects.c:137)
==25317==    by 0xEA7B76: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==25317==    by 0xEA7710: zend_objects_store_del_ref (zend_objects_API.c:178)
==25317==    by 0xE4AFDD: _zval_dtor_func (zend_variables.c:54)
==25317==    by 0xE2CF96: _zval_dtor (zend_variables.h:35)
==25317==    by 0xE2CF96: i_zval_ptr_dtor (zend_execute.h:81)
==25317==    by 0xE2CF96: _zval_ptr_dtor (zend_execute_API.c:423)
==25317==    by 0xE6ADAE: zend_hash_apply_deleter (zend_hash.c:650)
==25317==    by 0xE6B79C: zend_hash_reverse_apply (zend_hash.c:804)
==25317==    by 0xE2C08D: shutdown_destructors (zend_execute_API.c:214)
==25317==    by 0xE4E8B8: zend_call_destructors (zend.c:930)
==25317==  Address 0x153acaf4 is 20 bytes inside a block of size 32 free'd
==25317==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==25317==    by 0xDFB8CC: _efree (zend_alloc.c:2437)
==25317==    by 0xE91E3E: gc_collect_cycles (zend_gc.c:851)
==25317==    by 0xE708E9: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==25317==    by 0xEB5831: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==25317==    by 0xEBF900: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2332)
==25317==    by 0xEB3480: execute_ex (zend_vm_execute.h:363)
==25317==    by 0xEB4012: zend_execute (zend_vm_execute.h:388)
==25317==    by 0xE505E4: zend_execute_scripts (zend.c:1327)
==25317==    by 0xD73590: php_execute_script (main.c:2506)
==25317==    by 0x1034BFD: do_cli (php_cli.c:994)
==25317==    by 0x10363AA: main (php_cli.c:1378)
==25317== 

 

Generated at Thu, 22 Jan 2015 10:23:14 +0000 (6 days ago)

Copyright © 2005-2015 The PHP Group
All rights reserved.