Bug #73302 [NEW]: Copy-On-Write on $_SESSION fails with session_decode
From: d dot negrier at thecodingmachine dot com
Operating system: Ubuntu
PHP version: 7.1.0RC3
Package: Session related
Bug Type: Bug
Bug description:Copy-On-Write on $_SESSION fails with session_decode
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 bug report at https://bugs.php.net/bug.php?id=73302&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73302&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73302&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73302&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73302&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73302&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73302&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73302&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73302&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73302&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73302&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73302&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73302&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73302&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73302&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73302&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73302&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73302&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73302&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73302&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73302&r=mysqlcfg
Thread (4 messages)
- d dot negrier at thecodingmachine dot com