Bug #73302 [Opn->Fbk]: Copy-On-Write on $_SESSION fails with session_decode

From: Date: Thu, 13 Oct 2016 13:42:54 +0000
Subject: Bug #73302 [Opn->Fbk]: Copy-On-Write on $_SESSION fails with session_decode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204666@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73302&edit=1 ID: 73302 Updated by: requinix@php.net Reported by: d dot negrier at thecodingmachine dot com Summary: Copy-On-Write on $_SESSION fails with session_decode -Status: Open +Status: Feedback Type: Bug Package: Session related Operating System: Ubuntu PHP Version: 7.1.0RC3 Block user comment: N Private report: N New Comment: This sounds like the same problem as bug #73273. Can you try a build of master to confirm whether @nikic's fix solves this? Previous Comments: ------------------------------------------------------------------------ [2016-10-13 13:37:53] x dot huberty at thecodingmachine dot Com Description: ------------ Bug can seen here: https://3v4l.org/tekjZ We have the same behaviour when we copy a temp variable ($sessionCopy) in $_SESSION. ------------------------------------------------------------------------ [2016-10-12 13:53:58] d dot negrier at thecodingmachine dot com Description: ------------ Bug can seen here: https://3v4l.org/m1HQ3 It affects all versions starting with 7.0. If I copy the $_SESSION variable in another variable ($sessionCopy) and then I call session_decode, I do not expect $sessionCopy to be impacted by the call to $_SESSION. Yet, in PHP 7.0+, $sessionCopy is also modified. Test script: --------------- <?php session_start(); // $_SESSION is empty so $oldSession is empty too now. // I expect copy to be by value, not by reference so anything impacting $_SESSION should not impace $oldSession. $oldSession = $_SESSION; session_decode('id|i:1;'); var_dump($_SESSION); var_dump($oldSession); Expected result: ---------------- I expect $_SESSION and $oldSession to be different. Actual result: -------------- In PHP 7+, $_SESSION and $oldSession are equal. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73302&edit=1

« previous php.bugs (#204666) next »