Function inside a validation rule |
Hi,
This type of custom validation rule used to work in CI3 but I am getting an error with CI4. Code: PHP Code: $validation->setRrules([ I am getting the following Quote:preg_match(): Argument #2 ($subject) must be of type string, array given Quote:SYSTEMPATH/Validation/Validation.php at line 292 Code: 292 if (! $isCallable && preg_match('/(.*?)\[(.*)\]/', $rule, $match)) { It seems the second rule that includes a function, which is in an array, is causing this error. Is it that this cannot be done in CI4 at all or am I just missing something? Thanks,
The closure validation rule will be added in v4.3.0.
See https://github.com/codeigniter4/CodeIgniter4/pull/6951 (01-03-2023, 07:13 PM)kenjis Wrote: The closure validation rule will be added in v4.3.0. Great. Good to know. Thanks.
The use keyword has two purposes: it tells a class to inherit a trait and it gives an alias to a namespace.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(01-03-2023, 07:13 PM)kenjis Wrote: The closure validation rule will be added in v4.3.0. When will version 4.3 be available? |
Welcome Guest, Not a member yet? Register Sign In |