[GIT-PULLS] [php-src] PR #22923: ext/session: report a rejected session cookie header

[email protected] (iliaal) Wed, 29 Jul 2026 18:01:06 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/22923
Author: iliaal

`php_session_send_cookie()` dropped the result of `sapi_add_header_ex()` and always returned SUCCESS. When the SAPI refuses a Set-Cookie header containing CR or LF, the warning it emits can reach a userland error handler, and if that handler calls `session_destroy()` then `php_session_reset_id()` carries on and appends the released PS(id).

Reproducer is a `set_error_handler()` that destroys the session, `session_set_cookie_params(['path' => "/\r\nX: y"])`, then `session_start()`: SIGSEGV on 8.4, 8.5 and master, under both CLI and CGI. php_session_reset_id() has handled a FAILURE from the cookie call since 8.4; it just never saw one.