I have this error appers all the time in the system.log file. How to fix it?

ERR (3): Notice: Undefined variable: id  in /ext/vhosts/mysite.com/public/app/code/core/Mage/Core/Model/Abstract.php on line 224
ERR (3): Notice: Undefined variable: id  in /ext/vhosts/mysite.com/public/app/code/core/Mage/Core/Model/Abstract.php on line 225

I'm using Magento 1.9.3.0

up vote 1 down vote accepted

Notice errors aren't critical, but it's better fixing them. However, Magento shouldn't display throw notice errors, so I suspect it could be coming from a custom module/theme.

To debug this (in a dev environment only): open up app/code/core/Mage/Core/Model/Abstract.php and add:

public function load($id, $field=null)
{
    if (!isset($id)) {
        echo Varien_Debug::backtrace(true, true);
        exit;
    }
    $this->_beforeLoad($id, $field);
    ...

Then refresh the page, and you should see a backtrace of the error, and by going up the backtrace, you can see what module/theme tries to load an object with an NULL id.

  • Can you explain what you mean by 'backtrace of the error'? – jscar Jul 7 '17 at 14:26
  • 1
    A backtrace is like a detailed path of a PHP process. So you can see exactly what executed what, where from and in what order – Mayers Jul 7 '17 at 14:33
  • Where can that information be found? Exception.log? – jscar Jul 7 '17 at 14:41
  • 1
    No, if you make the edit I have added above, it will be printed on the screen when you refresh – Mayers Jul 7 '17 at 14:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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