[PHP-BUG] Bug #64724 [NEW]: Objects stored in Sessions sometimes get "lost".
From: php dot bugs at lippe-net dot de Operating system: Debian Wheezy PHP version: 5.4.14 Package: Session related Bug Type: Bug Bug description:Objects stored in Sessions sometimes get "lost". Description: The "transactions" array of the $_SESSION variable is initialized only once. If you repeat the invocation of the script. After a while the array contains some elements that are no more Objects of "class S" but references (for example r:5607;). Test script: --- data[] = mt_rand(0, 50); } } public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } } session_name("testS"); session_start(); if ( empty($_SESSION["transactions"]) ) { $_SESSION["transactions"] = [ new S(), new S(), new S(), new S() ]; } echo serialize($_SESSION); ?> Expected result: Example (first call): transactions|a:4:{i:0;C:1:"S":76:{a:8: {i:0;i:9;i:1;i:24;i:2;i:23;i:3;i:46;i:4;i:29;i:5;i:4;i:6;i:44;i:7;i:14;}}i:1;C:1:" S":51:{a:5:{i:0;i:11;i:1;i:45;i:2;i:12;i:3;i:10;i:4;i:21;}}i:2;C:1:"S":59:{a:6: {i:0;i:47;i:1;i:5;i:2;i:40;i:3;i:35;i:4;i:29;i:5;i:14;}}i:3;C:1:"S":58:{a:6: {i:0;i:20;i:1;i:20;i:2;i:7;i:3;i:44;i:4;i:7;i:5;i:27;}}} Actual result: -- Example (after some roundabout 50 calls): transactions|a:4:{i:0;r:5607;i:1;r:5617;i:2;r:5624;i:3;r:5632;} -- Edit bug report at https://bugs.php.net/bug.php?id=64724&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64724&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64724&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64724&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64724&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64724&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64724&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64724&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64724&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=64724&r=support Expected behavior: https://bugs.php.net/fix.php?id=64724&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64724&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64724&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64724&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64724&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64724&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64724&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=64724&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64724&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64724&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64724&r=mysqlcfg
Bug #64724 [Com]: Objects stored in Sessions sometimes get "lost".
Edit report at https://bugs.php.net/bug.php?id=64724&edit=1 ID: 64724 Comment by: php dot bugs at lippe-net dot de Reported by: php dot bugs at lippe-net dot de Summary:Objects stored in Sessions sometimes get "lost". Status: Feedback Type: Bug Package:*General Issues Operating System: Debian Wheezy PHP Version:5.4.14 Assigned To:mike Block user comment: N Private report: N New Comment: The only thing is a DBG v4.6.4 installation, but it seems to make no difference if it is activated or not. Previous Comments: [2013-04-29 14:15:19] m...@php.net Can't reproduce. Do you have any special extensions loaded? If so, see if that also happens without them loaded. [2013-04-27 15:45:48] larue...@php.net maybe due to the serialize [2013-04-26 15:04:24] php dot bugs at lippe-net dot de Description: The "transactions" array of the $_SESSION variable is initialized only once. If you repeat the invocation of the script. After a while the array contains some elements that are no more Objects of "class S" but references (for example r:5607;). Test script: --- data[] = mt_rand(0, 50); } } public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } } session_name("testS"); session_start(); if ( empty($_SESSION["transactions"]) ) { $_SESSION["transactions"] = [ new S(), new S(), new S(), new S() ]; } echo serialize($_SESSION); ?> Expected result: Example (first call): transactions|a:4:{i:0;C:1:"S":76:{a:8: {i:0;i:9;i:1;i:24;i:2;i:23;i:3;i:46;i:4;i:29;i:5;i:4;i:6;i:44;i:7;i:14;}}i:1;C:1:" S":51:{a:5:{i:0;i:11;i:1;i:45;i:2;i:12;i:3;i:10;i:4;i:21;}}i:2;C:1:"S":59:{a:6: {i:0;i:47;i:1;i:5;i:2;i:40;i:3;i:35;i:4;i:29;i:5;i:14;}}i:3;C:1:"S":58:{a:6: {i:0;i:20;i:1;i:20;i:2;i:7;i:3;i:44;i:4;i:7;i:5;i:27;}}} Actual result: -- Example (after some roundabout 50 calls): transactions|a:4:{i:0;r:5607;i:1;r:5617;i:2;r:5624;i:3;r:5632;} -- Edit this bug report at https://bugs.php.net/bug.php?id=64724&edit=1
Bug #64724 [Com]: Objects stored in Sessions sometimes get "lost".
Edit report at https://bugs.php.net/bug.php?id=64724&edit=1 ID: 64724 Comment by: php dot bugs at lippe-net dot de Reported by: php dot bugs at lippe-net dot de Summary:Objects stored in Sessions sometimes get "lost". Status: Feedback Type: Bug Package:*General Issues Operating System: Debian Wheezy PHP Version:5.4.14 Assigned To:mike Block user comment: N Private report: N New Comment: The debian libapache2-mod-php5 (5.4.4-14) is certainly not thread-safe. Previous Comments: [2013-05-07 09:46:46] m...@php.net It "seems", or it "does"? Is this a ZTS build? Thanks. ------------ [2013-05-06 16:20:44] php dot bugs at lippe-net dot de The only thing is a DBG v4.6.4 installation, but it seems to make no difference if it is activated or not. [2013-04-29 14:15:19] m...@php.net Can't reproduce. Do you have any special extensions loaded? If so, see if that also happens without them loaded. [2013-04-27 15:45:48] larue...@php.net maybe due to the serialize ------------ [2013-04-26 15:04:24] php dot bugs at lippe-net dot de Description: The "transactions" array of the $_SESSION variable is initialized only once. If you repeat the invocation of the script. After a while the array contains some elements that are no more Objects of "class S" but references (for example r:5607;). Test script: --- data[] = mt_rand(0, 50); } } public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } } session_name("testS"); session_start(); if ( empty($_SESSION["transactions"]) ) { $_SESSION["transactions"] = [ new S(), new S(), new S(), new S() ]; } echo serialize($_SESSION); ?> Expected result: Example (first call): transactions|a:4:{i:0;C:1:"S":76:{a:8: {i:0;i:9;i:1;i:24;i:2;i:23;i:3;i:46;i:4;i:29;i:5;i:4;i:6;i:44;i:7;i:14;}}i:1;C:1:" S":51:{a:5:{i:0;i:11;i:1;i:45;i:2;i:12;i:3;i:10;i:4;i:21;}}i:2;C:1:"S":59:{a:6: {i:0;i:47;i:1;i:5;i:2;i:40;i:3;i:35;i:4;i:29;i:5;i:14;}}i:3;C:1:"S":58:{a:6: {i:0;i:20;i:1;i:20;i:2;i:7;i:3;i:44;i:4;i:7;i:5;i:27;}}} Actual result: -- Example (after some roundabout 50 calls): transactions|a:4:{i:0;r:5607;i:1;r:5617;i:2;r:5624;i:3;r:5632;} -- Edit this bug report at https://bugs.php.net/bug.php?id=64724&edit=1