This PR was squashed before being merged into the 1.16-dev branch (closes#1533).
Discussion
----------
Make date_modify work with DateTimeImmutable
Use the return value of `$date->modify` because `DateTimeImmutable::modify`
returns the modified object and does not modify the object modify was
called on.
Commits
-------
a5fe46f Make date_modify work with DateTimeImmutable
This PR was merged into the 1.16-dev branch.
Discussion
----------
optimize access to loop, key and value variables
small optimization variable access (loop, key and value) inside for loop
Commits
-------
33ca8d1 optimize access to loop, key and value variables
This PR was squashed before being merged into the 1.16-dev branch (closes#1521).
Discussion
----------
Fix MB characters handling in split
The PR fixes using multibyte characters in the ```split```-filter
Since I messed up the rebase of https://github.com/fabpot/Twig/pull/1446 I created a new PR.
Let me know if this something that is kind of wanted, thanks!
Commits
-------
8cde52d Fix MB characters handling in split
This PR was squashed before being merged into the 1.16-dev branch (closes#1531).
Discussion
----------
Fixed usage of LimitIterator
When you want to get all items from the start position to the end, for `array_slice` you should pass `null` as the `length` argument, while for `LimitIterator` it should be `-1`.
Commits
-------
f76e67f Fixed usage of LimitIterator
This PR was merged into the 1.16-dev branch.
Discussion
----------
Improved error reporting in a sandboxed template
Commits
-------
58efc42 Improved error reporting in a sandboxed template
This PR was merged into the 1.16-dev branch.
Discussion
----------
Fixed guessing a template info for exceptions
Commits
-------
42cd697 Fixed guessing a template info for exceptions
This PR was merged into the 1.16-dev branch.
Discussion
----------
Fixed resetting debug info in compiler
Commits
-------
0e7cec5 Fixed resetting debug info in compiler
This PR was merged into the 1.16-dev branch.
Discussion
----------
Use LimitIterator on Iterable objects within the slice filter
Previously the `slice` filter would create an array of items if the subject to be sliced implemented Traversable, this PR instead passes the subject to LimitIterator first - but only if `$start` and `$length` are positive values as LimitIterator does not support the "n'th from end" behaviour.
Our use case is that we have an API client, which we pass to slice, that implements Traversable but lazy loads the items to be returned via an API when `Iterator::current()` is called. Here a quick example:-
```
{% for item in client.items | slice(0,5) %}
{{ item.name }}
{% endfor %}
<img src="/assets/useless-sodding-banner.jpg" />
{% for item in client.items | slice(5,10) %}
{{ item.name }}
{% endfor %}
```
Current behaviour would mean that the client would issue 15 requests to the API, 5 for the first block, and 10 for the second (but only return items 5 to 10). This PR means only 10 requests are made, 5 in each block.
I'd imagine this would lower memory usage too.
Commits
-------
fdddb1c Use LimitIterator on Iterable objects within the splice filter
This PR was merged into the 1.16-dev branch.
Discussion
----------
Update convert_encoding.rst: wrong argument order
The arguments are in incorrect order. The first should be `to` and the second should be `from` - just like the text describes it.
Commits
-------
4e1d9a7 Update convert_encoding.rst
This PR was squashed before being merged into the 1.16-dev branch (closes#1500).
Discussion
----------
fix inconsistent response from twig_slice
twig_slice can return a boolean when slicing a string outside of its bounds and mbstring is not available. this would cause a knock-on error in twig_first/twig_last when calling current()
this (as suggested) adds a cast to emulate the behaviour of mb_substr for substr.
Commits
-------
c740060 fix inconsistent response from twig_slice
This PR was merged into the 1.16-dev branch.
Discussion
----------
date() documentation correction
The date() docs were incorrectly stating that the argument should be in a format supported by PHP’s [date()](http://php.net/manual/en/function.date.php) function. That’s true of the |date filter which is used to _format_ dates, but not the date() function, which is used to _create_ new dates.
I double-checked the code and whatever you pass into date() ultimately will get passed to a [DateTime constructor](http://php.net/manual/en/datetime.construct.php), which accepts an actual date string, formatted in one of PHP’s [date and time format](http://php.net/manual/en/datetime.formats.php), which is a different beast than the actual format definition string you might pass into PHP’s date() function.
Commits
-------
2f5a927 date() documentation correction
This PR was merged into the 1.16-dev branch.
Discussion
----------
Update installation.rst
Refer to PGP signature verification in the installation instructions for tarballs.
Commits
-------
3c48cb1 Update installation.rst
This PR was merged into the 1.16-dev branch.
Discussion
----------
Added note about array_merge php function
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
Just a small doc improvement.
Commits
-------
f712b8f Added note about array_merge php function
This PR was merged into the 1.16-dev branch.
Discussion
----------
Delimit comment in template using correct syntax
Enclose the comment in '{# #}' instead of beginning line with '#'.
Commits
-------
4e1515c Delimit comment in template using correct syntax