From 8cdf5c9ce6ea28618de2dc4e65f3910adaaeb9ce Mon Sep 17 00:00:00 2001 From: sumaiazaman Date: Tue, 7 Apr 2026 12:36:53 +0600 Subject: [PATCH] [13.x] Fix deprecation warning in In and NotIn rules when values contain null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same fix as #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. --- src/Illuminate/Validation/Rules/In.php | 2 +- src/Illuminate/Validation/Rules/NotIn.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Validation/Rules/In.php b/src/Illuminate/Validation/Rules/In.php index 7e2d83a29673..c001c05b1b1c 100644 --- a/src/Illuminate/Validation/Rules/In.php +++ b/src/Illuminate/Validation/Rules/In.php @@ -49,7 +49,7 @@ public function __toString() $values = array_map(function ($value) { $value = enum_value($value); - return '"'.str_replace('"', '""', $value).'"'; + return '"'.str_replace('"', '""', (string) $value).'"'; }, $this->values); return $this->rule.':'.implode(',', $values); diff --git a/src/Illuminate/Validation/Rules/NotIn.php b/src/Illuminate/Validation/Rules/NotIn.php index 290b84e941fe..441c90d03cba 100644 --- a/src/Illuminate/Validation/Rules/NotIn.php +++ b/src/Illuminate/Validation/Rules/NotIn.php @@ -47,7 +47,7 @@ public function __toString() $values = array_map(function ($value) { $value = enum_value($value); - return '"'.str_replace('"', '""', $value).'"'; + return '"'.str_replace('"', '""', (string) $value).'"'; }, $this->values); return $this->rule.':'.implode(',', $values);