#30167 [Fbk->Bgs]: session variables are lost
| From: | derick@php.net | Date: | Tue, 21 Sep 2004 21:51:59 +0000 |
| Subject: | #30167 [Fbk->Bgs]: session variables are lost | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66509@lists.php.net to get a copy of this message | ||
ID: 30167
Updated by: derick@php.net
Reported By: motion_4u at hotmail dot com
-Status: Feedback
+Status: Bogus
Bug Type: Session related
Operating System: win2k advanced server
PHP Version: 5.0.1
New Comment:
bogus != feedback
Previous Comments:
------------------------------------------------------------------------
[2004-09-20 15:42:24] 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-20 14:32:39] 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 13:22:53] 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 dont 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
"var" 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30167&edit=1