Commit Graph

2371 Commits

Author SHA1 Message Date
Fabien Potencier 5e591ec17d bug #1449 Fixed the date filter's timezone not being set correctly with strings (gbouchez)
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
2014-10-14 19:07:31 +02:00
Fabien Potencier 083313abb4 added some failing tests 2014-10-14 19:06:56 +02:00
Fabien Potencier 7bda3b6103 bug #1535 fixed negative number lexing (fabpot)
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
2014-10-14 18:19:19 +02:00
Fabien Potencier bf541bf249 fixed negative number lexing 2014-10-14 18:08:14 +02:00
Fabien Potencier c86e621e09 bug #1538 Fixed the support of 2-word tests without a custom node class (stof)
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
2014-10-14 17:59:33 +02:00
Christophe Coevoet 0082e0523c Fixed the support of 2-word tests without a custom node class 2014-10-14 12:50:18 +02:00
Fabien Potencier 98f1a4b280 simplifies Twig installation instructions 2014-10-14 09:04:21 +02:00
Fabien Potencier 875a56c8fa minor #1534 Delete license in twig extension (Tobion)
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
2014-10-13 14:33:18 +02:00
Fabien Potencier c476a6b1fc added missing tests 2014-10-12 00:29:52 +02:00
Tobias Schultze c8cd7f20ff 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.
2014-10-11 22:49:11 +02:00
Fabien Potencier b5f074207d fixed macros when using an argument named like a PHP super globa 2014-10-11 22:38:36 +02:00
Fabien Potencier d12f7afbbe made it clear that Twig_Loader_String must not be used by end users 2014-10-11 22:30:59 +02:00
Fabien Potencier 0de848bd6e updated CHANGELOG 2014-10-11 22:16:50 +02:00
Fabien Potencier 6121af4e2b fixed CS 2014-10-11 22:16:06 +02:00
Fabien Potencier 8a36022dde bug #1533 Make date_modify work with DateTimeImmutable (globin)
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
2014-10-11 22:13:21 +02:00
Robin Gloster a5fe46fce7 Make date_modify work with DateTimeImmutable 2014-10-11 22:13:17 +02:00
Fabien Potencier d3eda6aedd added some more tests 2014-10-11 18:53:37 +02:00
Fabien Potencier b7f60e4db6 updated CHANGELOG 2014-10-11 01:49:56 +02:00
Fabien Potencier 2f43bec3f9 feature #1443 optimize access to loop, key and value variables (linniksa)
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
2014-10-11 01:43:03 +02:00
Fabien Potencier 1897e184a9 fixed CS 2014-10-11 01:36:34 +02:00
Fabien Potencier b0b03345be updated CHANGELOG 2014-10-11 01:34:30 +02:00
Fabien Potencier 28fc3bb0cd bug #1521 Fix MB characters handling in split (1emming)
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
2014-10-11 01:33:37 +02:00
1emming 8cde52d222 Fix MB characters handling in split 2014-10-11 01:33:34 +02:00
Fabien Potencier 997f2f0823 fixed formatting in the docs 2014-10-11 01:31:53 +02:00
Fabien Potencier fcbfac72d1 updated CHANGELOG 2014-10-11 01:29:15 +02:00
Fabien Potencier a2172363d7 bug #1531 Fixed usage of LimitIterator (grachov)
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
2014-10-11 01:28:34 +02:00
Andrey Grachov f76e67f91d Fixed usage of LimitIterator 2014-10-11 01:28:33 +02:00
Fabien Potencier 84df881b8b bumped version to 1.16.2-DEV 2014-10-10 20:56:23 +02:00
Fabien Potencier 7c4c01dcf5 prepared the 1.16.1 release v1.16.1 2014-10-10 16:09:53 +02:00
Fabien Potencier 943c9cfb12 updated CHANGELOG 2014-10-10 15:58:27 +02:00
Fabien Potencier bad42dbb32 bug #1530 Improved error reporting in a sandboxed template (hason)
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
2014-10-10 15:57:57 +02:00
Fabien Potencier c2a973af13 updated CHANGELOG 2014-10-10 15:47:26 +02:00
Fabien Potencier 194f6a14dc bug #1528 Fixed guessing a template info for exceptions (hason)
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
2014-10-10 15:46:25 +02:00
Fabien Potencier 593c3684b2 updated CHANGELOG 2014-10-10 15:40:19 +02:00
Fabien Potencier 286b36bf66 bug #1527 Fixed resetting debug info in compiler (hason)
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
2014-10-10 15:38:59 +02:00
Martin Hasoň 58efc421dc Improved error reporting in a sandboxed template 2014-10-10 15:36:50 +02:00
Martin Hasoň 42cd697667 Fixed guessing a template info for exceptions 2014-10-10 12:27:07 +02:00
Martin Hasoň 0e7cec5ece Fixed resetting debug info in compiler 2014-10-10 12:25:51 +02:00
Fabien Potencier 9fb15e343e updated CHANGELOG 2014-10-01 19:51:59 +02:00
Fabien Potencier 5b172b5175 bug #1470 Fixed "in" operator (hason)
This PR was merged into the 1.16-dev branch.

Discussion
----------

Fixed "in" operator

Commits
-------

9b6497f Fixed "in" operator
2014-10-01 19:50:35 +02:00
Fabien Potencier 0d0cdba3bb udpated CHANGELOG 2014-10-01 19:13:04 +02:00
Fabien Potencier 1ed333bfb9 feature #1503 Use LimitIterator on Iterable objects within the slice filter (Anthony Sterling)
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
2014-10-01 19:09:15 +02:00
Fabien Potencier 0a179e801a fixed typo 2014-10-01 13:22:22 +02:00
Fabien Potencier 0b2f373fc4 deprecated Node::toXml() 2014-10-01 13:19:23 +02:00
Fabien Potencier fcdb9487cc minor #1509 Update convert_encoding.rst: wrong argument order (binarious)
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
2014-10-01 07:31:33 +02:00
Fabien Potencier 9c12486651 fixed some assertions 2014-09-30 19:44:16 +02:00
Fabien Potencier 53b7001342 bug #1500 fix inconsistent response from twig_slice (rodnaph)
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
2014-09-30 19:40:30 +02:00
Rhodri Pugh c740060051 fix inconsistent response from twig_slice 2014-09-30 19:40:27 +02:00
Fabien Potencier 82cd5475a3 minor #1520 date() documentation correction (brandonkelly)
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
2014-09-30 19:37:32 +02:00
Brandon Kelly 2f5a927b72 date() documentation correction 2014-09-30 10:07:37 -07:00