Repository navigation
Treat null keys and section names as empty strings on PHP 8.5 - #8
Merged
Merged
Conversation
PHP 8.5 deprecates null as an array offset, and 8.1 deprecates passing null to string parameters. Config used caller-supplied keys, section names, INI paths and INI strings directly, so a null from the caller raised a deprecation, which is an exception where deprecations are converted. Each is now read as '', which is what PHP did implicitly before, so stored keys and thrown exceptions are unchanged. The tests convert deprecations to exceptions so CI catches new ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing
nullas a key or section name (getItem(null),$section[] = $v,addItem(null, …)) raisesUsing null as an array offset is deprecatedon PHP 8.5, and anullINI path or string raises a PHP 8.1Passing null to parameterdeprecation. Projects that turn deprecations into exceptions see these as failures; this is what motivated #5.nullkey or section name: stored and looked up under'', as before; no deprecation.nullINI file path or string: throws the sameRuntimeExceptionas''did; no deprecation.Signatures are unchanged and PHP 7.4 is still supported. The
2.xline throws onnullinstead.Test plan
NullKeyTestcovers each case. WithconvertDeprecationsToExceptionson, all 7 failed on PHP 8.5 before the fix and pass after.🤖 Generated with Claude Code