A small bug in the advanced validation approach

I already wrote that I had problems with the validation after upgrading to version 1.0 of CakePHP. At that time, I thought it was a bug in Model->save(), and fixed that “bug”. But it transpired that it was in fact a bug in the advanced validation approach I described in an earlier post and in the wiki.

The bug fix is to change the default value for the parameter of the invalidFields() function to “array()”, and to replace the first line of that function:

if (!isset($this->validate) || is_array($this->validationErrors))


if (!isset($this->validate) || !empty($this->validationErrors))

Sorry for the inconvenience.

(Thanks to Zachary Naiman for the hint)


One Comment

  1. Posted May 8, 2006 at 7:30 pm | Permalink

    I had just upgraded to 1.0 and didn’t notice any problems with this method of validation. I made the change anyways and I haven’t noticed anything broken yet, but we will see what happens =) BTW, I absoluetly love this validation method, why it’s not builtin that you can validate data against functions and not just regexps boggles the mind after having used this for a while, thak you =)

%d bloggers like this: