CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: CodeIgniter\Validation\Validation::setRules() must be of the type array, string given (/showthread.php?tid=72234) |
CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - NiteRaven - 11-25-2018 Hi there, I believe I found a bug with the controller validate method. The following doc page... https://codeigniter4.github.io/CodeIgniter4/incoming/controllers.html#validating-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)) { Thanks, Kyle RE: CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - NiteRaven - 12-02-2018 This was fixed! Thanks! RE: CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - vebo - 01-25-2019 processRules() function which inside System/Validation/validation.php I added this code and I fixed the problem. now validation work for multiple variable I sended like "name[]" Code: if (is_array($value)) { RE: CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - InsiteFX - 01-25-2019 You should never ever edit or change CodeIgniter system code!
RE: CodeIgniter\Validation\Validation::setRules() must be of the type array, string given - vebo - 01-27-2019 (01-25-2019, 09:19 AM)InsiteFX Wrote: I Agree but please tell me what is the way the validation for multiple array like name[] ? "dot array syntax " is not work.. This is the way I founded. What is yours? |