PHP  
 PHP_5_6
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

==549== Invalid read of size 1
==549==    at 0xC52245: php_var_dump (var.c:99)
==549==    by 0xC521B5: php_object_property_dump (var.c:82)
==549==    by 0xE89C29: zend_hash_apply_with_arguments (zend_hash.c:701)
==549==    by 0xC52B32: php_var_dump (var.c:146)
==549==    by 0xC52E44: zif_var_dump (var.c:183)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==  Address 0x153c2fc4 is 20 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 1
==549==    at 0xC52338: zval_isref_p (zend.h:415)
==549==    by 0xC52338: php_var_dump (var.c:104)
==549==    by 0xC521B5: php_object_property_dump (var.c:82)
==549==    by 0xE89C29: zend_hash_apply_with_arguments (zend_hash.c:701)
==549==    by 0xC52B32: php_var_dump (var.c:146)
==549==    by 0xC52E44: zif_var_dump (var.c:183)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==  Address 0x153c2fc5 is 21 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 4
==549==    at 0xE498E7: zval_delref_p (zend.h:411)
==549==    by 0xE498E7: i_zval_ptr_dtor (zend_execute.h:76)
==549==    by 0xE498E7: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc0 is 16 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid write of size 4
==549==    at 0xE498F1: zval_delref_p (zend.h:411)
==549==    by 0xE498F1: i_zval_ptr_dtor (zend_execute.h:76)
==549==    by 0xE498F1: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc0 is 16 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 4
==549==    at 0xE498F8: zval_delref_p (zend.h:411)
==549==    by 0xE498F8: i_zval_ptr_dtor (zend_execute.h:76)
==549==    by 0xE498F8: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc0 is 16 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 4
==549==    at 0xE499DD: zval_refcount_p (zend.h:399)
==549==    by 0xE499DD: i_zval_ptr_dtor (zend_execute.h:82)
==549==    by 0xE499DD: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc0 is 16 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid write of size 1
==549==    at 0xE499F1: zval_unset_isref_p (zend.h:423)
==549==    by 0xE499F1: i_zval_ptr_dtor (zend_execute.h:83)
==549==    by 0xE499F1: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc5 is 21 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 1
==549==    at 0xE49A13: gc_zval_check_possible_root (zend_gc.h:182)
==549==    by 0xE49A13: i_zval_ptr_dtor (zend_execute.h:86)
==549==    by 0xE49A13: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc4 is 20 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 
==549== Invalid read of size 1
==549==    at 0xE49A31: gc_zval_check_possible_root (zend_gc.h:182)
==549==    by 0xE49A31: i_zval_ptr_dtor (zend_execute.h:86)
==549==    by 0xE49A31: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE8923D: zend_hash_destroy (zend_hash.c:548)
==549==    by 0xEBDB50: zend_object_std_dtor (zend_objects.c:44)
==549==    by 0xEBE2B4: zend_objects_free_object_storage (zend_objects.c:137)
==549==    by 0xECD7D2: zend_objects_store_del_ref_by_handle_ex (zend_objects_API.c:226)
==549==    by 0xECD36C: zend_objects_store_del_ref (zend_objects_API.c:178)
==549==    by 0xE694E3: _zval_dtor_func (zend_variables.c:57)
==549==    by 0xE49989: _zval_dtor (zend_variables.h:35)
==549==    by 0xE49989: i_zval_ptr_dtor (zend_execute.h:79)
==549==    by 0xE49989: _zval_ptr_dtor (zend_execute_API.c:424)
==549==    by 0xE86A9C: i_zend_hash_bucket_delete (zend_hash.c:182)
==549==    by 0xE86A9C: zend_hash_bucket_delete (zend_hash.c:192)
==549==    by 0xE89E5C: zend_hash_reverse_apply (zend_hash.c:733)
==549==    by 0xE48A80: shutdown_destructors (zend_execute_API.c:214)
==549==    by 0xE6CDA6: zend_call_destructors (zend.c:944)
==549==  Address 0x153c2fc4 is 20 bytes inside a block of size 32 free'd
==549==    at 0x4C27C24: free (vg_replace_malloc.c:473)
==549==    by 0xE18910: _efree (zend_alloc.c:2437)
==549==    by 0xEB070B: gc_collect_cycles (zend_gc.c:846)
==549==    by 0xE8F0A2: zif_gc_collect_cycles (zend_builtin_functions.c:361)
==549==    by 0xEDB660: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
==549==    by 0xEE71CC: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2599)
==549==    by 0xED90E6: execute_ex (zend_vm_execute.h:363)
==549==    by 0xED9C89: zend_execute (zend_vm_execute.h:388)
==549==    by 0xE6EA77: zend_execute_scripts (zend.c:1341)
==549==    by 0xD8CE8F: php_execute_script (main.c:2597)
==549==    by 0x102631A: do_cli (php_cli.c:994)
==549==    by 0x1027AC7: main (php_cli.c:1378)
==549== 

 

Generated at Tue, 28 Apr 2015 22:49:54 +0000 (6 days ago)

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