#33814 [NEW]: Remove sess_* files while session_start(); is active
| From: | d43m0n at shaw dot ca | Date: | Fri, 22 Jul 2005 04:44:46 +0000 |
| Subject: | #33814 [NEW]: Remove sess_* files while session_start(); is active | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-82307@lists.php.net to get a copy of this message | ||
From: d43m0n at shaw dot ca
Operating system: Windows
PHP version: 5.0.4
PHP Bug Type: Session related
Bug description: Remove sess_* files while session_start(); is active
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 bug report at http://bugs.php.net/?id=33814&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33814&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33814&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33814&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33814&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33814&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33814&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33814&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33814&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33814&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33814&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33814&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33814&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33814&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33814&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33814&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33814&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33814&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33814&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33814&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33814&r=mysqlcfg