Skip to content

feat(zend): add a per-request sapi activate hook - #816

Merged
ptondereau merged 2 commits into
masterfrom
feat/sapi-activate-hook
Oct 10, 2026
Merged

ptondereau merged 2 commits into
masterfrom
feat/sapi-activate-hook

Conversation

@ptondereau

Copy link
Copy Markdown
Member

Description

Add ModuleBuilder::sapi_activate_function, which chains sapi_module.activate so a closure gets a copy of the request info at the start of every request, including each FrankenPHP worker request where RINIT does not run again, and can call set_header from there. The hook goes in last at MINIT and is skipped when the user startup fails, comes back out at MSHUTDOWN when it is still the current one, and is refused for dl() modules, which PHP unloads while the SAPI would keep the pointer.

Checklist

@coveralls

coveralls commented Oct 10, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38053984402

Coverage increased (+0.3%) to 75.334%

Details

  • Coverage increased (+0.3%) from the base build.
  • Patch coverage: 10 uncovered changes across 1 file (107 of 117 lines covered, 91.45%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/zend/sapi_activate.rs 107 97 90.65%
Total (2 files) 117 107 91.45%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15057
Covered Lines: 11343
Line Coverage: 75.33%
Coverage Strength: 52.88 hits per line

💛 - Coveralls

@codspeed

codspeed Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 51 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 51 untouched benchmarks


Comparing feat/sapi-activate-hook (bf29769) with master (6fcc59b)

Open in CodSpeed

@ptondereau
ptondereau marked this pull request as ready for review October 10, 2026 13:18
@ptondereau
ptondereau merged commit ff909ac into master Oct 10, 2026
76 checks passed
@ptondereau
ptondereau deleted the feat/sapi-activate-hook branch October 10, 2026 13:19
@ext-php-rs-release ext-php-rs-release Bot mentioned this pull request Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants