#19882 [Opn->Bgs]: Nonfunctional session_decode()
| From: | iliaa@php.net | Date: | Sun, 13 Oct 2002 06:35:26 +0000 |
| Subject: | #19882 [Opn->Bgs]: Nonfunctional session_decode() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22271@lists.php.net to get a copy of this message | ||
ID: 19882
Updated by: iliaa@php.net
Reported By: matt@dfstudios.com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Redhat 7.2
PHP Version: 4CVS-2002-10-12
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Unless you do session_start() before doing session_decode(), the latter
will fail to produce valid data. You MUST call session start before
calling session_decode.
Previous Comments:
------------------------------------------------------------------------
[2002-10-12 23:21:54] matt@dfstudios.com
To answer iliaa's question: No, session_start is called on a separate
page.
This is really weird, I made up the following script as per Sniper's
request:
<?
session_start();
session_register('testvar');
$testvar = "test";
$data = session_encode();
$testvar = "false";
session_decode($data);
echo("$testvar");
?>
Strangely, THIS script works fine (if it was 'broken', it should output
"false", while it in fact prints "test").
However, I've made another script where the error is replicated:
www.dfstudios.com/session_test.php
Here's the source:
session_test.php------
<?
session_start();
session_register('testvar');
$testvar = "test";
$data = session_encode();
echo("testvar is \"$testvar\", and has been encoded: $data
<br><br>");
?>
<a href="session_test2.php?<? echo("$data"); ?>>Click here for page
two</a>
session_test2.php------
<?
session_decode($QUERY_STRING);
echo("testvar is \"$testvar\", and the string used for decoding is
$QUERY_STRING <br><br>");
?>
Notice how $testvar is properly set on the first page and encoded
properly, but in the second page $testvar is null. It seems that if
session_start and session_decode are called in separate pages the
decode function fails.
------------------------------------------------------------------------
[2002-10-12 21:42:27] sniper@php.net
I closed the other report since it really is same issue.
Please add a short simple script which clearly shows the
problem you're having. And all in one single script, thank you.
------------------------------------------------------------------------
[2002-10-12 20:09:30] iliaa@php.net
But does that page that calls session_decode call session_start itself?
------------------------------------------------------------------------
[2002-10-12 20:02:38] matt@dfstudios.com
Yes, session_start() is called in another page. I store the session
data string in a local database and pass the session ID from page to
page.
I should note that I've used these scripts with no problems for MONTHS,
I began experiencing crashes yesterday, for no reason I can identify,
and it's been all downhill from there.
------------------------------------------------------------------------
[2002-10-12 19:49:26] iliaa@php.net
Did you initialize a session by calling session_start() before calling
session_decode() ?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/19882
--
Edit this bug report at http://bugs.php.net/?id=19882&edit=1