This PR was merged into the 1.16-dev branch.
Discussion
----------
Update phpdoc for date filter/function
Commits
-------
7b4c537 Update phpdoc for date filter/function
This PR was merged into the 1.16-dev branch.
Discussion
----------
Fixed the date filter's timezone not being set correctly with strings
When the date filter is used on a string and the timezone argument is specified, the timezone is ignored because of this :
$date = new DateTime($date, $defaultTimezone);
if (false !== $timezone) {
$date->setTimezone($defaultTimezone);
}
Since the date is initialized with `$defaultTimezone` as its timezone, using `$date->setTimezone($defaultTimezone);` has no effect, and the date is displayed without changes since it is considered to already be from this timezone.
Might fix issue #1340
Commits
-------
44aaa5b Fixed the date filter's timezone not being set correctly with strings
This PR was merged into the 1.16-dev branch.
Discussion
----------
fixed negative number lexing
Fixes#1368 and #1322.
I don't see it breaking BC as relying on the current way seems weird to me.
Commits
-------
bf541bf fixed negative number lexing
This PR was merged into the 1.16-dev branch.
Discussion
----------
Fixed the support of 2-word tests without a custom node class
Fixes#1537
Commits
-------
0082e05 Fixed the support of 2-word tests without a custom node class
This PR was merged into the 1.16-dev branch.
Discussion
----------
Delete license in twig extension
This file is outdated and does not seem useful as there is already a license in the root which covers also this.
Commits
-------
c8cd7f2 Delete license in twig extension
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