# [RFC karma request] Scope: per-request state (superglobals, locale, timezone) for long-running and async PHP

- Thread: https://externals.io/message/132880
- Original archive: https://news-web.php.net/php.internals/132880
- Started by frode@ennerd.com on 2026-10-19T13:24:59+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #132880 — frode@ennerd.com — 2026-10-19T13:24:59+00:00

URL: https://externals.io/message/132880#132880

Hi internals,

Every long-running PHP server (Swoole, RoadRunner, FrankenPHP, phasync, and anything built on fibers) hits the same wall: $_GET, $_POST, $_COOKIE, $_FILES, the default timezone and locale are process-wide, so serving two requests at once means rewriting them behind the application’s back or forbidding their use. The Scope RFC proposes the missing piece: a small class that identifies the logical operation running code belongs to (a request, a job) and keeps that identity across fibers and generators; two secondary votes let the five request superglobals and the default timezone/locale follow the scope, so unmodified code sees its own request.

I’d like RFC karma for my wiki account, frodeborli. I’ve already submitted a karma request a few days ago so this is a nudge with some more details to show I’ve done real work on this RFC.

The draft (version 0.7, target 8.7) is readable here while it waits for the wiki: https://fiber-interop.github.io/rfc-scope.html. It comes with a reference implementation released today as a PIE extension for PHP 8.2–8.5, fiber-interop/ext-scope 0.3.0 (https://github.com/fiber-interop/ext-scope), implementing the class and both secondary votes with phpt tests, and a userland polyfill with the same tests (fiber-interop/scope 0.3.0). It is in use by several event loops through the fiber-interop adapters, which is where the semantics were worked out and measured.

I intend to publish the draft under https://wiki.php.net/rfc/scope and open discussion here once it’s up. Some of you may remember me from the `stream_select()` FD_SETSIZE work (php-src #14452).

Thanks,
Frode Børli
