|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-20 14:32 UTC] motion_4u at hotmail dot com
[2004-09-20 15:42 UTC] rasmus@php.net
[2004-09-21 23:51 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
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