Bug #12236 Updated: session_start() inside a function destroys reference to $HTTP_SESSION_VARS

From: Date: Sun, 25 Nov 2001 00:41:06 +0000
Subject: Bug #12236 Updated: session_start() inside a function destroys reference to $HTTP_SESSION_VARS
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-71565@lists.php.net to get a copy of this message
ID: 12236 Updated by: sniper Reported By: b.erdmann@4commerce.de Old Status: Open Status: Closed Bug Type: Session related Operating System: any PHP Version: 4.0.6 New Comment: This problem will be gone in PHP 4.1.0 (and more probs are fixed for 4.2.0). In PHP 4.1 we have introduced new TRUE global variables and one of them is: $_SESSION (same as $HTTP_SESSION_VARS but is true global) --Jani Previous Comments: ------------------------------------------------------------------------ [2001-07-18 16:08:03] b.erdmann@4commerce.de The following code doesn't work <?php function start_session() { global $HTTP_SESSION_VARS; session_start(); echo $HTTP_SESSION_VARS["testvar"]; } start_session(); ?> while this one does <?php function start_session() { session_start(); global $HTTP_SESSION_VARS; echo $HTTP_SESSION_VARS["testvar"]; } start_session(); ?> Obviosly after session_start() $HTTP_SESSION_VARS is not global any more. (register_globals Off) ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12236&edit=1

« previous php.dev (#71565) next »