Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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).



33.6k
Accepted
answer

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