#33744 [NEW]: Concerning ini_set session.save_path & reregistering an id under windows.

From: Date: Mon, 18 Jul 2005 09:05:47 +0000
Subject: #33744 [NEW]: Concerning ini_set session.save_path & reregistering an id under windows.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82023@lists.php.net to get a copy of this message
From:             d43m0n at shaw dot ca
Operating system: win32 & linux
PHP version:      5.0.4
PHP Bug Type:     Session related
Bug description:  Concerning ini_set session.save_path & reregistering an id under windows.

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?


-- 
Edit bug report at http://bugs.php.net/?id=33744&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33744&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33744&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33744&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33744&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33744&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33744&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33744&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33744&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33744&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33744&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=33744&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=33744&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33744&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33744&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33744&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33744&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33744&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33744&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33744&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33744&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#82023) next »