This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2065).
Discussion
----------
Update macro.rst
Small grammar fix: subject-verb agreement "Macros differ" vs "Macros differs"
Commits
-------
0800545 Update macro.rst
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2066).
Discussion
----------
Update use.rst
Small grammar fix.
Commits
-------
08c830a Update use.rst
This PR was squashed before being merged into the 1.x branch (closes#2043).
Discussion
----------
Fix load cache
In PHP7 @ do not works and it is resource expensive, switching to if statement.
Commits
-------
b5df3d1 Fix load cache
This PR was merged into the 1.x branch.
Discussion
----------
fix a case where the autoescaping does not work as expected
The Twig_NodeVisitor_Escaper collects a list of blocks for all templates that it visits. If you define the same block (i.e. with the same name) in txt and html templates this results sometimes in the html block not being escapes.
This is illustrated in the added test.
To fix it, I propose to reset the list of the blocks for each module.
Alternatively we need to make clear that blocks should not share names between text and html templates.
Commits
-------
48a3487 Reset blocks also in doLeaveNode
ee6965e fix a case where the autoescaping does not work as expected
The Twig_NodeVisitor_Escaper collects a list of blocks for all templates that it visits. If you define the same block (i.e. with the same name) in txt and html templates this results sometimes in the html block not being escapes.
This is illustrated in the added test.
To fix it, I propose to reset the list of the blocks for each module.
Alternatively we need to make clear that blocks should not share names between text and html templates.
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2044).
Discussion
----------
Small fixes
Commits
-------
e81e698 Small fixes
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2029).
Discussion
----------
Grammar
A few grammatical fixes.
Commits
-------
6dd784a Grammar
This PR was merged into the 1.x branch.
Discussion
----------
[DOC] recipes.rst uses Twig_Function_Function
Hello,
Here's a minor update for recipes.rst
I rewrite the code sample for registerUndefinedFunctionCallback to remove usage of deprecated class Twig_Function_Function.
Commits
-------
1a1ba8b [DOC] recipes.rst uses Twig_Function_Function
Hello,
Here's a minor update for recipes.rst
I rewrite the code sample for registerUndefinedFunctionCallback to remove usage of deprecated class Twig_Function_Function.
This PR was merged into the 1.x branch.
Discussion
----------
fix a typo (add missing article)
Commits
-------
e317c55 fix a typo (add missing article)
This PR was merged into the 1.x branch.
Discussion
----------
[ExpressionParser] forbids true, false, null and none keywords for variables names.
Commits
-------
2e02f73 [ExpressionParser] forbids true, false, null and none keywords for variables names.
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2002).
Discussion
----------
Implement Twig_Extension_GlobalsInterface on getGlobals example
I'm not sure if more information is required on when and why getGlobals was deprecated from Twig_Extension.
Refs #2001
Commits
-------
b8a987e Implement Twig_Extension_GlobalsInterface on getGlobals example
This PR was squashed before being merged into the 1.x branch (closes#2005).
Discussion
----------
[Doc] Add a note about escaping backslashes inside strings
Backslashes inside strings caused some confusion for some users. See https://github.com/symfony/symfony/issues/18207
Commits
-------
463ea80 [Doc] Add a note about escaping backslashes inside strings
This PR was merged into the 1.x branch.
Discussion
----------
Promote the include() function instead of the "include" tag
The `{% include %}` tag is pseudo-officially deprecated in favor of the `include()` function. Let's update the documentation to promote the function instead of the tag.
Commits
-------
ea090df Promote the include() function instead of the "include" tag
This PR was merged into the 1.x branch.
Discussion
----------
Fixed minor syntax issues in templates.rst
Commits
-------
4788e53 Fixed minor syntax issues in templates.rst
This PR was merged into the 1.x branch.
Discussion
----------
Clarify exception message in Twig_Template::getAttribute
When a non existing property/method is called for an object, the exception message is:
> Method "property()" for object "[class]" does not exist in [template]"
But in fact the `Twig_Template::getAttribute()` method check for (at least) 3 more methods (`isProperty()`, `getProperty()` and `__call__()`).
It could be more adapted and easier to be debugged if the message would be:
> Neither the property "property" nor one of the methods "property]()", "getProperty()"/"isPropertyt()" or "__call()" exist and have public access in class "[class]" in [template]
This message is mostly inspired from the one used in the PropertyAccess component.
BTW I think that it would be great to replace all the checks listed above by a `PropertyAccessor::isReadable([property])`.
I can work on a PR if it's not overkill.
Commits
-------
d455b52 Clarify exception message in Twig_Template::getAttribute
Add missing parenthesis
Adapt twig.c extension
Update the C extension
Use php_ucfirst instead of ucfirst
Try to implement a TWIG_UCFIRST in C extension
Last try ucfirst
Rollback twig.c extension
Remove useless ucfirst + update twig.c extension
Fix mis-escaped char
Repeat argument item for sprintf (first try doesnt work)
Remove unexpected breakline in code
This PR was merged into the 1.x branch.
Discussion
----------
marked some Twig_Environment methods as being internal
This PR marks some `Twig_Environment` methods as being internals:
* `getFunctions()`, `getFilters()`, `getTests()`, `getFunction()`, `getFilter()`, `getTest()`, `getTokenParsers()`, `getTags()`, `getNodeVisitors()`, `getUnaryOperators()`, `getBinaryOperators()` because I don't see how they can be used in any useful way and anyway, `getFunctions()` and `getFilters()` do not return all possible functions or filters. Moreover, I think that all this logic could be refactored and moved into its own class for 2.0 (could be done by deprecating those existing methods in 1.x if we agree to merge this PR).
* `getGlobals()` because it should only be called in a runtime context, not in a compilation one (so limiting its usage to internal use only allows for better control of usage).
* `initGlobals()`, `initExtensions()`, `initExtension()` because they are private in Twig 2.0.
Commits
-------
212730a marked some Twig_Environment methods as being internal
This PR was merged into the 1.x branch.
Discussion
----------
fixed the defined test when used on a constant, a map, or a sequence
Commits
-------
62e8ee3 fixed the defined test when used on a constant, a map, or a sequence
This PR was merged into the 1.x branch.
Discussion
----------
Use strict comparison for charset
There is no reason not to use strict comparison here. Also some minor cs fixes.
Commits
-------
4f32737 compare charset strictly