Skip to content

fix(requirement-checker): Avoid the null array offset deprecation on PHP 8.5 - #1684

Open
rforced wants to merge 1 commit into
box-project:mainfrom
rforced:fix/requirement-checker-php85-null-offset
Open

rforced wants to merge 1 commit into
box-project:mainfrom
rforced:fix/requirement-checker-php85-null-offset

Conversation

@rforced

@rforced rforced commented Nov 28, 2026

Copy link
Copy Markdown

On PHP 8.5, Printer::printv() triggers "Using null as an array offset is deprecated" when colors are on and no style is given. printvln() always passes a null style for the trailing newline, so a PHAR run with -v prints the deprecation twice for every line of the requirement checker output.

#1626 reported this. It was closed after #1607, but #1607 only changed RequirementsBuilder, and Printer still has the issue in 4.7.1.

The fix skips the style lookup when the style is null. The output is unchanged.

Testing:

  • The existing color cases in PrinterTest already reach this path.
  • PHP 8.5.13, highest dependencies: vendor/bin/phpunit --testsuite=UnitTests --fail-on-deprecation reports one deprecation at src/Printer.php:147 before the change and passes after (58 tests).
  • PHP 8.2, locked dependencies: passes.
  • PHP-CS-Fixer and Rector report no changes.

The PHPUnit config does not fail on deprecations, which is why the PHP 8.5 job stayed green. I can add failOnDeprecation="true" to requirement-checker/phpunit.xml.dist here or in a follow-up if you want that.

I left res/requirement-checker to the update workflow.

This branch has not been deployed

No deployments
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.

1 participant