From dd746f90dc0982dda25380c1cd73a1434d8c7d4f Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Sat, 6 Mar 2021 15:38:24 +0000 Subject: [PATCH] Fix replacing required :input with null on PHP 8.1 Fixes an issue where data lacking one or more of the fields under validation will cause tests to fail with an `ErrorException`. That exception is a PHP deprecation warning triggered by the call to `str_replace()` inside `replaceInputPlaceholder()`, which assumes the value returned from `getDisplayableValue()` will always be a string. --- src/Illuminate/Validation/Concerns/FormatsMessages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Concerns/FormatsMessages.php b/src/Illuminate/Validation/Concerns/FormatsMessages.php index 39d102a331ba..f433a5361eec 100644 --- a/src/Illuminate/Validation/Concerns/FormatsMessages.php +++ b/src/Illuminate/Validation/Concerns/FormatsMessages.php @@ -336,7 +336,7 @@ public function getDisplayableValue($attribute, $value) return $value ? 'true' : 'false'; } - return $value; + return (string) $value; } /**