cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Volt parser embedding block error

Open Akhundzada opened this issue 9 years ago • 4 comments

There is an issue when I have a keyword which is called as 'block' in my loops. Parser thinks that it's embedding block and throws an error:

Embedding blocks into other blocks is not supported in

/home/***/***/app/views/manager/article/edit.volt on line 170
#0 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->_compileSource('{% extends "bas...', false)
#1 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->compileFile('/home/*/***...', '/home/*/*...', false)
#2 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->compile('/home/*/*...')
#3 [internal function]: Phalcon\Mvc\View\Engine\Volt->render('/home/*/*...', Array, true)
#4 [internal function]: Phalcon\Mvc\View->_engineRender(Array, 'manager/article...', true, true, NULL)
#5 [internal function]: Phalcon\Mvc\View->render('article', 'edit', Array)
#6 /home/*/*/public/index.php(41): Phalcon\Mvc\Application->handle()
#7 {main}

Source code for reproduce: base.volt

<div>{% block content %}{% endblock %}

child.volt

{% extends "base.volt" %}
{% block content %}

{% for block in article.block %}
...
{% endfor %}

{% endblock %}

Even if I change block to something else in one place, parser still throws error:

{% for b in article.block %}

So the working example looks like this:

{% for b in article.blockS %}

(with 's' on the end)

I think it's a bug.

Akhundzada avatar May 13 '17 15:05 Akhundzada

It is not issue. As you can see in error message:

Embedding blocks into other blocks is not supported

Refs: https://github.com/phalcon/cphalcon/issues/329

sergeyklay avatar May 13 '17 15:05 sergeyklay

@sergeyklay But it's not a block. Please read message carefully – I mention that my object has property which is called 'block'. And in this case parser thinks that it's part of block system.

Akhundzada avatar May 13 '17 16:05 Akhundzada

Oh yeah, I see.

sergeyklay avatar May 13 '17 16:05 sergeyklay

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

stale[bot] avatar Apr 16 '18 16:04 stale[bot]