php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37510 session_regenerate_id changes session_id() even on failure
Submitted: 2006-05-18 20:19 UTC Modified: 2006-05-18 22:18 UTC
From: dabrfe at gmail dot com Assigned: bjori (profile)
Status: Closed Package: Session related
PHP Version: 4.4.2 OS: ?
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dabrfe at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-18 20:19 UTC] dabrfe at gmail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-18 22:18 UTC] bjori@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC