docs: improve worker docs, and add internals docs#2334
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the FrankenPHP worker documentation to better describe what state does (and doesn’t) get reset between requests in worker mode, helping users avoid cross-request data leakage and unexpected behavior.
Changes:
- Documented that most PHP superglobals are reset between requests, while
$_ENVis not. - Added a “State Persistence” section explaining which PHP state persists across requests, with an example.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
alexandre-daubois
left a comment
There was a problem hiding this comment.
Works for me once Superlinter is happy 🙂
| ``` | ||
|
|
||
| When writing worker scripts, make sure to reset any request-specific state at the beginning of each request handler. | ||
| Frameworks like [Symfony](symfony.md) and [Laravel Octane](laravel.md) handle this automatically. |
There was a problem hiding this comment.
isnt it necessary to implement the symfony/contracts ResetInterface so that the framework automatically reset such object state inside worker apps ?
imho, this sentence should describe this, as reading "automatically" can be understood as nothing to do when using such framework
wdyt?
There was a problem hiding this comment.
Agreed, I think it's also at the end of each request after sending the response.
No description provided.