0

I'm getting the below warning error in my Magento system.log and I can't figure out what could be causing it.

2015-11-06T11:56:19+00:00 ERR (3): Warning: File not found: /var/www/magento-root/app/design/frontend/custom-design-package/default/template  in /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php on line 241

It says file not found on a directory rather than a file which is confusing.

I've looked in Mage/Core/Block/Template.php at line 241 (include $includeFilePath;) and can't see what could be causing it.

    public function fetchView($fileName)
    {
        Varien_Profiler::start($fileName);

        // EXTR_SKIP protects from overriding
        // already defined variables
        extract ($this->_viewVars, EXTR_SKIP);
        $do = $this->getDirectOutput();

        if (!$do) {
            ob_start();
        }
        if ($this->getShowTemplateHints()) {
            echo <<<HTML
<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
<div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial;
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'"
onmouseout="this.style.zIndex='998'" title="{$fileName}">{$fileName}</div>
HTML;
            if (self::$_showTemplateHintsBlocks) {
                $thisClass = get_class($this);
                echo <<<HTML
<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial;
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'" onmouseout="this.style.zIndex='998'"
title="{$thisClass}">{$thisClass}</div>
HTML;
            }
        }

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

        } catch (Exception $e) {
            ob_get_clean();
            throw $e;
        }

        if ($this->getShowTemplateHints()) {
            echo '</div>';
        }

        if (!$do) {
            $html = ob_get_clean();
        } else {
            $html = '';
        }
        Varien_Profiler::stop($fileName);
        return $html;
    }

Any ideas, Sorry I don't have more info.


UPDATE

$this->_viewDir . DS . $fileName (l. 239) evaluates to

/var/www/magento-root/app/design/frontend/my-theme/default/template/manapro/filtertree/item.phtml
ManaPro_FilterTree_Block_Item

And the class name of $this is ManaPro_FilterTree_Block_Item which extends Mage_Core_Block_Template.

Also here is the full stack trace.

Warning: include(/var/www/magento-root/app/design/frontend/my-theme/default/template): failed to open stream: No such file or directory  in /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php on line 241

#0 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(241): mageCoreErrorHandler(2, 'include(/var/ww...', '/var/www/houseo...', 241, Array)
#1 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(241): Mage_Core_Block_Template::fetchView()
#2 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/my-theme/de...')
#3 /var/www/magento-root/app/code/community/Nexcessnet/Turpentine/Block/Product/Compared.php(27): Mage_Core_Block_Template->renderView()
#4 /var/www/magento-root/app/code/core/Mage/Core/Block/Abstract.php(919): Nexcessnet_Turpentine_Block_Product_Compared->_toHtml()
#5 /var/www/magento-root/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 /var/www/magento-root/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#7 /var/www/magento-root/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#8 /var/www/magento-root/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#9 /var/www/magento-root/app/design/frontend/blacknwhite/default/template/page/2columns-left.phtml(50): Mage_Core_Block_Abstract->getChildHtml('left')
#10 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/houseo...')
#11 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/blackn...')
#12 /var/www/magento-root/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#13 /var/www/magento-root/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#14 /var/www/magento-root/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#15 /var/www/magento-root/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#16 /var/www/magento-root/app/code/core/Mage/Catalog/controllers/CategoryController.php(161): Mage_Core_Controller_Varien_Action->renderLayout()
#17 /var/www/magento-root/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_CategoryController->viewAction()
#18 /var/www/magento-root/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('view')
#19 /var/www/magento-root/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#20 /var/www/magento-root/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#21 /var/www/magento-root/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#22 /var/www/magento-root/index.php(83): Mage::run('', 'store')
#23 {main}

app/code/community/Nexcessnet/Turpentine/Block/Product/Compared.php seems to be part of the issue.

<?php

/**
 * Nexcess.net Turpentine Extension for Magento
 * Copyright (C) 2012  Nexcess.net L.L.C.
 */

class Nexcessnet_Turpentine_Block_Product_Compared extends Mage_Reports_Block_Product_Compared {

    protected function _toHtml()
    {
        if (!$this->getCount()) {
            return $this->renderView();
        }

        $this->setRecentlyComparedProducts($this->getItemsCollection());

        return parent::_toHtml();
    }
}

In particular return $this->renderView(); evaluates to just an empty string, "". And when I disable the Nexcessnet_Turpentine the warning goes away.

1

The $includeFilePath is a calculated/modified value and not directly the source of your trouble. In order to track that down, you need to

  1. find out what $this->_viewDir . DS . $fileName (l. 239) evaluates to and
  2. what block type (class name of $this, descendant of Mage_Core_Block_Template) is affected when the error occurs.

I am pretty sure that an invalid template file is set to a block.

  • @mam08xio, what exactly do you mean by an invalid template file is set to a block? Do you mean that a template has been assigned to the wrong block type? Thanks for the tips, It's only occuring on our production enviroment so I'll try out your suggestions with a fresh DB dump soon. – Holly Nov 6 '15 at 14:05
  • By invalid template file I mean a file that does not exist in the file system. The file name is determined by the concatenation given above. If template files are symlinked, make sure the system configuration setting dev/template/allow_symlink is correct. – mam08ixo Nov 6 '15 at 14:12
  • @marn08ixo I have Allow Symlinks set to No as it is a production enviroment – Holly Nov 6 '15 at 14:17
  • That is fine as long as your template files are not symlinked :) – mam08ixo Nov 6 '15 at 14:20
  • I finally got around to debugging this locally, still can't figure it out. I've updated my answer with more details, if you have time to look over it? Thanks – Holly Feb 5 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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