[GIT-PULLS] [php-src] PR #23064: Fix GH-23061: SessionHandler::create_sid() failure leaks memory in debug build
[email protected] (lazerg)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
Pull Request: https://github.com/php/php-src/pull/23064 Author: lazerg When a save handler extending `SessionHandler` throws while the session is starting, `php_session_abort()` calls the user close callback, but `zend_call_function()` refuses to run userland code while an exception is pending. `SessionHandler::close()` therefore never runs, and the default handler that `SessionHandler::open()` opened stays open, so its `mod_data` is never freed. A debug build reports it as two leaks. Since `PS(mod_user_is_open)` already tracks whether the default handler is open, request shutdown can close it when the user handler did not. This also covers a handler that overrides `close()` without calling `parent::close()`, which leaked the same way. Fixes GH-23061