|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-05-25 18:57 UTC] jkump at everestgt dot com
Description:
------------
When using session_start() and coming into the page a second time. The $_SESSION[] information is not getting saved correctly. When returing to the page in an appropriate amount of time the session_start functions says the node no lionger exists. Works correctly in php 4.3.11 but not in 5.0.4
Reproduce code:
---------------
<?php
session_start();
if (!$_SESSION["foo"]) {
$_SESSION["foo"] = 45;
} else {
print "found\n";
}
?>
Expected result:
----------------
secnd time called should say
found.
Actual result:
--------------
Get warning messages about node no longer valid.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 19:00:02 2025 UTC |
Here is the flaming script. <?php ini_set(display_errors, on); session_start(); $XML='<?xml version="1.0" encoding="UTF-8"?> <book type="paperback"> <title>Red Nails</title> <price>$12.99</price> <author> <name> <first>Robert</first> <middle>E</middle> <last>Howard</last> </name> <birthdate>9/21/1977</birthdate> </author> </book> '; $HTML_XML='<?xml version="1.0"?> <book type="paperback"> <title>Red Nails</title> <price>$12.99</price> <author> <name> <first>Robert</first> <middle>E</middle> <last>Howard</last> </name> <birthdate>9/21/1977</birthdate> </author> </book> '; $InXML = simplexml_load_string($XML); if (!isset($_REQUEST["SUBMIT"])) { $_SESSION["PRICE"] = $InXML->price; } echo "<html>\n"; echo "<head><title>Test PHP BUG 33142</title></head>\n"; echo "<body>\n"; echo "<P>XML we are using: <pre>".$HTML_XML."</pre></P>\n"; echo "<BR><BR>\n"; if (isset($_SESSION["PRICE"])) { echo "<P>PRICE before submit: ".$_SESSION["PRICE"]."</p>\n"; } if (isset($_SESSION["PRICE"]) && isset($_REQUEST["SUBMIT"])) { echo "<P>PRICE after submit: ".$_SESSION["PRICE"]."</p>\n"; } echo "<form action=\"".$_REQUEST["PHP_SELF"]."\" method=\"POST\">\n"; echo "<input type=\"SUBMIT\" name=\"SUBMIT\" value=\"Get Price\">\n"; echo "</form>\n"; echo "</body>\n"; echo "</html>\n"; ?>