List Info

Thread: note 62441 added to reserved.variables




note 62441 added to reserved.variables
user name
2006-02-28 20:00:17
Note that it's a very, very bad idea to append to global
variables in a loop, unless you really, really mean to do so
in a global context. I just a while ago hung my server with
a snippet of code like this:

<?php
$host  = $_SERVER['HTTP_HOST'];
$uri  = rtrim($_SERVER['PHP_SELF'], "/\\");

   
$GLOBALS['SITE_ROOT'] = "http://$host$uri";

while ($i < somenumber)
readfile($GLOBALS['SITE_ROOT'] = $GLOBALS['SITE_ROOT'] .
'/this/file.php');
$i++
}
?>

While it is an entertaining and unusual method of creating
very long URLs and breaking servers, it's a pretty
awesomely bad idea 

(Especially considering that the script in question ran
concurrently with others of it's type, so the value in
$GLOBALS['SITE_ROOT'] was unknown.)
----
Server IP: 216.194.113.175
Probable Submitter: 12.33.21.99
----
X-Spam-Status: No, hits=3.8 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER,
	UPPERCASE_25_50 autolearn=no version=2.64
----
Manual Page -- h
ttp://www.php.net/manual/en/reserved.variables.php
Edit        -- http://master.p
hp.net/note/edit/62441
Del: integrated  -- ht
tp://master.php.net/note/delete/62441/integrated
Del: useless     -- http:
//master.php.net/note/delete/62441/useless
Del: bad code    -- http
://master.php.net/note/delete/62441/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/62441/spam
Del: non-english -- h
ttp://master.php.net/note/delete/62441/non-english
Del: in docs     -- http:
//master.php.net/note/delete/62441/in+docs
Del: other reasons-- http://master
.php.net/note/delete/62441
Reject      -- http://master
.php.net/note/reject/62441
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )