Skip to content

feat(zend): add output handlers - #812

Merged
ptondereau merged 3 commits into
masterfrom
feat/output-handler
Oct 10, 2026
Merged

ptondereau merged 3 commits into
masterfrom
feat/output-handler

Conversation

@ptondereau

@ptondereau ptondereau commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Description

Add zend::start_output_handler, a safe wrapper around php_output_handler_create_internal (same API from 8.1 to 8.5) where the closure borrows the buffered bytes without a copy and returns a Cow, and a borrowed start of the input goes back to the engine without a copy. The engine owns every output buffer it gets, so neither a header callback that runs the handler again nor a fatal error swallowed in the closure can leave it with a freed pointer.

Checklist

@codspeed

codspeed Bot commented Oct 9, 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

✅ 45 untouched benchmarks
🆕 6 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 ⚠️ output_passthroughs[1] N/A 23.6 ms N/A
🆕 ⚠️ output_passthroughs[10] N/A 23.6 ms N/A
🆕 ⚠️ output_passthroughs[100000] N/A 155.9 ms N/A
🆕 ⚠️ output_transforms[1] N/A 23.6 ms N/A
🆕 ⚠️ output_transforms[10] N/A 23.6 ms N/A
🆕 ⚠️ output_transforms[100000] N/A 217.6 ms N/A

Comparing feat/output-handler (73154c4) with master (ebdd099)

Open in CodSpeed

@coveralls

coveralls commented Oct 9, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38028300055

Coverage increased (+0.4%) to 74.87%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: 13 uncovered changes across 1 file (228 of 241 lines covered, 94.61%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/zend/output.rs 241 228 94.61%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
crates/introspection/src/stub.rs 1 88.46%

Coverage Stats

Coverage Status
Relevant Lines: 14843
Covered Lines: 11113
Line Coverage: 74.87%
Coverage Strength: 53.31 hits per line

💛 - Coveralls

@ptondereau ptondereau changed the title feat(zend): add zero-copy output handlers feat(zend): add output handlers Oct 9, 2026
@ptondereau
ptondereau force-pushed the feat/output-handler branch from a7d2aa1 to 275ed11 Compare October 9, 2026 22:14
@ptondereau
ptondereau marked this pull request as ready for review October 10, 2026 06:04
@ptondereau
ptondereau merged commit b0fcd58 into master Oct 10, 2026
76 checks passed
@ptondereau
ptondereau deleted the feat/output-handler branch October 10, 2026 06:04
@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