Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M194x: Mage_Core_Exception: Mage registry key "product" already exists in app/Mage.php:596 #663

Closed
seansan opened this issue Apr 16, 2019 · 4 comments

Comments

@seansan
Copy link
Contributor

seansan commented Apr 16, 2019

Hi, thought I'd log this here. We recently pulled the M194x code (12-4-2019) and since then are seeing 1000's and 1000's of the same error items in our except log.

Somehow registry key PRODUCT is already set somewhere.

This could be an extension however I dont recall making any other changes.

https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Catalog/Helper/Product.php#L358

2019-04-13T05:45:59+00:00 ERR (3):
Mage_Core_Exception: Mage registry key "product" already exists in app/Mage.php:596
Stack trace:
#0 app/Mage.php(224): Mage::throwException('Mage registry k...')
#1 app/code/core/Mage/Catalog/Helper/Product.php(358): Mage::register('product', Object(Mage_Catalog_Model_Product))
#2 app/code/core/Mage/Catalog/Helper/Product/View.php(121): Mage_Catalog_Helper_Product->initProduct(7871, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#3 app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(7871, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#4 app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_ProductController->viewAction()
#5 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('view')
#6 app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#8 app/Mage.php(684): Mage_Core_Model_App->run(Array)
#9 index.php(110): Mage::run('website', 'store')
#10 {main}

@AndresInSpace
Copy link
Contributor

Using 1.9.4.x LTS
I don't get this error.
I would assume that some extension is adding the data in prior to your helper being called.

@kkrieger85
Copy link
Contributor

@seansan Issue still open?

Please provide some more information:

  • Used commit
  • Used 3rd party extensions
  • How to reproduce this issue with fresh installation.

@seansan
Copy link
Contributor Author

seansan commented Jun 2, 2019

Using M194.x from april

Okay here goes. Just sharing the process - I think I should catch the register function to see where data is being set before. Also the error occurs only occasionally so maybe it is with some exotic product only.

Yes it could be an extension haven’t found the problem yet though.

However we are looking into the following fix for now

The difference in the 356-361 strings. https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Catalog/Helper/Product.php#L358

The original code:
// Register current data and dispatch final events
Mage::register('current_product', $product);
Mage::register('product', $product);
 
The fixed code:
// Register current data and dispatch final events
Mage::register('current_product', $product);

if (!Mage::registry('product') && $product)
{ Mage::register('product', $product); }
 

@sreichel
Copy link
Contributor

Pls try grep "Mage::register('current_product'" on local/community folder. Seem not to be a bug within magento.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants