When using the 'JSON' rule validation in PHP 8, you will get a TypeError when submitting an empty field:
method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
in vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php:1149
According to php.watch:
Union types are used when they are deemed necessary. For example, method_exists() function accepts either a class name (string) or an object (object). This is enforced as a Union Type of string|object. [...] Prior to PHP 8, it returned false if the provided parameter is not a string or an object, but did not raise any warnings.
Steps To Reproduce:
Create a form with an input field that contains no value (hidden in my case).
Add a json rule for this field (json|required in my case).
Submit the form.
The website will return method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
The text was updated successfully, but these errors were encountered:
Joorren
added a commit
to Joorren/framework
that referenced
this issue
Jan 6, 2021
Description:
When using the 'JSON' rule validation in PHP 8, you will get a TypeError when submitting an empty field:
According to php.watch:
Union types are used when they are deemed necessary. For example,
method_exists()
function accepts either a class name (string
) or an object (object
). This is enforced as a Union Type ofstring|object
. [...] Prior to PHP 8, it returned false if the provided parameter is not a string or an object, but did not raise any warnings.Steps To Reproduce:
hidden
in my case).json|required
in my case).The website will return
method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
The text was updated successfully, but these errors were encountered: