Skip to content

t808: add autoload-order regression tests for mpdf PSR HTTP message shim#818

Merged
superdav42 merged 1 commit intomainfrom
test/808-mpdf-shim-autoload-regression
Apr 13, 2026
Merged

t808: add autoload-order regression tests for mpdf PSR HTTP message shim#818
superdav42 merged 1 commit intomainfrom
test/808-mpdf-shim-autoload-regression

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

  • Adds MpdfPsrHttpMessageShim_Test (42 tests / 85 assertions) covering all four shim classes: Request, Response, Stream, Uri
  • Verifies via reflection that each public PSR-7 method has an explicit return type declaration — the absence of which causes PHP fatals when psr/http-message v2 is autoloaded before the shim
  • Verifies instantiation behaviour (getMethod() → string, getStatusCode() → int, getSize() → ?int, getPort() → ?int)

Context

PR #782 added return type declarations to the mpdf shim via patches/mpdf-psr-http-message-shim-php8-compat.patch. Without those declarations, loading plugin-check (which bundles psr/http-message v2 with return types on interface methods) before the shim causes:

PHP Fatal error: Declaration of Mpdf\PsrHttpMessageShim\Request::getMethod() must be
compatible with Psr\Http\Message\RequestInterface::getMethod(): string

CodeRabbit flagged the absence of a regression test in its review of PR #782 (issue #808).

What was verified

WP_TESTS_DIR=/tmp/wordpress-tests-lib vendor/bin/phpunit --filter MpdfPsrHttpMessageShim_Test --no-coverage
# OK (42 tests, 85 assertions)

Patch was confirmed fully applied after composer reinstall mpdf/psr-http-message-shim (the vendor directory had stale state from the pre-#782 patch).

Files

  • NEW: tests/WP_Ultimo/MpdfPsrHttpMessageShim_Test.php — 42 reflection + behavioural tests

Resolves #808


aidevops.sh v3.8.6 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 8m and 24,795 tokens on this as a headless worker.

Adds MpdfPsrHttpMessageShim_Test covering all four shim classes
(Request, Response, Stream, Uri) to prevent future regressions where
the mpdf-psr-http-message-shim-php8-compat.patch is reverted or only
partially applied.

The tests verify via reflection that each public PSR-7 method has an
explicit return type declaration, which is required for compatibility
when psr/http-message v2 interfaces (bundled by plugin-check and others)
are loaded before the shim classes.

Addresses CodeRabbit review feedback on PR #782.
Resolves #808
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 56 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 56 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 090ae046-f81a-4295-aad6-eb4fae9ad2ac

📥 Commits

Reviewing files that changed from the base of the PR and between 61a0a35 and 0af5c5a.

📒 Files selected for processing (1)
  • tests/WP_Ultimo/MpdfPsrHttpMessageShim_Test.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/808-mpdf-shim-autoload-regression

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42
Copy link
Copy Markdown
Collaborator Author

Completion Summary

  • What: Added MpdfPsrHttpMessageShim_Test (42 tests / 85 assertions) verifying all four mpdf PSR-7 shim classes have correct return type declarations — prevents regression of the PHP fatal fixed in PR fix: mpdf psr-http-message-shim v2 compatibility #782
  • Issue: Review followup: PR #782 — fix: mpdf psr-http-message-shim v2 compatibility #808
  • Files changed: tests/WP_Ultimo/MpdfPsrHttpMessageShim_Test.php (new file)
  • Testing: 42 tests, 85 assertions; reflection-based checks that public PSR-7 methods have explicit return types; low risk — test-only addition
  • Key decisions: Uses reflection rather than catching live fatals; covers all four shim classes (Request, Response, Stream, Uri)

aidevops.sh v3.8.6 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 2m and ~8,000 tokens on this as a headless worker.

@superdav42 superdav42 merged commit 57568b3 into main Apr 13, 2026
11 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Completion Summary

  • What: Added MpdfPsrHttpMessageShim_Test (42 tests / 85 assertions) verifying all four mpdf PSR-7 shim classes have correct return type declarations — prevents regression of the PHP fatal fixed in PR fix: mpdf psr-http-message-shim v2 compatibility #782
  • Issue: Review followup: PR #782 — fix: mpdf psr-http-message-shim v2 compatibility #808
  • Files changed: tests/WP_Ultimo/MpdfPsrHttpMessageShim_Test.php (new file)
  • Testing: 42 tests, 85 assertions; reflection-based checks that public PSR-7 methods have explicit return types; low risk — test-only addition
  • Key decisions: Uses reflection rather than catching live fatals; covers all four shim classes (Request, Response, Stream, Uri)

aidevops.sh v3.8.6 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 2m and ~8,000 tokens on this as a headless worker.


Merged via PR #818 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for df145d3 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 (+2 / +4% ) 37.73 MB 869.00 ms (+50.00 ms / +6% ) 158.50 ms (-5.50 ms / -3% ) 1058.00 ms (+58.50 ms / +6% ) 2036.00 ms (+80.00 ms / +4% ) 1951.40 ms (+80.20 ms / +4% ) 93.75 ms (+3.95 ms / +4% )
1 56 49.02 MB 959.00 ms (-20.00 ms / -2% ) 152.50 ms 1107.00 ms (-26.00 ms / -2% ) 2078.00 ms (-76.00 ms / -4% ) 1995.90 ms (-75.35 ms / -4% ) 82.95 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review followup: PR #782 — fix: mpdf psr-http-message-shim v2 compatibility

1 participant