Skip to content

[13.x] Fix deprecation warning in In and NotIn rules when values contain null#59576

Merged
taylorotwell merged 1 commit intolaravel:13.xfrom
sumaiazaman:13.x-fix-in-notin-null
Apr 7, 2026
Merged

[13.x] Fix deprecation warning in In and NotIn rules when values contain null#59576
taylorotwell merged 1 commit intolaravel:13.xfrom
sumaiazaman:13.x-fix-in-notin-null

Conversation

@sumaiazaman
Copy link
Copy Markdown
Contributor

Summary

PR #59561 fixed the null deprecation warning in Contains and DoesntContain rules. The In and NotIn rules have the identical pattern that was missed.

Before

Rule::in([1, null, 'active']);
// Deprecated: str_replace(): Passing null to parameter #3 ($subject)

After

Rule::in([1, null, 'active']);
// No warning — null cast to empty string

All four rules now consistent

Rule Fixed
Contains #59561
DoesntContain #59561
In ✅ this PR
NotIn ✅ this PR

Changes

  • src/Illuminate/Validation/Rules/In.php — Cast value to string
  • src/Illuminate/Validation/Rules/NotIn.php — Cast value to string

…ain null

Same fix as laravel#59561 (Contains/DoesntContain) — str_replace() receives
null from enum_value(null), generating a deprecation warning. The In
and NotIn rules have the identical pattern that was missed.
@taylorotwell taylorotwell merged commit a3a626b into laravel:13.x Apr 7, 2026
54 checks passed
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.

2 participants