Notification, sudden error: Warning: include(): Filename cannot be empty
Question
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')
Solution
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
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
, ortemplate=""
in your code, or any place a template block is instantiated without setting a templateMagento's trying to render the template
system/cache/notifications.phtml
— however, the fact its fallen back to thebase
design package to do this means Magento couldn't find this file in anyadminhtml
package/theme. This is a stock file that ships with the system, and may have been removedYou 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)
OTHER TIPS
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 ...
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.