Skip to content

Add PHP 8.6 support - #192

Merged
samdark merged 4 commits into
masterfrom
php-8.6
Nov 25, 2026
Merged

samdark merged 4 commits into
masterfrom
php-8.6

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Nov 25, 2026 •

Copy link
Copy Markdown
Member
Q A
Is bugfix? ✔️
New feature? ✔️
Breaks BC? ❌
Fixed issues —
  • Allows PHP 8.6 in composer.json and adds 8.6 to the build and dependency analyser matrices.
  • PHP 8.6 dropped the file name from the file() warning prefix (file(): Failed to open stream… instead of file(not-exist): …), so the HtmlRenderer test now expects a version-specific message; renderer behaviour is unchanged.
  • Psalm constraint raised to ^6.21 || ^7.20. Psalm 7 runs taint analysis and found that the cURL block of the HTML debug page printed the command (built from the request or an exception message) unescaped; it is now escaped like the throwable block next to it.
  • The remaining Psalm 7 reports are false positives: ReflectionClass is replaced by ReflectionObject (Psalm took the object for a class-name string), and two statement-level suppressions cover the template closure that reads its arguments via func_get_arg() and the echo of already rendered output in ErrorHandler.
  • Psalm does not support PHP 8.6 yet, so static.yml stays at 8.5; dev dependencies on 8.6 install only with --ignore-platform-req=php.

Summary by Sourcery

Add PHP 8.6 compatibility while securing cURL debug output and maintaining static-analysis support.

New Features:

  • Add PHP 8.6 support across package requirements and compatibility matrices.

Bug Fixes:

  • Escape generated cURL commands in HTML debug output to prevent unsafe markup.

Enhancements:

  • Update Psalm compatibility and address PHP 8.6 and Psalm 7 analysis findings.

CI:

  • Include PHP 8.6 in build and Composer dependency analysis workflows.

Documentation:

  • Update documented PHP requirements to include PHP 8.6.
  • Record PHP 8.6 support and cURL output escaping in the changelog.

Tests:

  • Make renderer error-message expectations compatible with PHP versions before and after PHP 8.6.

test: adapt HtmlRenderer test to PHP 8.6 error message

PHP 8.6 no longer includes the file name in the `file()` warning prefix. Psalm does not support PHP 8.6 yet, so the static analysis matrix stays at 8.5.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@psalm-shepherd

Copy link
Copy Markdown

Psalm found errors in other files

src/ErrorHandler.php:223:9 - Detected tainted HTML
src/ErrorHandler.php:223:9 - Detected tainted text with possible quotes
src/Renderer/HtmlRenderer.php:586:44 - Detected tainted text
src/Renderer/HtmlRenderer.php:705:13 - Too many arguments for callable() - expecting 0 but saw 2
templates/development.php:131:38 - Detected tainted HTML
templates/development.php:131:38 - Detected tainted text with possible quotes
templates/development.php:136:32 - Detected tainted HTML
templates/development.php:136:32 - Detected tainted text with possible quotes

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (11f22f4) to head (b4d5248).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #192   +/-   ##
=========================================
  Coverage     87.18%   87.18%           
  Complexity      225      225           
=========================================
  Files            19       19           
  Lines           710      710           
=========================================
  Hits            619      619           
  Misses           91       91           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (11f22f4) to head (092165c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #192   +/-   ##
=========================================
  Coverage     87.18%   87.18%           
  Complexity      225      225           
=========================================
  Files            19       19           
  Lines           710      710           
=========================================
  Hits            619      619           
  Misses           91       91           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

chore: fix Psalm 7 issues

Psalm 7 enables taint analysis, which found that the cURL block in `development.php` printed the command (built from the request or an exception message) without escaping. The other reports are false positives: `ReflectionClass` received an object, the template closure reads its arguments via `func_get_arg()` on purpose, and `ErrorHandler` echoes already rendered output.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

1 similar comment
@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@roxblnfk
roxblnfk requested a review from a team November 25, 2026 17:08
roxblnfk added a commit to spiral-packages/yii-error-handler-bridge that referenced this pull request Nov 25, 2026
fix: escape cURL command in the development error page

The bridge ships its own copy of the development template, so the upstream XSS fix (yiisoft/error-handler#192) has to be ported by hand.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Replace ReflectionClass with ReflectionObject for throwable descriptions and suppress Psalm 7 false positives around rendered output and template arguments.

  • src/ErrorHandler.php L223
  • src/Renderer/HtmlRenderer.php L19-704 (4 small edits)

UI

Escape rendered cURL commands in both the textarea and clipboard attribute to prevent unescaped HTML output.

  • templates/development.php L131, L136

Configuration

Add PHP 8.6 to the build and dependency-analysis matrices, extend the Composer PHP constraint, and update the Psalm constraint for Psalm 7.

  • .github/workflows/build.yml L33
  • .github/workflows/composer-dependency-analyser.yml L29
  • composer.json L34, L57

Documentation

Document PHP 8.6 support in the requirements and changelog.

  • CHANGELOG.md L8 (removed lines), L14-17
  • README.md L38

Tests

Make the renderer warning assertion account for PHP 8.6’s changed file() warning text.

  • tests/Renderer/HtmlRendererTest.php L39, L406-411

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

3 similar comments
@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

3 similar comments
@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@psalm-shepherd

Copy link
Copy Markdown

Psalm didn’t find any errors!

@samdark
samdark merged commit 4d82977 into master Nov 25, 2026
30 of 31 checks passed
@samdark
samdark deleted the php-8.6 branch November 25, 2026 20:02
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.

3 participants