Posted on 3/11/07 by Felix Geisendörfer
Just got bitten by this one when updating to the latest version of CakePHP. If you use code like this in your app:
// Do stuff
Then you're in for a surprise. Because as of revision 5895 Model::save() now returns Model::data on success if its not empty. Now most of us do not use strict comparison for checking the return value of Model::save(), but I was stupid enough to do it as part of my new "fail hard fast" strategy : ). So suddenly I had stuff blowing up all over the place.
Oh well, thats the price you pay for being one of the cool kids and staying with SVN:HEAD. However, its definitely worth it because there are new goodies added to the core every day. And in fact, Model::save() returning an array is one of them. Because previously you had to make your own copy of Model::data if you needed it after a save() operation because Model::save() always clears Model::data for you.
So its all good, just be sure to check your app for strict Model::save return value comparisons to avoid surprises.
-- Felix Geisendörfer aka the_undefined
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.