Skip to content

[session] abort strict-mode re-creation when create_sid fails - #286

Open
iliaal wants to merge 1 commit into
PHP-8.4from
fix/session-strict-recreate-abort-84
Open

[session] abort strict-mode re-creation when create_sid fails#286
iliaal wants to merge 1 commit into
PHP-8.4from
fix/session-strict-recreate-abort-84

Conversation

@iliaal

@iliaal iliaal commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Strict-mode session_start(): when validateId() rejected the incoming ID the re-creation branch released PS(id), called s_create_sid(), substituting a fresh internal ID on failure instead of aborting like the primary no-ID branch; a failed fallback left PS(id) NULL and startup skipped s_close(). Recoverable cases ran reset_id()'s Set-Cookie and SID side effects before the pending exception broke s_read(). create_sid() failures are now fatal during strict-mode re-creation; a test asserts no SID artifact survives a failed start, and siblings handle their own errors. Split-out follow-up: #303.

When a save handler rejects the session ID in strict mode, the
re-created ID must be non-NULL or initialization must fail; previously a
failing s_create_sid() was silently papered over by generating a fresh
internal ID and continuing, running reset_id() side effects (Set-Cookie,
SID constant) for a session that then failed to start, and proceeding
with a NULL PS(id) if the fallback generation also failed. Mirror the
primary no-ID branch's abort/error handling; sibling call sites audited:
session_regenerate_id() collision loop and session_create_id() already
NULL-check with their own error paths, mod_mm's strict re-create returns
FAILURE into the initialize abort path.
@iliaal
iliaal force-pushed the fix/session-strict-recreate-abort-84 branch from e3743b9 to 51966ff Compare August 26, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant