[php-src] Issue #23061: SessionHandler::create_sid() callback failure leaks memory in debug build
| From: | arshidkv12 | Date: | Wed, 05 Aug 2026 10:08:54 +0000 |
| Subject: | [php-src] Issue #23061: SessionHandler::create_sid() callback failure leaks memory in debug build | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252538@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23061
Author: arshidkv12
### Description
The following code:
```php
<?php
class a extends SessionHandler {
function create_sid(): string {
return [3,6];
}
}
$c = new a;
session_set_save_handler($c);
session_start();
```
## Actual result
A TypeError is thrown, but the debug build also reports memory leaks, for example:
=== Total 2 memory leaks detected ===
The leaks originate from allocations made by the files session handler (ps_files and its basedir
string).
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Aug 5 2026 15:03:24) (NTS DEBUG)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce
```
### Operating System
_No response_