Skip to content

Fix: per-request singleton state leakage in worker mode#275

Merged
techmahedy merged 1 commit into
doppar:3.xfrom
techmahedy:techmahedy-3.x
May 6, 2026
Merged

Fix: per-request singleton state leakage in worker mode#275
techmahedy merged 1 commit into
doppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Copy Markdown
Member

In worker mode, the PHP process stays alive across requests. The DI container stores resolved singletons in private static array $instances, which is never cleared between requests. This means it may leak user-specific state from Request 1 into Request 2.

This is invisible in development (spawns a fresh process per request) and only surfaces under real concurrent traffic in worker mode — making it a silent production security issue.

Does this break anything

No existing behaviour changes in PHP-FPM mode — processes reset between requests naturally, so the terminating callback runs but nulling already-null instances is a no-op

@techmahedy techmahedy merged commit dd9de2a into doppar:3.x May 6, 2026
27 checks passed
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