-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them
Description
PHP Version
8.1
CodeIgniter4 Version
4.2.5
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
No response
What happened?
The validation rule "integer" fail as 500 error as below
{
"title": "TypeError",
"type": "TypeError",
"code": 500,
"message": "CodeIgniter\\Validation\\FormatRules::integer(): Argument #1 ($str) must be of type ?string, array given, called in /var/www/src/system/Validation/Validation.php on line 314",
"file": "/var/www/src/system/Validation/FormatRules.php",
"line": 132,
"trace": [
{
"file": "/var/www/src/system/Validation/Validation.php",
"line": 314,
"function": "integer",
"class": "CodeIgniter\\Validation\\FormatRules",
"type": "->",
"args": [
[],
null
]
},
{
"file": "/var/www/src/system/Validation/Validation.php",
"line": 163,
"function": "processRules",
"class": "CodeIgniter\\Validation\\Validation",
"type": "->",
...
That validation allows string numeric (not integer) as well
Steps to Reproduce
Validation rule used
protected $validationRules = [
'integerAcceptsStringNumeric' => 'integer',
'integerArrayError' => 'integer',
];
Data to validate
$data = [
'integerAcceptsStringNumeric' => '1',
'integerArrayError' => [],
];
Expected Output
Validation fail and return 400 if the value is not an integer
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them