|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-09-29 10:59 UTC] matty at mattyasia dot com
[2011-09-29 14:10 UTC] jason dot gerfen at gmail dot com
[2011-10-03 15:09 UTC] iliaa@php.net
-Status: Open
+Status: Bogus
[2011-10-03 15:09 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
Description: ------------ I am not sure if this is a bug or a feature in terms of limits due to a test case exceeding internal limits. Scenario #1. Using session_regenerate_id() over 39 times results in the following errors: Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent Scenario #2. Using session_regenerate_id() over 19 times results in the following errors: Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent; when the following parameters are modified: ini_set("session.entropy_file", "/dev/urandom"); ini_set("session.entropy_length", "512"); ini_set("session.hash_function", "sha512"); Test script: --------------- session_start(); function _regenIDdef($old){ session_regenerate_id(true); $_SESSION = $old; } function _prettyPrint($id, $i){ echo sprintf('Iteration: %d : ID: %s => Length: %d<br/>', $i, $id, strlen((string)$id)); } function _collide($array){ $x=0; foreach($array as $k => $v){ if (count(in_array($v, $array))>1){ $x = $x++; echo sprintf('Collision found at %d session id %s<br/>', $k, $v); } } echo sprintf('Total collisions found %d<br/>', $x); } function _loop($id, $int){ $a = array(); for($i=0; $i<$int; $i++){ _regenIDdef($id); _prettyPrint(session_id(), $i); $a[$i]=session_id(); } _collide($a); } echo '<b>Testing with PHP defaults</b><br/>'; _loop(session_id(), 40, 'a'); echo '<b>Testing with /dev/urandom & entropy 32</b><br/>'; ini_set("session.entropy_file", "/dev/urandom"); ini_set("session.entropy_length", "512"); ini_set("session.hash_function", "sha512"); _loop(session_id(), 20, 'a'); ?> Expected result: ---------------- No errors returning about not being able to regenerate a new session_id Actual result: -------------- Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent