Skip to content

Commit 5351a98

Browse files
tmotyledannenberg
authored andcommitted
[impr-OpenMage#17] Add filename to log msg when a template file doesn'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.
1 parent fcb7849 commit 5351a98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/code/core/Mage/Core/Block/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ public function fetchView($fileName)
237237

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

246246
} catch (Exception $e) {

0 commit comments

Comments
 (0)