note 84444 added to security.globals
| From: | moore at hs-furtwangen dot de | Date: | Mon, 14 Jul 2008 20:19:27 +0000 |
| Subject: | note 84444 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141501@lists.php.net to get a copy of this message | ||
I had a look at the post from Dice, in which he suggested the function unregister_globals(). It
didn't seem to work - only tested php 4.4.8 and 5.2.1 - so I made some tweaking to get it
running. (I had to use $GLOBALS due to the fact that $$name won't work with superglobals).
<?php
//Undo register_globals
function unregister_globals() {
if (ini_get('register_globals')) {
$array = array('_REQUEST', '_FILES');
foreach ($array as $value) {
if(isset($GLOBALS[$value])){
foreach ($GLOBALS[$value] as $key => $var) {
if (isset($GLOBALS[$key]) && $var === $GLOBALS[$key]) {
//echo 'found '.$key.' = '.$var.' in
$'.$value."\n";
unset($GLOBALS[$key]);
}
}
}
}
}
}
?>
The echo was for debuging, thought it might come in handy.
----
Server IP: 212.124.37.9
Probable Submitter: 217.80.100.197
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- https://master.php.net/note/edit/84444
Del: integrated -- https://master.php.net/note/delete/84444/integrated
Del: useless -- https://master.php.net/note/delete/84444/useless
Del: bad code -- https://master.php.net/note/delete/84444/bad+code
Del: spam -- https://master.php.net/note/delete/84444/spam
Del: non-english -- https://master.php.net/note/delete/84444/non-english
Del: in docs -- https://master.php.net/note/delete/84444/in+docs
Del: other reasons-- https://master.php.net/note/delete/84444
Reject -- https://master.php.net/note/reject/84444
Search -- https://master.php.net/manage/user-notes.php