Re: PHP 4.0 Bug #7235: session_destroy() still does not unlink session object
| From: | Taavi Tiirik | Date: | Mon, 16 Oct 2000 18:14:11 +0000 |
| Subject: | Re: PHP 4.0 Bug #7235: session_destroy() still does not unlink session object | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-35170@lists.php.net to get a copy of this message | ||
On Mon, 16 Oct 2000, Sascha Schumann wrote:
> On 16 Oct 2000 taavi@ibs.ee wrote:
>
> > From: taavi@ibs.ee
> > Operating system: Windows2000
> > PHP version: 4.0.3pl1
> > PHP Bug Type: *Session related
> > Bug description: session_destroy() still does not unlink session object
> >
> > Session_destroy() does not unlink session object.
> > Instead I get warning message stating:
> > "Session object destruction failed".
> >
> > There is an open bug report #7055 for ver. 4.0.2 suggesting to add:
> > if (data->fd > -1) {
> > close(data->fd);
> > data->fd = -1;
> > }
> > before V_UNLINK(buf).
> >
> > Does it help? If yes, would it be worth to add
> > this into next binary release? When?
>
> We can evaluate adding a workaround, if someone verifies that
> Windows is unable to unlink a file which is still opened by a
> process.
>
> - Sascha
Yes. It seems so that it is possible to unlink session object
just after calling session_destroy().
The following code still gives an error message but these
can be logged to file:
// read session information
session_start();
// remember session object file name
$session_save_path = ini_get( "session.save_path" );
$session_file_name = "sess_" . session_id();
$session_save_path = str_replace( "/", "\\", $session_save_path );
// session_destroy does not unlink the file but it seems to
// close it...
session_destroy();
// ... so it can be unlinked later
unlink( "$session_save_path/$session_file_name" );
regards,
Taavi