note 12958 modified in ref.session by goba

From: Date: Thu, 27 Dec 2001 11:39:45 +0000
Subject: note 12958 modified in ref.session by goba
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23882@lists.php.net to get a copy of this message
When register_globals is turned on, changes in $HTTP_SESSION_VARS won't be saved to session. Because I wanted to use $HTTP_SESSION_VARS without turning register_globals off, I wrote that "workaround" function below. It should be called at the end of every PHP script that modifies $HTTP_SESSION_VARS. /* delete the dots before using ;) */ function session_regglobals_workaround() // by Hans Spath { . global $HTTP_SESSION_VARS; . if ( ini_get('register_globals') ) . . foreach ( $HTTP_SESSION_VARS as $varname=>$value ) . . . if ( session_is_registered($varname) ) . . . . $GLOBALS[$varname] = $value; } comments? critics? <postings.php.net at hans-spath.de> --was-- When register_globals is turned on, changes in $HTTP_SESSION_VARS won't be saved to session. Because I wanted to use $HTTP_SESSION_VARS without turning register_globals off, I wrote that "workaround" function below. It should be called at the end of every PHP script that modifies $HTTP_SESSION_VARS. /* delete the dots before using ;) */ function session_regglobals_workaround() // by Hans Spath { . global $HTTP_SESSION_VARS; . if ( ini_get('register_globals') ) . . foreach ( $HTTP_SESSION_VARS as $varname=>$value ) . . . if ( session_is_registered($varname) ) . . . . $GLOBALS[$varname] = $value; } comments? critics? <postings.php.net@hans-spath.de> http://www.php.net/manual/en/ref.session.php

« previous php.notes (#23882) next »