A small bug in the advanced validation approach

Published on and tagged with cakephp  problem  validation

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 baked

  • Pablo

    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 =)

  • açık çek

    …Click here for or more Information

    […]Wow, marvelous weblog format! How lengthy have you ever been running a blog for?[…]

  • bahis siteleri

    …A Friend recommended your blog

    […] What web host are you the usage of? Can I get affiliate hyperlink to your host? I wish web site loaded up as quickly as yours lol[…]

  • sportotobet

    …Recommended websites

    […]Wow, superb weblog structure! How lengthy have you ever been running a blog for?[…]

  • betebet


    […]The total glance of your site is great, let smartly as the content![…]

Bake a comment

(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License