php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33744 Concerning ini_set session.save_path & reregistering an id under windows.
Submitted: 2005-07-18 11:05 UTC Modified: 2005-07-26 01:00 UTC
Votes:5
Avg. Score:4.6 ± 0.5
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:3 (60.0%)
From: d43m0n at shaw dot ca Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.0.4 OS: win32 & linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: d43m0n at shaw dot ca
New email:
PHP Version: OS:

 

 [2005-07-18 11:05 UTC] d43m0n at shaw dot ca
Description:
------------
Hello,

While developing a new security fix for a script I am working on, I found this issue corrisponding with Windows 2000 NT, which causes the sessions to not reregister a id if the ini_set redefines teh session.save_path to a relitive location.

The following code when used in the windows environment will cause the error which follows:

[CODE]<?php
  define("_PATH_TMP", "./tmp");
  ini_set('session.save_path', _PATH_TMP);
  session_start(); 
  $_SESSION['sid']['obsolete'] = session_id();
  session_regenerate_id();
  $_SESSION['sid']['replaced'] = session_id();
?>
[/CODE]

[ERROR]Warning: Unknown: open(./tmp\sess_3c0fe03c61bac80ca57a1193d3e54aa8, 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 (./tmp) in Unknown on line 0
[/ERROR]

Of course I have takin the proper precautions to be sure the directory existed in the first place... of course, if I dont re-define the the session.save_path, and use the default, it gets created secessfully, like as follows:

[CODE]
<?php
  session_start(); 
  $_SESSION['sid']['obsolete'] = session_id();
  session_regenerate_id();
  $_SESSION['sid']['replaced'] = session_id();
  print_r($_SESSION);
?>
[/CODE]

Now, ill take it another step further, I tried using an exact file location when I defined the session.save_path like so:

[CODE]
<?php
  define("_PATH_TMP", "X:/dir/to/my/tmp");
  ini_set('session.save_path', _PATH_TMP);
  session_start(); 
  $_SESSION['sid']['obsolete'] = session_id();
  session_regenerate_id();
  $_SESSION['sid']['replaced'] = session_id();
  print_r($_SESSION);
?>
[/CODE]

Of course this prooved successful, except for the obvious change of my directory location to my tmp...

Now I did have a chance to try out the same script on a Linux OS with PHP and had no troubles with ./tmp as the tmp directory, so like really, wtf is the problem?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-18 18:43 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-07-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-07-18 15:13 UTC] f dot hardy at origami-systems dot com
I have the same issue under windows XP Pro and php 5.1.4.
 [2006-07-18 15:17 UTC] f dot hardy at origami-systems dot com
Sorry, i have ommited an important informations :
I am ussing session_save_path() instead of ini_set().
 [2007-08-15 06:07 UTC] anubas at hotmail dot com
Still a bug as of PHP 5.2.3. Using a full path for the session.save_path value in place of a relative one clears up the error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 01:01:28 2024 UTC