Skip to content

Commit

Permalink
Fix replacing required :input with null on PHP 8.1 (#36622)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dshoreman authored Mar 17, 2021
1 parent 0a89a87 commit 9d80189
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Validation/Concerns/FormatsMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function getDisplayableValue($attribute, $value)
return $value ? 'true' : 'false';
}

return $value;
return (string) $value;
}

/**
Expand Down

0 comments on commit 9d80189

Please sign in to comment.