From: motion_4u at hotmail dot com
Operating system: win2k advanced server
PHP version: 5.0.1
PHP Bug Type: Session related
Bug description: session variables are lost
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 "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 bug report at http://bugs.php.net/?id=30167&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30167&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30167&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30167&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30167&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30167&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30167&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30167&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30167&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30167&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30167&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30167&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30167&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30167&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30167&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30167&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30167&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30167&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30167&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30167&r=mysqlcfg