note 84444 deleted from security.globals by cmb
| From: | cmb@php.net | Date: | Sun, 17 Jan 2021 13:56:49 +0000 |
| Subject: | note 84444 deleted from security.globals by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216177@lists.php.net to get a copy of this message | ||
Note Submitter: moore at hs-furtwangen dot de
----
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.