#24728 [Bgs]: iterating over _SESSION will stuff up session saving

From: Date: Sun, 20 Jul 2003 16:15:10 +0000
Subject: #24728 [Bgs]: iterating over _SESSION will stuff up session saving
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44373@lists.php.net to get a copy of this message
ID: 24728 Updated by: sniper@php.net Reported By: dzlist at zverina dot co dot uk Status: Bogus Bug Type: Session related Operating System: linux PHP Version: 4.2.2 New Comment: Uh..and RTFM about how superglobals work.. Previous Comments: ------------------------------------------------------------------------ [2003-07-20 11:14:25] sniper@php.net Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Try the latest STABLE snapshot from http://snaps.php.net/ ------------------------------------------------------------------------ [2003-07-20 11:09:29] dzlist at zverina dot co dot uk Description: ------------ Using up to date version from RedHat 8.0, 4.2.2 Calling the function below will stuff up saving of _ALL_ session data: Reproduce code: --------------- function import_session_variables ($prefix) { global $_SESSION; $tab = $_SESSION; reset($tab); while (!is_null($key = key($tab) ) ) { $var = $prefix.$key; global $$var; $$var = $_SESSION[$key]; next($tab); } // if you uncomment the next line sessions will save // hence i have a work around // it'd be nice to have it fixed properly though // reset($tab); } Expected result: ---------------- import all the session variable AND the session should still save correctly Actual result: -------------- imports all the session variables BUT sessions ARE NOT saved ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24728&edit=1

« previous php.bugs (#44373) next »