Skip to content

fix(headers): preserve PHP 8.3 compatibility without mbstring - #14

Merged
coisa merged 1 commit into
mainfrom
fix/php83-header-runtime
Oct 21, 2026
Merged

coisa merged 1 commit into
mainfrom
fix/php83-header-runtime

Conversation

@coisa

@coisa coisa commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #9.

  • Preserve the declared PHP ^8.3 contract without adding an extension/polyfill dependency.
  • Replace every mb_* use in the five affected header helpers with byte-safe ASCII operations: trim only HTTP OWS (SP/HTAB), and lowercase only the same token inputs already normalized.
  • Preserve credential value case and non-ASCII bytes; quoted Digest values remove only surrounding quotes.
  • Add a standalone consumer regression fixture, PHPUnit subprocess wrapper, patch changelog fragment and aligned consumer guidance.

HTTP OWS is defined by RFC 9110 §5.6.3; strtolower is locale-independent ASCII-only since PHP 8.2. This intentionally stops treating NBSP/other Unicode whitespace as HTTP OWS. It is not a generic Unicode mb_trim replacement.

Validation

  • RED: before source changes, all 7 fixture checks failed with undefined mb_trim when mb_trim/mb_strtolower were disabled on PHP 8.4.26.
  • GREEN: all 7 checks pass after the change, including PHP -n with those functions disabled. No development autoloader is loaded; covers Accept, charset, encoding, Transfer-Encoding, Digest and AWS, plus NBSP/obs-text/value case preservation.
  • Header suite + wrapper using available PHPUnit 12.5.38 and existing PSR source fixtures: 108 tests, 155 assertions, no failures/errors; 8 pre-existing PHPUnit notices for AuthorizationTest request mocks without expectations.
  • Broader test attempt using existing PSR/Nyholm source fixtures: 183 tests, 280 assertions; 1 environment error in ConsumerSkillTest::testBundledConsumerIntegration because Symfony Process is unavailable; the same 8 mock notices.
  • composer validate --strict, PHP lint of src/tests and git diff --check passed.
  • Independent review completed; no blocking findings.

Limits / remaining validation

  • PHP 8.3 itself was NOT available. Disabling functions on PHP 8.4 reproduces the missing-function condition but is not a real 8.3 run.
  • composer dev-tools could not run (dev-tools missing, exit 127). Earlier dependency installation was blocked by network policy; no retry or alternate download route was attempted.
  • Run the real PHP 8.3 no-dev consumer check when the normal environment is available:
    composer install --no-dev
    php tests/fixtures/header-runtime.php ./vendor/autoload.php
  • Run the standard full development suite before merge. Self-hosted CI is intentionally not retried while the maintainer's Mac is offline.
  • This only addresses fix(compatibility): remove undeclared PHP 8.4 mb_trim dependency from PHP 8.3 runtime #9, not the separate negotiation/auth-scheme/response findings, and does not claim complete protocol conformance.
  • No merge, release or deployment.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 33091285-ebce-4195-bf95-fd938d38ee5d
📥 Commits

Reviewing files that changed from the base of the PR and between a429fbe and fdf058a.

📒 Files selected for processing: 9
  • .changelog/php83-header-runtime.md
  • resources/skills/fast-forward-http-message/SKILL.md
  • src/Header/Accept.php
  • src/Header/Authorization.php
  • src/Header/ContentEncoding.php
  • src/Header/ContentType.php
  • src/Header/TransferEncoding.php
  • tests/HeaderRuntimeCompatibilityTest.php
  • tests/fixtures/header-runtime.php
+------------------------------+
| Carpe Debug. Seize the bugs. |
+------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown
Contributor

Changelog

✅ Contribution check passed.

Head: fdf058a91e537d5a6098ac392e9c0048dec244a9

Base: a429fbe9a7efce6cee50b82e4a981ea7e3b47a5f

Contribution: 1 new valid fragment(s). Policy: ordinary.

  • php83-header-runtime.md — fixed, patch

    Keep header helpers compatible with PHP 8.3 without mbstring or development polyfills, using ASCII HTTP whitespace and token case folding while preserving credential values.

@coisa
coisa marked this pull request as ready for review October 21, 2026 17:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T17:27:51.337332Z fdf058a Draft marked ready
🔒 Security Review ✅ Completed 2026-10-21T17:30:21.905266Z fdf058a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coisa
coisa merged commit 58b7be8 into main Oct 21, 2026
49 of 50 checks passed
@coisa
coisa deleted the fix/php83-header-runtime branch October 21, 2026 17:32
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.

fix(compatibility): remove undeclared PHP 8.4 mb_trim dependency from PHP 8.3 runtime

1 participant