Skip to content

SessionHandler::create_sid() callback failure leaks memory in debug build #23061

Description

@arshidkv12

Description

The following code:

<?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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions