Re: session_destroy() fails...
| From: | Tobias Talltorp | Date: | Fri, 02 Mar 2001 01:02:25 +0000 |
| Subject: | Re: session_destroy() fails... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42261@lists.php.net to get a copy of this message | ||
> Why would you want to create and destroy the session data during a single
> request? That simply doesn't make sense - session persistence is designed
> to keep registered session data available across _a_series_ requests.
This I know, but it was just to show what I wanted to do.
> I believe PHP chokes at session_destroy() since the session save file has
> not yet been created, and thus deleting the session data returns an error
code.
I first got the problem when I tried this tutorial at Zend:
http://www.zend.com/zend/tut/session.php
I found it funny that a tutorial about sessions had such a "bug", since it
was supposed to cover this feature.
Complete source can be downloaded here:
http://www.phpwizard.net/resources/tutorials/session_intro.html
I had to change some in your code (lines marked with >>)...
<?php
// removed $ from $isset
>> if (isset($value)) {
echo "thanks";
session_destroy();
}
else {
// These were below the echo before...
>> session_start();
>> session_register($value);
$value = 12;
echo "<form><input type=hidden name=value value=$value>";
echo "input type=submit></form>";
}
?>
Error message: Warning: Trying to destroy uninitialized session in
E:\Inetpub\wwwroot\testscript\sessions\test.php on line 4
Just a thought...
Could it have anything with the session.save_path?
session.save_path =e:\Temp\sessions
Regards,
// Tobias