Hi
On 11/9/26 15:24, Kévin Dunglas wrote:
Following the recent pre-RFC discussion
(https://news-web.php.net/php.internals/132960), I would like to open
the discussion on the "Request lifecycle hooks for SAPIs with a worker
mode" RFC:
https://wiki.php.net/rfc/request_lifecycle_hooks
Thank you for your RFC. I have a few remarks:
1. I want to point out this PR from Arnaud, it seems related to this
RFC: https://github.com/php/php-src/pull/25610 (I also DM'd Arnaud for
him to comment himself).
2. In the “Engine Functions” section:
Releasing the request body takes two small changes: php://input streams hold a
reference to the body, and freeing the body, for instance when the script
closes it, clears SG(request_info).request_body.
From this statement it is not clear to me what happens when a script
holds an open `php://input` stream resource across a REND + RBEGIN
boundary. Will the existing resource return EOF after that? Will it
silently hold data from the next request? This should be spelled out
more explicitly.
3. I wonder if the initial “userland bootstrap” request should also get
a RBEGIN call directly after RINIT. Is there a reason this is not done?
This would also resolve the point that Florian mentioned. From what I
understand, extensions would currently need to duplicate some of the
set-up logic between RINIT and RBEGIN (or call their own RBEGIN from RINIT).
For `session.auto_start` in particular it would be quite nice to move
that into `RBEGIN` only. If I remember correctly, `php -l` creates
sessions if `session.auto_start` is enabled. This is at minimum
surprising. Similarly for Tideways I need to jump through some hoops to
exclude requests that don't actually execute code (including preloading
in FPM) to prevent empty traces from being created for them. If I could
switch to RBEGIN this would make things easier, I would hope.
4. I don't think the RFC Impact and BC incompatible changes sections are
fully accurate as written. If *other* extensions (including built-in
extensions) make use of the new hooks and move code from RINIT to RBEGIN
than extensions that remain RINIT-only might miss some information from
the structures that they've previously relied on. Similarly if
extensions rely on RBEGIN to work correctly, they will will break for
SAPIs that don't call RBEGIN.
Best regards
Tim Düsterhus