php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30167 session variables are lost
Submitted: 2004-09-20 13:22 UTC Modified: 2004-09-21 23:51 UTC
From: motion_4u at hotmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.0.1 OS: win2k advanced server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: motion_4u at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-09-20 13:22 UTC] motion_4u at hotmail dot com
Description:
------------
Below, you will find the code for 2 pages.

One registers a session and the other one should read it.

You can test it with or without session_start(); function but you will get the same result.

Any call to session_start() produces a new session loosing the old one.
This bug is an old one that was once solved on version 4.3.4 I believe, but please don?t take me by words.

You are fighting with this function more that one and half years with no results.
I hope that you forgive me for the above comments.
 By my opinion the function session_start(); should not create a new session automatically and the user should create one by using a new function presumably called create_session(); 
That would solve lots of problems with sessions.

Best Regards 
Sam


Reproduce code:
---------------
PAGE 1--- save as INDEX.PHP
<html>
<head><title>php 5.0.1 bug</title></head>
<body bgcolor="#FFFFFF">
<?
session_start();
$_SESSION['var']=1;
session_write_close();
"echo The session variable ist set to ". $_SESSION['var'] ."</br>";
?>
<p><a href="sub.php" target="_blank"">Test the session function by calling the sub.php file, which reads  the session variable &quot;var&quot; with the value of 1:</a>
<?// PHP 5.0.1 doesn't find sessions!?>

</body>
</html>
--------------------------------
PAGE 2 save as SUB.PHP
<?
if (isset($_SESSION['var'])&&$_SESSION['var']==1)
{
$text="You have opened the sub.php file, receiving a session variable 'var', which shuld carry the value of 1 and it works! _SESSION['var']=". $_SESSION['var'];
}else
{
$text="You have opened the sub.php file, receiving a session variable 'var', which shuld carry the value of 1 but _SESSION['var']=". $_SESSION['var'];

}
echo $text;
?>


Expected result:
----------------
Just call the index.php and find out




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-20 14:32 UTC] motion_4u at hotmail dot com
You can test these pages directly on my server too:

http://motion4u.sytes.net/phptest/index.php
 [2004-09-20 15:42 UTC] rasmus@php.net
SUB.PHP has no session_start() call in it.  Without a session_start() call $_SESSION cannot possibly be populated so your code is bogus.
 [2004-09-21 23:51 UTC] derick@php.net
bogus != feedback
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 14:01:28 2024 UTC