Magento – Magento 1.9.3 magento Mage registry key “_singleton/customer/session” already exists

magento1.9.3

I am trying to find out solution for issue "Mage registry key "_singleton/customer/session" already exists".
I am trying to many thing but still not success.
I am write my error report here if any one know solution and how can i debug my issue please post your answer.

Error log report

Best Answer

This is happened because you have already registered the same key name _singleton/customer/session.

File: app/Mage.php/ you can see below function in this file

public static function register($key, $value, $graceful = false)
{
    if (isset(self::$_registry[$key])) {
        if ($graceful) {
            return;
        }
        self::throwException('Mage registry key "'.$key.'" already exists');
    }
    self::$_registry[$key] = $value;
}

We can see that any object or value we’re storing in the registry is ultimately being stored in the static $_registry class variable. We can also see that before storing the value, Magento checks if it’s already set. If so, Magento will either throw an Exception (the default behavior) or gracefully return null

its already set with other value

Finally, if you want to make you variable unavailable, you can use the unregister method to remove it from the registry.

Mage::unregister('method_name');

Try this too

php -f compiler.php clear
php -f compiler.php disable

this will disable the compilation and will clear the files, after this delete content of var/cache/* and var/session/* by this command:

rm -Rf var/cache/*
rm -Rf var/session/*
Related Topic