[php-src] Issue #16027: Using `SessionHandler` doesn't always close session file
| From: | cs278 | Date: | Tue, 24 Sep 2024 15:42:20 +0000 |
| Subject: | [php-src] Issue #16027: Using `SessionHandler` doesn't always close session file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247878@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/16027
Author: cs278
### Description
The following code:
```php
<?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: 88f32f48e2b6e7fd3554aef8d255f88d02a4e8db
### PHP Version
8.3.11 and 8.3.13-dev
### Operating System
Debian/Ubuntu