#32799 [Opn->Fbk]: crash: calling the corresponding global var during the destruct

From: Date: Fri, 22 Apr 2005 12:31:20 +0000
Subject: #32799 [Opn->Fbk]: crash: calling the corresponding global var during the destruct
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78055@lists.php.net to get a copy of this message
ID: 32799 Updated by: sniper@php.net Reported By: rd dot contact at free dot fr -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: xp PHP Version: 5.0.4 New Comment: Can you give a bit more realistic example script? The one here does not make any sense.. Previous Comments: ------------------------------------------------------------------------ [2005-04-22 05:19:51] rd dot contact at free dot fr Description: ------------ During the __destruct, when using the global var assigned to the object, php crashes in some cases. Reproduce code: --------------- class test{ function __destruct (){ //$GLOBALS['p']=$this; // <- this crash apache for all tests //$GLOBALS['p']++; // <- this crash apache for all tests print_r($GLOBALS['p']); // <- crash only test 1. test 2 => "Undefined variable p" } } $p=new test; //test 1 $p=1; // crash apache (as $p=null, $p='bug', $p=new test ...) //but, //test 2 //unset($p); // no crash: "Undefined variable: p on line 5" Expected result: ---------------- No crash, and a way to use the global var during destruct. (so destruct could call external functions that use the global var of the object. Why not unregister the global var after the destruct call ?) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32799&edit=1

« previous php.bugs (#78055) next »