|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-09-17 14:53 UTC] hpdl at oscommerce dot com
Description: ------------ session_regenerate_id() ignores a defined session path (via session_save_path()) and uses the windows\temp directory instead. Did not occur in earlier RC releases. Test script: --------------- session_regenerate_id(); Expected result: ---------------- true Actual result: -------------- session_regenerate_id(): Failed to create session ID: user (path: C:\WINDOWS\Temp\) in C:\Users\blahblah\blah.php PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 18:00:01 2025 UTC |
Seems to be working for me. <?php session_save_path("."); session_start(); $sid1 = session_id(); $exists1 = file_exists("./sess_{$sid1}"); session_regenerate_id(); $sid2 = session_id(); $exists2 = file_exists("./sess_{$sid2}"); var_dump($exists1); // true var_dump($sid1 != $sid2); // true var_dump($exists2); // true ?> What's your test script? Can you dump session_save_path() before the session_regenerate_id() to make sure it's set appropriately?I tried it with a session_save_path(".") immediately before the session_start(). CWD was a local directory, and when I ran the code I posted earlier (in the same location) it worked correctly.Found what's wrong. Current session save handler expects session read function returns STRING type when there is no error. However, the code public function read($id) { $data = parent::read($id); return @mcrypt_decrypt(MCRYPT_3DES, $this->key, $data, MCRYPT_MODE_ECB); } returns non string because $this->key is not valid key length. Apparently, the document has wrong size of key which results mcrypt_decrypt() error. This makes fail to write session data. Making documentation problem.