Bug #70013 [NEW]: Reference to $_SESSION is lost after a call to session_regenerate_id()

From: Date: Tue, 07 Jul 2015 23:44:04 +0000
Subject: Bug #70013 [NEW]: Reference to $_SESSION is lost after a call to session_regenerate_id()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194193@lists.php.net to get a copy of this message
From: jakub at zalas dot pl Operating system: Debian PHP version: 7.0Git-2015-07-07 (Git) Package: Session related Bug Type: Bug Bug description:Reference to $_SESSION is lost after a call to session_regenerate_id() Description: ------------ If a reference to $_SESSION is assigned to another variable, it is lost after a call to session_regenerate_id(). It is not lost in previous PHP versions, and Symfony's HttpFoundation actually relies on this behaviour. php -v PHP 7.0.0-dev (cli) (built: Jul 7 2015 22:52:27) (DEBUG) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies Test script: --------------- session_start(); $session = &$_SESSION; $session['test'] = 1; session_regenerate_id(false); $session['test'] = 2; // dumps false, should be true var_dump($session['test'] === $_SESSION['test']); Expected result: ---------------- bool(true) Actual result: -------------- bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=70013&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70013&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70013&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70013&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70013&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70013&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70013&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70013&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70013&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70013&r=support Expected behavior: https://bugs.php.net/fix.php?id=70013&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70013&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70013&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70013&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70013&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70013&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70013&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70013&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70013&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70013&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70013&r=mysqlcfg

« previous php.bugs (#194193) next »