ID:               33814
 Updated by:       [EMAIL PROTECTED]
 Reported By:      d43m0n at shaw dot ca
-Status:           Open
+Status:           Bogus
 Bug Type:         Session related
 Operating System: Windows
 PHP Version:      5.0.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

PHP opens a session file at the start of your script, and Windows does
not allow you to unlink an opened file, which is perfectly fine to do
on Unices. If you use session_write_close() before the unlink it will
work, as that function stops the session during a script.


Previous Comments:
------------------------------------------------------------------------

[2005-07-22 06:44:45] d43m0n at shaw dot ca

Description:
------------
Hello,

In short, while a session is in progress, or running, we are not able
to remove sess_* files by using unlink(). Yet, when a session is not
active, I can remove all the files freely. There is nothing about this
in the documentation, and there seems to be this issue all over forums
searched from google. I feel this is a bug, as PHP should deny removing
files while a session is active.

The following produces this error "Warning:
unlink(./tmp/sess_2b8185697c7b9d826773403c1477041f) [function.unlink]:
Permission denied in X:\path\to\script.php on line 0"

<?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();
  unlink('./tmp/' . $_SESSION['sid']['obsolete'])
  print_r($_SESSION);
?>

As well, the garbage collection doesnt seem to be working, all I see is
my sessions keep piling up since I have my script regenerate an id, thus
create a new file in my defined tmp directory. If
session_set_cookie_params worked properally, I would beable to define
both id's thus to say I could unlink the file with
$_COOKIE['sid']['obsolete'].

As well, as I read apon session_regenerate_id() its suppose to remove
the file apon complition... well, in short, its not!



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33814&edit=1

Reply via email to