From 63e2cc27e248c330b054862c8d6cbf4055910407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 26 Oct 2026 11:51:15 +0100 Subject: [PATCH] docs: list umask() and setlocale() as process-wide worker state --- docs/worker.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/worker.md b/docs/worker.md index d97c551e12..1b6c86a225 100644 --- a/docs/worker.md +++ b/docs/worker.md @@ -243,6 +243,7 @@ Because worker mode keeps the PHP process alive between requests, the following - **Global variables**: Variables in the global scope of the worker script persist between requests. - **In-memory caches**: Any data stored in memory (arrays, objects) outside the request handler persists. - **Runtime engine settings**: Changes made with `ini_set()`, `stream_context_set_default()`, `date_default_timezone_set()`, `chdir()`, `stream_wrapper_register()`, `set_error_handler()` or `set_exception_handler()` stay in effect for later requests. Never store request- or user-specific values there, such as credentials in the default stream context: pass an explicit context to each call instead. +- **Process-wide settings**: `umask()` and `setlocale()` change the whole FrankenPHP process, not only the current thread. Worker mode doesn't restore them between requests, and in every mode they also affect requests running at the same time. Set them once at startup, or call `chmod()` on created files instead of changing the umask. This is by design and is what makes worker mode fast. However, it requires attention to avoid unintended side effects: