Error "A block definition cannot be nested under non-capturing nodes" not emitted when there is no parent
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Reproduce both Twig templates and trace how block definitions nested under non-capturing nodes are validated, comparing the case with and without the extends statement. Determine why the two templates differ, then make their behavior consistent and add a regression test covering both cases.
Written by the indexing model from the issue text.
Description
When rendering the following template, I get the error A block definition cannot be nested under non-capturing nodes:
{% extends "layout.twig" %}
{% if false %}
{% block content %}FOO{% endblock %}
{% endif %}
(note that there is no need for the layout.twig template to exist for the error to be thrown)
But when rendering the following one, I don't get any error:
{% if false %}
{% block content %}FOO{% endblock %}
{% endif %}
In both cases, there is a block definition nested under a non-capturing node (if), so why is the first template failing and why is the second one not failing?
- Dominant language
- PHP
- Stars
- 8.4k
- Forks
- 1.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 37
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from twigphp/Twig
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RSS-Bridge/rss-bridge#5098 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phingofficial/phing#2025 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
silverstripe/developer-docs#911 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100