Skip to content

Compare enum values as strings so a null value doesn't deprecate - #11

Merged
TomK merged 1 commit into
masterfrom
php85-null-values
Oct 22, 2026
Merged

TomK merged 1 commit into
masterfrom
php85-null-values

Conversation

@TomK

@TomK TomK commented Oct 22, 2026

Copy link
Copy Markdown
Member

Validating a null value (an empty or missing field) with a case-insensitive EnumValidator raises strcasecmp(): Passing null to parameter #2 ($string2) of type string is deprecated on PHP 8.1+. It shows up through packaged/form enum fields in k4.

  • null value, case-insensitive enum: same valid/invalid result as before; no deprecation.

The PHP unit tests now run on 7.4 and 8.2–8.5 (was 7.4 and 8.0) with deprecations converted to exceptions. The npm release job is unchanged.

Test plan

  • With deprecations converted, EnumValidatorTest::testEmptyValues and testNegate errored on PHP 8.5 before the fix; all 112 tests pass on PHP 7.4, 8.2 and 8.5 after it.

🤖 Generated with Claude Code

A case-insensitive EnumValidator passed the value straight to
strcasecmp(), so validating a null value (an empty or missing field)
raised PHP 8.1's "Passing null to parameter" deprecation. Both sides are
now cast to string, which is what strcasecmp() did implicitly before.

phpunit now converts deprecations to exceptions, and the unit tests run
on PHP 7.4 and 8.2-8.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK
TomK merged commit e2eeb49 into master Oct 22, 2026
6 checks passed
@TomK
TomK deleted the php85-null-values branch October 22, 2026 13:01
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