Skip to content

Throw on null offsets in ConfigSection array access - #9

Merged
TomK merged 1 commit into
2.xfrom
null-throws-2x
Oct 22, 2026
Merged

TomK merged 1 commit into
2.xfrom
null-throws-2x

Conversation

@TomK

@TomK TomK commented Oct 22, 2026

Copy link
Copy Markdown
Member

On 2.x, passing null as a key, section name, INI path or INI string throws a TypeError from the string parameter types, except isset($section[null]) and unset($section[null]), which raised PHP 8.5's Using null as an array offset is deprecated instead.

  • isset($section[null]) / unset($section[null]): now throw TypeError, like every other entry point.
  • Integer offsets ($section[0]): unchanged.

1.x keeps accepting null as '' without a deprecation (#8).

Test plan

  • New NullKeyTest asserts a TypeError for null on each of the 23 entry points; the two array-access cases failed before this change.
  • Full suite (124 tests) passes locally on PHP 8.5 with no deprecations.

🤖 Generated with Claude Code

isset() and unset() on a ConfigSection used the offset directly, so a
null offset raised PHP 8.5's null array offset deprecation instead of
the TypeError every other entry point throws for a null key. They now
go through has() and removeItem().

Tests cover null for each key, section name, INI path and INI string
entry point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK
TomK merged commit 093882a into 2.x Oct 22, 2026
3 checks passed
@TomK
TomK deleted the null-throws-2x branch October 22, 2026 11:53
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