#37510 [NEW]: session_regenerate_id changes session_id() even on failure

From: Date: Thu, 18 May 2006 20:19:46 +0000
Subject: #37510 [NEW]: session_regenerate_id changes session_id() even on failure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97346@lists.php.net to get a copy of this message
From: dabrfe at gmail dot com Operating system: OS X PHP version: 4.4.2 PHP Bug Type: Session related Bug description: session_regenerate_id changes session_id() even on failure Description: ------------ session_regenerate_id will not really work if any output has been sent to the browser because it can't send the header required. However, even if it fails (and issues a warning), the value returned by session_id() is changed and there then is an inconsistency between session_id() and the actual session id. Reproduced in 4.4.2 and 5.1.2 on OS X 10.4.6 (built from source) Reproduced in 4.4.1 on RedHat 9 Does not fail at all (no header warning and session id is correctly changed) in 5.0.3 on OS X 10.4.5 (package from entropy.ch) Reproduce code: --------------- session.php: <% error_reporting(E_ALL); ini_set('display_errors', true); session_name('my_Sess'); session_start(); $orig_id=session_id(); print "orig: $orig_id<br>"; session_regenerate_id(); $new_id=session_id(); print "new: $new_id<br>"; %> <a href="session.php">go again</a> Expected result: ---------------- If regenerate worked: orig: 1234 new: 2345 <click link> orig: 2345 new: 3456 <click link> orig: 3456 new: 4567 <click link> orig: 4567 new: 5678 If regenerate failed: orig: 1234 new: 1234 <click link> orig: 1234 new: 1234 <click link> orig: 1234 new: 1234 <click link> orig: 1234 new: 1234 Actual result: -------------- When regenerate fails w/ header warning: orig: 1234 new: 2345 <click link> orig: 1234 new: 3456 <click link> orig: 1234 new: 4567 <click link> orig: 1234 new: 5678 -- Edit bug report at http://bugs.php.net/?id=37510&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37510&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37510&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37510&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37510&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37510&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37510&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37510&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37510&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37510&r=support Expected behavior: http://bugs.php.net/fix.php?id=37510&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37510&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37510&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37510&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37510&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37510&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37510&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37510&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37510&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37510&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37510&r=mysqlcfg

« previous php.bugs (#97346) next »