[php-src] Issue #23061: SessionHandler::create_sid() callback failure leaks memory in debug build

[email protected] (arshidkv12)
Newsgroups php.bugs
Message-ID <[email protected]>
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_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.