#19429 [Opn->Csd]: Using $GLOBALS in the global variable scope causes a segmentation fault

From: Date: Mon, 16 Sep 2002 09:48:50 +0000
Subject: #19429 [Opn->Csd]: Using $GLOBALS in the global variable scope causes a segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19430@lists.php.net to get a copy of this message
ID: 19429 User updated by: dragon@wastelands.net Reported By: dragon@wastelands.net -Status: Open +Status: Closed Bug Type: Reproducible crash Operating System: Slackware Linux 2.4.5 PHP Version: 4.2.2 New Comment: ok obviously the ($var) isnt actually referencing the global variable, so this wasn't the problem. im still trying to work out the real problem (seems to be accessing an array from a form submission which has nothing in it) but I will post a separate bug report when I work out exactly what is wrong. Previous Comments: ------------------------------------------------------------------------ [2002-09-16 04:29:41] dragon@wastelands.net I typically write my code on a local machine running 4.1.2. The following code works fine on my local machine, but causes a segmentation fault in the apache child sending the page, which is on the server using 4.2.2. The offending line was: foreach ($vars as $var) if ($GLOBALS["$var"]) { $prosql = 1; $websql = 1; } Obviously it is quite stupid trying to access global variables like this from within the global scope, but this line got moved from a function at some stage and obviously I didn't change it. Anyways -- stupid code shouldn't crash the server. and it took me long enough to even find the offending line. changing the middle part to "if ($var)" promptly fixed the problem. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19429&edit=1

« previous php.bugs (#19430) next »