#40973 [Opn->Fbk]: session don't work if used $_SERVER in any way

From: Date: Tue, 03 Apr 2007 18:58:36 +0000
Subject: #40973 [Opn->Fbk]: session don't work if used $_SERVER in any way
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111062@lists.php.net to get a copy of this message
ID: 40973 Updated by: tony2001@php.net Reported By: krassesache at gmx dot net -Status: Open +Status: Feedback Bug Type: Session related Operating System: WinXP SP2 PHP Version: 5.2.1 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Works perfectly fine. Previous Comments: ------------------------------------------------------------------------ [2007-04-01 16:12:13] krassesache at gmx dot net Description: ------------ if i use $_SERVER in any way but with pdo statements [ $stmt->execute(array($_SERVER['REMOTE_ADDR'])) ] a session will not work. in my example i first open foobar.php and then foobar2.php. if remove the 4th line in foobar2.php [ $var = $_SERVER['REMOTE_ADDR']; ] the the text "bar" appears but with the line, nothing happens. in other case is used preg_match('#MSIE#',$_SERVER['HTTP_USER_AGENT']) with the result that the website will be shown but the session dont work (the original problem). Reproduce code: --------------- => foobar.php <?php session_start(); $_SESSION['foo'] = 'bar'; ?> => foobar2.php <?php session_start(); $var = $_SERVER['REMOTE_ADDR']; echo $_SESSION['foo']; ?> Expected result: ---------------- bar Actual result: -------------- <nothing> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40973&edit=1

« previous php.bugs (#111062) next »