|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-03-01 17:00 UTC] hamid at wannameet dot nl
Description: ------------ I am using sessions in a project of mine running on a virtual host, but i am losing vars from my session occassionaly. So not always and not in specific files. The session itself is not lost and after reloading the session vars reappear.Unfortunately i cann't reproduce the error, but i have noticed the errors in my log file. I also tried it with a custom session handler but the problem still exists. And i do not get an error related to the session itself, therefor i suspect that it is a bug. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
// file settings.php <?php ini_set('error_reporting',E_ALL ^ E_NOTICE); ini_set('log_errors','1'); function error_found($type, $msg, $file, $line) { $referer = $_SERVER['HTTP_REFERER']; $uri = $_SERVER['REQUEST_URI']; $ip = getenv("REMOTE_ADDR"); $host = getenv("REMOTE_HOST"); $user_agent = getenv("HTTP_USER_AGENT"); $protocol = getenv("SERVER_PROTOCOL"); // define the log file $errorLog = ""; // construct the error string $errorString = "Date: " . date("d-m-Y H:i:s", mktime()) . "\n"; $errorString .= "Error type: $type\n"; $errorString .= "Error message: $msg\n"; $errorString .= "Script: $file($line)\n"; $errorString .= "Referer: $referer\n"; $errorString .= "Request URI: $uri\n"; $errorString .= "Protocol: $protocol\n"; $errorString .= "Client: $user_agent\n"; $errorString .= "Client IP: $ip\n\n"; // write the error string to the specified log file if ($type!=8) { $fp = fopen($errorLog, "a+"); fwrite($fp, $errorString); fclose($fp); } } ini_set('display_errors','1'); set_error_handler("error_found"); $dbhost = ""; $dbname = ""; $dbuser = ""; $dbpwd = ""; $db = mysql_connect("$dbhost", "$dbuser","$dbpwd"); mysql_select_db("$dbname",$db); include(object.session.php'); ?> // file 2 <? php include("settings.php"); $sess_lang = $_SESSION['lang']; echo $sess_lang; // bug?! ?>i have put my latest error_log in the directory php_bug as you can see the session exists but sess_lang and sess_referer are empty. // error function session_start(); $sess_lang = $_SESSION['lang']; $sess_referer = $_SESSION['referer']; $session_id = session_id(); $errorString .= "Session_id: $session_id\n"; $errorString .= "Sess_lang: $sess_lang\n"; $errorString .= "Sess_referer: $sess_referer\n"; // the format for the include files is: include("content/$sess_lang/filename.inc");