php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24914 printing $GLOBALS in __destruct function cause PHP crush
Submitted: 2003-08-01 23:20 UTC Modified: 2003-08-11 14:43 UTC
From: itotakas at msu dot edu Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2003-08-11 (dev) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: itotakas at msu dot edu
New email:
PHP Version: OS:

 

 [2003-08-01 23:20 UTC] itotakas at msu dot edu
Description:
------------
printing $GLOBALS in __destruct function cause PHP crush

using Apache 1.3.24 and SAPI modules

Reproduce code:
---------------
<?
  class bug {
      function __destruct()
      {
          print_r($GLOBALS);
      }
  }

  $bug = new bug;
?>

Expected result:
----------------
printing all global variables

Actual result:
--------------
PHP crush

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-10 20:08 UTC] sniper@php.net
Bactrace with latest PHP 5 CVS:

0x814775c in zend_print_zval_r_ex (write_func=0x811c2d8 <php_body_write_wrapper>, expr=0x40298c54, indent=8)
    at /usr/src/web/php/php5/Zend/zend.c:343
343                             if (++expr->value.ht->nApplyCount>1) {
(gdb) bt
#0  0x814775c in zend_print_zval_r_ex (write_func=0x811c2d8 <php_body_write_wrapper>, expr=0x40298c54, indent=8)
    at /usr/src/web/php/php5/Zend/zend.c:343
#1  0x8147720 in zend_print_zval_r (expr=0x40298c54, indent=8) at /usr/src/web/php/php5/Zend/zend.c:334
#2  0x814720d in print_hash (ht=0x81d0ef0, indent=4, is_object=0 '\000') at /usr/src/web/php/php5/Zend/zend.c:158
#3  0x814778e in zend_print_zval_r_ex (write_func=0x811c2d8 <php_body_write_wrapper>, expr=0x4028fbdc, indent=0)
    at /usr/src/web/php/php5/Zend/zend.c:348
#4  0x8147720 in zend_print_zval_r (expr=0x4028fbdc, indent=0) at /usr/src/web/php/php5/Zend/zend.c:334
#5  0x80ca229 in zif_print_r (ht=1, return_value=0x4029a9a4, this_ptr=0x0, return_value_used=0)
    at /usr/src/web/php/php5/ext/standard/basic_functions.c:2538
#6  0x8175d5e in zend_do_fcall_common_helper (execute_data=0xbfffe80c, op_array=0x4029e51c)
    at /usr/src/web/php/php5/Zend/zend_execute.c:2516
#7  0x8176312 in zend_do_fcall_handler (execute_data=0xbfffe80c, op_array=0x4029e51c)
    at /usr/src/web/php/php5/Zend/zend_execute.c:2647
#8  0x81602a4 in execute (op_array=0x4029e51c) at /usr/src/web/php/php5/Zend/zend_execute.c:1242
#9  0x8140730 in zend_call_function (fci=0xbfffe924, fci_cache=0x0)
    at /usr/src/web/php/php5/Zend/zend_execute_API.c:723
#10 0x813fed2 in call_user_function_ex (function_table=0x0, object_pp=0xbfffe998, function_name=0x4029acbc, 
    retval_ptr_ptr=0xbfffe99c, param_count=0, params=0x0, no_separation=0, symbol_table=0xbfffe9a0)
    at /usr/src/web/php/php5/Zend/zend_execute_API.c:497
#11 0x81532f3 in zend_objects_destroy_object (object=0x4029b0dc, handle=1)
    at /usr/src/web/php/php5/Zend/zend_objects.c:90
#12 0x8155342 in zend_objects_store_del_ref (zobject=0x4029b0fc) at /usr/src/web/php/php5/Zend/zend_objects_API.c:142
#13 0x8146eb1 in _zval_dtor (zvalue=0x4029b0fc) at /usr/src/web/php/php5/Zend/zend_variables.c:61
#14 0x813f9a5 in _zval_ptr_dtor (zval_ptr=0x4029d080) at /usr/src/web/php/php5/Zend/zend_execute_API.c:353
#15 0x814cc08 in zend_hash_destroy (ht=0x81d0ef0) at /usr/src/web/php/php5/Zend/zend_hash.c:513
#16 0x813f5b4 in shutdown_executor () at /usr/src/web/php/php5/Zend/zend_execute_API.c:209
#17 0x814801f in zend_deactivate () at /usr/src/web/php/php5/Zend/zend.c:795
#18 0x811c1c4 in php_request_shutdown (dummy=0x0) at /usr/src/web/php/php5/main/main.c:1180
#19 0x8180c5f in main (argc=2, argv=0xbffff694) at /usr/src/web/php/php5/sapi/cli/php_cli.c:1015
#20 0x401b19cb in __libc_start_main (main=0x817fe78 <main>, argc=2, argv=0xbffff694, init=0x8069ba0 <_init>, 
    fini=0x8181224 <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffff68c)
    at ../sysdeps/generic/libc-start.c:92

 [2003-08-11 14:10 UTC] helly@php.net
Duplicate of #24908
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 12:01:35 2025 UTC