0

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

  • Provide your code so we can reproduce this error – Murtuza Zabuawala Mar 28 '17 at 4:58
2

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/*
  • Bilal How can i get method_name to store global variable $_registry and where can i put this code Mage::unregister('method_name'); – Pratik Mar 28 '17 at 7:31
0

In case anyone else runs into this error and clearing your cache/refreshing your index is not making a difference, I found with my setup there was a module with a misconfiguration in its config.xml.

The module was trying to setup a resource model, and in doing so, forgot a couple lines to properly access the right files.

The module had the model configured like this before:

<models>
    <custom_module>
        <class>Custom_Module_Model</class>
    </custom_module>
</models>

The configuration for setting up a resource model should look like this:

<models>
    <custom_module>
        <class>Custom_Module_Model</class>
        <resourceModel>custom_module_resource</resourceModel>
    </custom_module>
    <custom_module_resource>
        <class>Custom_Module_Model_Resource</class>
    </custom_module_resource>
</models>

Once I updated the configuration file, the error message went away.

My advice is to look at the registry key it is referencing, and double check its configuration that it is setup properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.