From time to time previously serialized array will get broken. The most common problem occurs when string length is invalid so instead of


you have


becouse someone edited something directly in db, in this case to make php unserialize() function to work again, just do this magic:

$data = html_entity_decode($data, ENT_QUOTES, 'UTF-8');
$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data );
$data = unserialize($data);

and you will get all strings lenths to be fixed again.

Well, this one can be really painful. But solution is simple, just make sure you are stopping every OpenGL AND sound activity in applicationWillResignActive function, not in applicationDidEnterBackground (becouse it’s too late, app is already in background and no OpenGL/Sound is allowed, you can add playing sounds in background into plist but OpenGL won’t be allowed anyway).

It seems to be trivial, but it’s not. If you want to use custom table and custom model, and sort collection by one of your table’s column, you can’t just use addAttributeToSort as you do with native Magento collection (like “catalog/product”). Instead of this, you should use setOrder, so your code should look like this:

$items = Mage::getModel('module/model')
         ->setOrder('date_added', 'DESC')
         ->addFieldToFilter('category_id', array('eq' => $category_id))