Bug #71972 [NEW]: Cyclic references causing session_start(): Failed to decode session object.
| From: | b dot curtis at dfusion dot com | Date: | Wed, 06 Apr 2016 07:42:09 +0000 |
| Subject: | Bug #71972 [NEW]: Cyclic references causing session_start(): Failed to decode session object. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200413@lists.php.net to get a copy of this message | ||
From: b dot curtis at dfusion dot com
Operating system: Ubuntu 14.04.4 LTS
PHP version: 7.0.5
Package: Session related
Bug Type: Bug
Bug description:Cyclic references causing session_start(): Failed to decode session object.
Description:
------------
Particular combination of session data causes "PHP Warning:
session_start(): Failed to decode session object."
Found in our web application but recreated in the test CLI script
below.
Steps to reproduce:
1) run this file once. Session data is saved.
2) Run again. Session cannot be decoded.
3) Remove session file /tmp/sess_sessiontest. If it wasn't already
removed by the session_decode failing.
4) Comment out the $_SESSION['boogie'] line
5) Run again, and again and again and again.......No bug!
Test script:
---------------
<?php
$session_id = 'sessiontest';
session_id($session_id);
session_start();
$_SESSION['boogie'] = 1;//NOTE: Comment out this line for step 4
$_SESSION['obj1'] = new stdClass();
for ( $x=2; $x < 20; $x++) {//NOTE: In my tests the number needed varied
but was always between 10 and 20
cyclic_ref($x);
}
function cyclic_ref($num) {
$_SESSION['obj'.$num] = new stdClass();
$_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if
try commenting out this too.
$_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
}
Expected result:
----------------
When session successfully decoded no output.
Actual result:
--------------
#first run - success. Session written.
$ php sessiontest.php
#second run. Fail. Session cannot be decoded.
~$ php sessiontest.php
PHP Warning: session_start(): Failed to decode session object. Session
has been destroyed in /path/sessiontest.php on line 16
--
Edit bug report at https://bugs.php.net/bug.php?id=71972&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71972&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71972&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71972&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71972&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71972&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71972&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71972&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71972&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71972&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71972&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71972&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71972&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71972&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71972&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71972&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71972&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71972&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71972&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71972&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71972&r=mysqlcfg