#19429 [NEW]: Using $GLOBALS in the global variable scope causes a segmentation fault
| From: | dragon at wastelands dot net | Date: | Mon, 16 Sep 2002 09:29:41 +0000 |
| Subject: | #19429 [NEW]: Using $GLOBALS in the global variable scope causes a segmentation fault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-19428@lists.php.net to get a copy of this message | ||
From: dragon@wastelands.net
Operating system: Slackware Linux 2.4.5
PHP version: 4.2.2
PHP Bug Type: Reproducible crash
Bug description: Using $GLOBALS in the global variable scope causes a segmentation fault
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 bug report at http://bugs.php.net/?id=19429&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19429&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19429&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19429&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19429&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19429&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19429&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19429&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19429&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19429&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19429&r=globals