Common issues and solutions during Magento upgrade to 1.9

We believe that almost every Magento developer had a chance to work on Magento upgrade to the latest version, and almost in all cases the developers could face with different bugs.
Therefore, we would like to share few solutions for fixing the common issues that may occur during upgrading Magento to 1.9 version.

1. Issue description: the first bug that can be met is that after Magento upgrade a customer will not be able to log in to the account.

Issue reason: is that the theme installed on the website does not support a variable called form_key.

Solution: add the following code snippet right after

<ul class="form-list"> 

to every of your login.phtml files for the theme:

<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

Take a look at the example of the path to the file:
app/design/frontend/yourthemepackage/yourtheme/template/persistent/customer/form/login.phtml.
2. Issue description: update of the products quantity in the shopping cart is not working after you’ve upgraded Magento to 1.9 version.

Solution: place the below code to your /app/design/frontend/yourthemepackage/yourtheme/template/checkout/cart.phtml file:

<?php echo $this->getBlockHtml('formkey'); ?>

into the line 50 just after:

getUrl('checkout/cart/updatePost') ?>" method="post"> 

This way you will fix the update of the products quantity in the shopping cart.

3. Issue description: you’ve just upgraded Magento to 1.9 and when you go to System > Configuration you see the white screen.

Issue reason: Magento 1.8.1 removes Google Checkout due to Google requirements for the product’s ending announced in November, 2013.
So, any of other extensions that depend on the presence of the Google Checkout modules or layout in Magento may cause similar issue when you upgrade Magento to 1.8.1 or later versions.

Solution: to solve this issue just go to /app/code/core/Mage/GoogleCheckout/etc and remove all the files except config.xml.

4. Issue description: CMS static blocks start displaying randomly after upgrading to Magento 1.9.2.0.

Issue reason: The problem is in the following code which being added to the constructor of Mage_Cms_Block_Block

$this->setCacheTags(array(Mage_Cms_Model_Block::CACHE_TAG)); 
$this->setCacheLifetime(false);

CMS static blocks are now cached.

The problem lies in not generating the key cache properly. According to Mage_Core_Block_Abstract logic the blocks names are used in layout, and in our case – they have not been added through layout, so they would not exist for CMS static blocks. To clarify more, the static blocks have the same cache key and that is why they are jumbled in the cache.

Solution: andrewkett has proposed a great solution, and I would also like to share it with you. To fix the issue, we will need to override the Mage_Cms_Block_Block class and set the cache key info based on the block id and current store. Please ensure that it will be added in your own module with a config.xml file and block override etc.

/**
 * Override cms/block to add cache key. This started being a problem as of EE 1.14.2 and CE 1.9.2 when the _construct
 * method was added which turns on caching for cms blocks
 */
class Mysite_Cms_Block_Block extends Mage_Cms_Block_Block
{

    /**
     * If this block has a block id, use that as the cache key.
     *
     * @return array
     */
    public function getCacheKeyInfo()
    {
        if ($this->getBlockId()) {
            return array(
                Mage_Cms_Model_Block::CACHE_TAG,
                Mage::app()->getStore()->getId(),
                $this->getBlockId(),
                (int) Mage::app()->getStore()->isCurrentlySecure()
            );
        } else {
            return parent::getCacheKeyInfo();
        }
    }
}

Summing this information up, we can say that these were the errors that we usually meet after the Magento upgrade. Meanwhile, please feel free to share your experience in finding and fixing the issues related to upgrades, and we can proceed discussing them in the comments below. Thank you!