WS010 · Shutdown/runtime lifecycle assumption
Default severity: LOW · Framework: Any
What it checks
Section titled “What it checks”Under PHP-FPM the PHP request lifecycle ends after every request — the engine tears down the request context even though the OS worker process is reused — which makes shutdown hooks, exit() and SAPI checks behave in one specific way. An application worker loop keeps one PHP context alive across many requests, so the same code means something different.
What to review
Section titled “What to review”- Do the cleanup where the request ends (terminating middleware, a request-lifecycle listener) instead of at process shutdown.
- Return a response instead of calling exit()/die() so the worker can finish the request loop.
- Do not branch on the SAPI name: check for the capability you actually need.
Inspect this rule
Section titled “Inspect this rule”vendor/bin/worker-safety rules WS010Accepting a reviewed risk
Section titled “Accepting a reviewed risk”Use a targeted suppression or a baseline only after reviewing the value’s origin and lifetime. Changing an assignment elsewhere may not invalidate an existing property-level suppression.