Skip to content

Commit

Permalink
[impr-OpenMage#17] Add filename to log msg when a template file doesn…
Browse files Browse the repository at this point in the history
…'t exist

If Magento is not able to locate a file, an error like this is logged:
2015-06-09T11:32:35+00:00 ERR (3): Warning: include(): Filename cannot be empty in app/code/core/Mage/Core/Block/Template.php on line 241

Which is not very helpful. This change makes Magento log a filename
and also fixes the one parameter too much in the Mage::log call.
  • Loading branch information
tmotyl authored and edannenberg committed Sep 19, 2018
1 parent fcb7849 commit 5351a98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Block/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ public function fetchView($fileName)

try {
$includeFilePath = realpath($this->_viewDir . DS . $fileName);
if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
if ($includeFilePath != '' && (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks())) {
include $includeFilePath;
} else {
Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);
Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, true);
}

} catch (Exception $e) {
Expand Down

0 comments on commit 5351a98

Please sign in to comment.