Form_validation callbacks with parameters bug (?) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Form_validation callbacks with parameters bug (?) (/showthread.php?tid=38521) |
Form_validation callbacks with parameters bug (?) - El Forum - 02-10-2011 [eluser]sckarlin[/eluser] Lifted from this thread: http://ellislab.com/forums/viewthread/180085/ Apologies if this kind of cross-posting is inappropriate. I'm not sure where to report a bug -- if this is, indeed, one. For several years, I have used the feature to give a custom callback a parameter in form validation. The new Form_validation code seems to have broken this. For example, I have call back functions that expect the contents between the square brackets to appear as the second parameter of a callback. A rule might look like this: Code: 'callback__if_and[foo==bar]' The problem is in approximately line 492 of Form_validation for CI 2.0.0: Code: if ( ! in_array('required', $rules) AND is_null($postdata)) The fix may be to either fix the preg_match regex, or to simply remove the $rules re-assignment after setting $callback to TRUE. Form_validation callbacks with parameters bug (?) - El Forum - 02-10-2011 [eluser]sckarlin[/eluser] Looks like someone else has noticed this, too: https://bitbucket.org/ellislab/codeigniter/issue/139/validation-callback-parameter-does-not |