15

I have magento 1.7 installed and it worked fine till now.

I import products on daily basis. If there is any new manufacturer, I add it in drop down based Manufacturer attribute.

Today, I have added new Manufacturer option in attribute back-end and gone to import products it successfully imported products.

But after that I try to open any page in Magento admin site, It ends up with below error message

Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in /var/www/html/app/code/core/Mage/Catalog/Model/Category.php on line 36

Line 36 has just starting curly { for this class

class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract
{ <-- this is line 36

And I have checked Mage_Catalog_Model_Category but there is no method defined with name clearInstance. It is really annoying.

FYI: I did not touch a single character of code I'm just using ADMIN site to import products and adding some required attributes

  • Why -1? I am here to get help people. Is this not a place to ask questions about Magento. – sunlight Mar 6 '13 at 13:18
  • About -1, sometimes people react weird... About your problem, it is written in your error message, just read it. "CANNOT OVERRIDE FINAL METHOD...". You try to override something which cannot (you or someone who codes it badly) – Sylvain Rayé Mar 6 '13 at 13:36
  • @SylvainRayé: I had not even touched a single character of code, Did you read the question?, I'm just using ADMIN site to import product. It is Magento which is throwing error and again it is Magento who code it badly – sunlight Mar 6 '13 at 13:40
  • @SylvainRayé: The error is not as lite as you think, Specially when it comes from core code and even when without touching code. – sunlight Mar 6 '13 at 13:45
  • The downvote fairies are pretty aggressive in this community, ignore them. Might be an issue where a third party extension causes the issue by extending or overwriting the class. Try and disable all 3th party extensions to see if that helps – Sander Mangel Mar 6 '13 at 13:47
5

This behaviour wouldn't normally happen unless you have modified Magento's code in some way - be it via 3rd party extensions, core code edits or general customisations.

The fact it occurs in the admin, prior to any data models actually being loaded (product grid etc.) would imply its being caused by an extension - not imported data.

It it were occurring on the product grid - then it could be the product model at fault as a result of a failed import.

But after a quick search, there is a lot of indexed google search results of Magento stores with the same error. So it could be in the core (albeit, we've never come across it) - but I am doubtful.

Looking at the core in 1.7

+34 abstract class Mage_Catalog_Model_Abstract extends Mage_Core_Model_Abstract
+35 {
+36     /**
+37      * Identifuer of default store

You shouldn't have any override of the clearInstance() method. In fact, this method is only declared once, in app/code/core/Mage/Core/Model/Abstract.php

final public function clearInstance()

I've seen errors of this nature occur when people have mistakenly used include for an overridden class (resulting in it being loaded twice).


Your best options are to follow the standard debug procedure

  1. Restore a clean core
  2. Restore a clean adminhtml dir
  3. Rename ./app/code/local directory
  4. Rename ./app/code/community directory

And see if the issue persists.

3

the problem here is with APC, disable APC and the problem will go away.

  • disabling APC is no option. But good idea! I would never think of this! @sunlight do you have more than one magento installed? and defined the same prefix? It might be a problem with another store inside the same cache. – Fabian Blechschmidt Apr 12 '13 at 15:28
3

going by php standards for this specific error :

Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in /var/www/html/app/code/core/Mage/Catalog/Model/Category.php on line 36

it clearly means that you have extended class Mage_Core_Model_Abstract using

class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract

and within this class you have clearInstance() defined as a function.

As clearInstance() function is a final function so you are not permitted to modify this function in any of the extended class.

what exactly is your line 36 by adding some dummy code above and below line you assume is line 36.

I had seen developers modifying or looking into files in specific folder where as with compiler set to true php class files is in some other folder.

  • I checked, I don't have any method named clearInstance in local and community pool. However, I removed final keyword from the function declaration to solve the issue temporarily, But It is annoying me that when i have added final keyword back in the front of function, things are still working properly. – sunlight Mar 7 '13 at 5:35
  • Probably your class is getting included twice as stated by sonassi : I've seen errors of this nature occur when people have mistakenly used include for an overridden class (resulting in it being loaded twice). – oscprofessionals Mar 7 '13 at 15:59
2

I had the same problem with the latest PHP 5.4 version on a different Magento version (in the frontend area) and could not solve this by code or any caches. Did you check the version?

If this is the case, a rollback to the earlier version would be worth a try.

2

Just experienced this and found an unconfirmed bug posting stating very similar setup.

This appears to be a bug with the combination of

  • PHP 5.4.12+
  • Magento 1.7.x (1.13.x EE)
  • APC (3.1.x)

Apache error_log shows AH00052: child pid XX exit signal Segmentation fault (11)

The two best solutions to the problem at the moment it seems is:

A) Downgrade PHP to a lower working version, possibly 5.4.11 or below.

B) Disable APC, if not possible see A. :)

  • Im experiencing the same problem with PHP 5.3.27 with MariaDB, Magento 1.7.0.2, with no APC. Im also using Varnish + nginx. Its an intermitent issue that forces to restart php-fpm, varnish, nginx, etc sometimes. By the way, I didnt found any non-core clearInstance method declared anywhere. Maybe there's something including the classes twice. But it's strange, because if it was a parser error, it would happen everytime. – Ricardo Martins Dec 26 '13 at 23:18
1

I resolved this issues for Magento 1.9 by switching the way PHP runs (In the hosting controle panel i swiched Run PHP as ... to Fast CGI Application). I have absolutely no idea what other consequences this change has. Trying to figure that out at the moment.

0

I was expecting the same problem. There was no clearInstance method declaration anywhere out of the core pool.

I analyzed my nginx access.log and error.log and noticed that these errors appears when Google and Bing bots visits my site a thousand times in a few minutes in different url's, making many requests and queries from magento. This things takes my site down.

I guess I fixed that by decreasing the crawler power from google and bing at their webmaster's panels.

You can use GoAccess or Request Log Analyzer to analyze your log file and see the top visitors user-agent.

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.