This PR was merged into the 2.x branch.
Discussion
----------
Remove legacy exception catch blocks from 2.x
These `catch` blocks were only useful for compatibility with PHP versions prior to 7.0.
Commits
-------
352c01a0 Remove legacy exception catches from 2.x
This PR was merged into the 2.x branch.
Discussion
----------
Use null rather than specific length for 'to the end' in mb_substr
We use Twig with a ISO-8859-15 charset and noticed the 'capitalize'-method only yielded the first character of a string. I.e. "abcd" became "A" rather than "Abcd".
This was due to a change in the way mb_substr is used. Appearantly, using 2147483647 as a length to indicate 'everything to the end' only works with UTF-8 (and possibly other multibyte charsets). It probably triggers some internal overflow in php for at least ASCII and ISO-8859-15.
Luckily, an easy fix is available since PHP 5.4.8: just use 'null'
See these two tests for which version does what:
(old) https://3v4l.org/qdpIK
(new) https://3v4l.org/kivqK
I also used null in the slice-method. While it did not suffer from this same issue, it did an unnecessary mb_strlen. And there might be similar overflow issues with negative values of $start, but I didn't actually test that.
Commits
-------
3bea610e Use null rather than specific length for 'all characters to the end' with mb_substr
This PR was merged into the 2.x branch.
Discussion
----------
do not overridde case-insentive cache entries
This will fix#2343.
Commits
-------
2c153bd1 do not overridde case-insentive cache entries
This PR was merged into the 1.x branch.
Discussion
----------
Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version
Not sure if this is testable, yet this should save some hours to people that end up in the same trap we did on our project.
It turned out we generated some twig template cache in two separate commands, in a situation where "index" tracking for embeds where lost.
This PR detects the situation and invites to clear the cache properly, because that's the only way to fix the issue.
It also fixes a mistake in the cache $key generation, that should not take $index into account.
Doing so were making offline cache warmup useless in some situations.
Commits
-------
95c10991 Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version
* 1.x:
updated CHANGELOG
fixed typo
feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
bumped version to 1.31.0
Delay marking the environment as initialized until it is done
Fix the argument name of filter replace
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes#2341).
Discussion
----------
feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
This implements the feature originally suggested by #2045, but specifically in the manner suggested by #2340, which I think is more consistent with existing Twig code.
Commits
-------
bc6a9133 feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
This PR was merged into the 2.x branch.
Discussion
----------
remove condition on PHP version
Twig now requires PHP >= 7 so there is no need to check for prior version.
Commits
-------
df185584 remove condition on PHP version
This PR was merged into the 2.x branch.
Discussion
----------
Typehint the function, filter and test names as string
This gives faster feedback when using the class in a wrong way, instead of getting a ``Warning: Illegal offset type in ExtensionSet.php line 434`` during the function registration (see https://github.com/symfony/symfony/issues/21212 for a case getting this message)
Commits
-------
2b4642c3 Typehint the function, filter and test names as string
This PR was merged into the 1.x branch.
Discussion
----------
Delay marking the environment as initialized until it is done
This avoids breaking the symfony exception page rendering saying that filters are not available due to a partial initialization: https://github.com/symfony/symfony/issues/21212
It would report the initialization error instead.
Commits
-------
a33fb6ce Delay marking the environment as initialized until it is done
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes#2322).
Discussion
----------
Minor typo in class name
Commits
-------
ce90852 Minor typo in class name
This PR was squashed before being merged into the 1.x branch (closes#2265).
Discussion
----------
Optimize usage of Traversable/Iterator
Commits
-------
2bdcfb6 Optimize usage of Traversable/Iterator