Skip to content

Using SessionHandler doesn't always close session file #16027

Open
@cs278

Description

@cs278

Description

The following code:

<?php

session_set_save_handler(new \SessionHandler, true);

session_start([
    'save_path' => __DIR__,
]);

$_SESSION['test'] = function () {};

If you make a request to this you'll see a fatal error due to the serialization failing, if you try and make another request the file is still locked and the request hangs waiting for the lock to be released. Removing the session_set_save_handler() is sufficient to fix the problem. From what I can tell ps_close_user is called but it never appears to make the call to SessionHandler::close().

I've managed to replicate this behaviour on FPM (ZTS and NTS) and CLI server.

I've written a test: 88f32f4

PHP Version

8.3.11 and 8.3.13-dev

Operating System

Debian/Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions