We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Error in Volt view rendering Phalcon 2.1.0.beta1. Not reproducible in Phalcon 2.0.7

I have "views/content/index.twig" with content {% extends "_base.twig" %} and "views/_base.twig" with some another content.

    $di->setShared('view', function ()
    {
        $view = new \Phalcon\Mvc\View();
        $view->setViewsDir(VIEWS_DIR);
        $view->registerEngines(array(
            '.twig' => function($view, $di)
            {
                $voltEngine = new Phalcon\Mvc\View\Engine\Volt($view, $di);
                $voltEngine->setOptions(array(
                    'compiledPath' => function ($templatePath)
                    {
                    // ----------------------- breakpoint here
                        $result = str_replace(VIEWS_DIR, VIEWS_CACHE_DIR, $templatePath) . '.txt';
                        $resultParentDir = dirname($result);
                        if (!is_dir($resultParentDir))
                        {
                            mkdir($resultParentDir, 0755, true);
                        }
                        return $result;
                    }
                ));
                return $voltEngine;
            }
        ));
        return $view;
    });

if I use Phalcon 2.0.7 - Windows x86 for PHP 5.6.0 (vc11) - all works as expected. But if I use Phalcon 2.1.0.beta1 - Windows x86 for PHP 5.6.0 (vc11) - then receive error "Template file Array_base.twig does not exist".

At breakpoint I can see $templatePath = Z:/home/myproject/views/content/index.twig first time (as expected), and Array_base.twig second time (as not expected).



34.6k
Accepted
answer

I think this is already fixed but the DLL does not have the fix yet.