ID:               19882
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

But does that page that calls session_decode call session_start itself?

------------------------------------------------------------------------

[2002-10-12 20:02:38] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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

Reply via email to