7

Since this evening we are seeing this error.

First we see this in error log

2013-08-11T18:46:59+00:00 ERR (3): Warning: include(): Filename cannot be empty  in app/code/core/Mage/Core/Block/Template.php on line 241
2013-08-11T18:46:59+00:00 ERR (3): Warning: include(): Filename cannot be empty  in app/code/core/Mage/Core/Block/Template.php on line 241
2013-08-11T18:46:59+00:00 ERR (3): Warning: include(): Failed opening '' for inclusion (include_path='lib/minify:app/code/local:app/code/community:app/code/core:lib:.')  in app/code/core/Mage/Core/Block/Template.php on line 241

and with full exception printing we see the following.

I tried disabling notifications, but don't know where to start (and how this suddenly occurs)

Warning: include(): Filename cannot be empty  in app/code/core/Mage/Core/Block/Template.php on line 241

#0 app/code/core/Mage/Core/Block/Template.php(241): mageCoreErrorHandler(2, 'include(): Filename cannot be empty', 'app/code/core/Mage/Core/Block/Template.php', 241, Array)
#1 app/code/core/Mage/Core/Block/Template.php(241): Mage_Core_Block_Template->fetchView()
#2 app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/base/default/template/system/cache/notifications.phtml')
#3 app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#4 app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#5 app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php(62): Mage_Adminhtml_Block_Template->_toHtml()
#6 app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Cache_Notifications->_toHtml()
#7 app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#8 app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#9 app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#10 app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('notifications', true)
#11 app/design/adminhtml/default/default/template/page.phtml(55): Mage_Core_Block_Abstract->getChildHtml('notifications')
#12 app/code/core/Mage/Core/Block/Template.php(241): include('app/design/adminhtml/default/default/template/page.phtml')
#13 app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/default/default/template/page.phtml')
#14 app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#15 app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#16 app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#17 app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#18 app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#19 app/code/core/Mage/Adminhtml/controllers/DashboardController.php(43): Mage_Core_Controller_Varien_Action->renderLayout()
#20 app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_DashboardController->indexAction()
#21 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#22 app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http)
#23 app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#24 app/Mage.php(683): Mage_Core_Model_App->run(Array)
#25 index.php(88): Mage->run('default', 'store')

3 Answers 3

7

Unfortunately, there's not enough information in your question to accurately debug this, and based on the specifics of your call stack, it looks like this system has received a few customizations which may be interfering with standard store behavior. Here's some observations that may help you track down the problem

  1. Magento's trying to include a template block with an empty string set as it's template. That's why you're seeing the warning. Look for any new (or old) setTemplate, or template="" in your code, or any place a template block is instantiated without setting a template

  2. Magento's trying to render the template system/cache/notifications.phtml — however, the fact its fallen back to the base design package to do this means Magento couldn't find this file in any adminhtml package/theme. This is a stock file that ships with the system, and may have been removed

  3. You say you're seeing it "everywhere", but the errors indicate it's an admin only problem. This might mean you're trying to run admin code from the front-end of vice versa (again, hard to remotely debug this sort of thing)

4
  • 1
    Thx Allen. Somethings I noticed. - it does seem to only happen @ backend - there is no /base/default for adminhtml - the file is sitting nicely in app/design/adminhtml/default/default/template/index/notifications.phtml - I suppose it must be an extension with an empty template reference
    – snh_nl
    Commented Aug 12, 2013 at 6:07
  • 2
    Thanks Allen this is solver now. The whole directory /public_html/app/design/adminhtml/default/default/template/system/cache was gone, i.e. empty. I have no idea why and how. But thanks - I copied some files from stock and the error is gone
    – snh_nl
    Commented Aug 12, 2013 at 6:43
  • Thank you, in my case, the error was thrown because I have different template folders, and I created a template in the wrong folder.
    – Kostanos
    Commented Feb 27, 2014 at 19:56
  • It might also be a reference to a non-existing template. In my case used a getChildHtml() to a block that used a non-existing template. Slightly different from your point 1.
    – Jacques
    Commented Apr 12, 2017 at 9:29
2

See How can I debug "empty template": Filename cannot be empty in Template.php

We solved this by adding

    if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
        if (empty($includeFilePath)) {
            Mage::Log("Cannot set emptt filename" . $fileName . " on a " . get_class($this) );
            Mage::log(Mage::printDebugBacktrace(), null, 'backtrace.log'); //or you can even log the backtrace
            include $includeFilePath;
        } else {
            include $includeFilePath;
        }
    } else {
        Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);
    }

where 'Mage::printDebugBacktrace()' was grabbed from here

http://www.blog.magepsycho.com/utilizing-debug_backtrace-function-for-magento-debugging/

This way we had some more info to go by ...

1

All above answers are correct. I just wanted to add a specific case that I think alot of people may stumble uppon.

In case you're using modman to manage your modules (or any other module symlinking manager), make sure that your modman file contains proper paths and after that you did:

modman deploy namespace_module.

Personally I've found myself losing at least 15 minutes for debugging such obvious thing when developing some module and using a generate-modman command to save time - after that forgetting about calling it again so it would add newly created files and deploy symlinks to right place.

1
  • Interesting, I'm having the same error mentioned by OP, and use modman for module deployment. But I wrote all modman files myself, and I found I couldn't even deploy them properly if there were faulty paths. Are you saying this could be the case nonetheless?
    – Asitis
    Commented Mar 14, 2017 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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