#38085 [Opn->Bgs]: session_regenerate_id() clashes with session.save_path
| From: | iliaa@php.net | Date: | Thu, 13 Jul 2006 13:45:58 +0000 |
| Subject: | #38085 [Opn->Bgs]: session_regenerate_id() clashes with session.save_path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99410@lists.php.net to get a copy of this message | ||
ID: 38085
Updated by: iliaa@php.net
Reported By: ralph at smashlabs dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux 2.6 series
PHP Version: 5.1.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The bottom line is that you should not use relative paths as
they can be affected by internal directory change. Therefor
throwing you out of the expected directory path resulting in
the errors you've encountered.
Previous Comments:
------------------------------------------------------------------------
[2006-07-13 05:43:30] ralph at smashlabs dot com
Thanks for the quick response.
For both 5.1.4 and 5.2 that script works fine if I use a full path from
root, eg: /home/ralph/dev/application/var/sessions
(including with a trailing slash too).
In both 5.1.4 and 5.2 the problem persists when you use a relative
path.
Can you not reproduce this? Shall I post some INI info?
While not super high priority, in a bootstrapped type framework based
envoirment, it would be nice to be able to use relative paths for
portablity reasons.
Thanks again.
Ralph
------------------------------------------------------------------------
[2006-07-13 00:03:05] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Works fine in latest cvs, even with 10 runs.
Have you tried changing ../application/var/sessions to a full
path?
------------------------------------------------------------------------
[2006-07-12 21:59:44] ralph at smashlabs dot com
Description:
------------
I have not dug super deep into this problem but it seems as though if I
try to call session_regenerate_id() after having set session.save_path
with custom values, i get an error. My guess is that
session_regenerate_id() is having issues with the save_path var. See
rest below:
Reproduce code:
---------------
This is my test script:
file: ../htdocs/test.php
<?
ini_set("session.save_path", ";666;../application/var/sessions");
session_start();
$id_before = session_id();
if ((++$_SESSION['counter'] % 5) == 0)
{
session_regenerate_id(true);
}
echo "<pre>SESSION ID BEFORE: " . $id_before . "\n";
echo "SESSION ID AFTER : " . session_id();
echo "COUNTER : " . $_SESSION['counter'];
?>
Expected result:
----------------
The first 5 times it runs, it works fine... which means the file was
created with the proper permissions and at the proper location.
On the 5th run, I should not see any errors. Only the before and after
Session ID AND there should be a file in the directory with the old
session data... Counter should never start over.
Actual result:
--------------
SESSION ID BEFORE: 1e1469055dd81c95fb78aafde667639a
SESSION ID AFTER : a51b257a22da32065a0bef114abac7c7
COUNTER : 5
Warning: Unknown:
open(../application/var/sessions/sess_a51b257a22da32065a0bef114abac7c7,
O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify
that the current setting of session.save_path is correct
(;666;../application/var/sessions) in Unknown on line 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38085&edit=1