• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter\Validation\Validation::setRules() must be of the type array, string given

#1
Hi there, I believe I found a bug with the controller validate method. The following doc page...

https://codeigniter4.github.io/CodeIgnit...-post-data

... states that I can pass the name of a validation group when validating POST data. This however is not that case as the Controller validate method only passes the rules to setRules as an array and generates a PHP error. It should check if the rules are a string or an array and then make the correct call to the validation service.

Something like:

PHP Code:
if (is_string($rules)) {
    
$this->validator->setRuleGroup($rules);
    
$success $this->validator->withRequest($this->request)->run();
} else {
    
$success $this->validator->withRequest($this->request)->setRules($rules$messages)->run();


Thanks,
Kyle
Reply

#2
This was fixed! Thanks!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.