note 106734 added to security.globals

From: Date: Fri, 02 Dec 2011 14:59:38 +0000
Subject: note 106734 added to security.globals
Groups: php.notes 
Request: Send a blank email to php-notes+get-184856@lists.php.net to get a copy of this message
Ok.. Here is my contribuition. Removes all elements from $GLOBALS which are inside the input superglobals. <?php /** * Must be executed before any other scripts are loaded. * * If register_globals are on, unregister globals. * Second test covers boolean set as string (php_value register_globals off). */ function unregister_globals() { /* Input list. Don't change it */ static $_input = array ( '_POST', '_GET', '_COOKIE', '_SERVER', '_ENV', '_FILES', '_REQUEST', '_SESSION', 'GLOBALS', 'HTTP_POST_VARS', 'HTTP_GET_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'HTTP_SESSION_VARS', ) ; if ( ini_get( 'register_globals' ) == false ) return ; /** * Remove all globals that are not reserved by PHP */ foreach ( array_keys( $GLOBALS ) as $key ) { if ( in_array( $key, $_input ) == false ) unset( $GLOBALS[ $key ] ) ; } return ; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 189.107.188.112 ---- Manual Page -- http://www.php.net/manual/en/security.globals.php Edit -- https://master.php.net/note/edit/106734 Del: integrated -- https://master.php.net/note/delete/106734/integrated Del: useless -- https://master.php.net/note/delete/106734/useless Del: bad code -- https://master.php.net/note/delete/106734/bad+code Del: spam -- https://master.php.net/note/delete/106734/spam Del: non-english -- https://master.php.net/note/delete/106734/non-english Del: in docs -- https://master.php.net/note/delete/106734/in+docs Del: other reasons-- https://master.php.net/note/delete/106734 Reject -- https://master.php.net/note/reject/106734 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184856) next »