[php-src] PR #25610: Reset request-scoped globals systematically
| From: | arnaud-lb | Date: | Thu, 19 Nov 2026 19:11:50 +0000 |
| Subject: | [php-src] PR #25610: Reset request-scoped globals systematically | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40832@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25610
Author: arnaud-lb
memset() module globals whose value is not supposed to survive across requests. We
normally do this in GINIT() / RINIT() / RSHUTDOWN(), but this
is error prone. Doing it systematically avoids any mistake. This is also done earlier compared to
RINIT().
This is done just after shutdown_memory_manager(), which is the point at which any request-scoped
allocations become invalid.
Those globals use the same accessor as the non-persistent ones (e.g. PS() for session
globals), but later we could split them completely and maybe use pkeys/mprotect to prevent access
outside of request_startup/request_shutdown for CI/debugging.
This changes only ext/zend_test and ext/session, but the goal would be to update all globals.
Also zero globals before GINIT() for the same reasons.
Follow-ups would be:
* Update remaining globals
* Move RINIT() earlier
* Move SAPI per-dir settings later