1994 Commits

Author SHA1 Message Date
Fabien Potencier 85e8372c45 prepared the 2.3.2 release 2017-04-20 18:13:02 -06:00
Fabien Potencier bda3380e6f Merge branch '1.x' into 2.x
* 1.x:
  bumped version to 1.33.3-DEV
  prepared the 1.33.2 release
  fixed edge case in the method cache for Twig attributes
2017-04-20 18:10:40 -06:00
Fabien Potencier ef680be80e bumped version to 1.33.3-DEV 2017-04-20 11:41:13 -06:00
Fabien Potencier dd6ca96227 prepared the 1.33.2 release 2017-04-20 11:39:48 -06:00
Fabien Potencier 413be4167b fixed edge case in the method cache for Twig attributes 2017-04-18 16:52:31 -06:00
Fabien Potencier 4335780853 bumped version to 2.3.2-DEV 2017-04-18 15:50:49 -06:00
Fabien Potencier 437efc4356 prepared the 2.3.1 release 2017-04-18 15:50:11 -06:00
Fabien Potencier 530be06a5a bumped version to 1.33.2-DEV 2017-04-18 15:44:30 -06:00
Fabien Potencier a87f959f4b prepared the 1.33.1 release 2017-04-18 15:43:11 -06:00
Fabien Potencier a601312031 Merge branch '1.x' into 2.x
* 1.x:
  Wrong stdClass class name generates warning
  added more is_object() safegaruds
  Autoescape test addition; collision fix in Array Loader.
  test if is_object before calling method_exists, fixes #2431
  bumped version to 1.33.1-DEV
  prepared the 1.33.0 release
2017-04-18 08:02:34 -06:00
Fabien Potencier dc70f3e826 added more is_object() safegaruds 2017-04-05 16:23:01 -07:00
Fabien Potencier 4a722dd02f bug #2433 Fix #2431 (mpdude)
This PR was merged into the 1.x branch.

Discussion
----------

Fix #2431

See title

Commits
-------

a5c2da6d test if is_object before calling method_exists, fixes #2431
2017-04-05 16:21:29 -07:00
dave-newson da82b41ac2 Autoescape test addition; collision fix in Array Loader. 2017-04-05 16:19:30 -07:00
Matthias Pigulla a5c2da6de0 test if is_object before calling method_exists, fixes #2431 2017-03-24 15:59:34 +01:00
Fabien Potencier 84dea3134b bumped version to 2.3.1-DEV 2017-03-22 08:42:21 -07:00
Fabien Potencier 9718186a5d prepared the 2.3.0 release 2017-03-22 08:41:51 -07:00
Fabien Potencier c622995d6d bumped version to 1.33.1-DEV 2017-03-22 08:40:48 -07:00
Fabien Potencier 05cf49921b prepared the 1.33.0 release 2017-03-22 08:40:09 -07:00
Fabien Potencier 3a4a9fea63 removed PHP 5.2 condition 2017-03-22 08:25:02 -07:00
Fabien Potencier c019689647 Merge branch '1.X' into 2.x
* 1.X:
  fixed PHP 5.2 compat
2017-03-22 08:24:50 -07:00
Fabien Potencier 755b101ff5 fixed PHP 5.2 compat 2017-03-22 08:24:38 -07:00
Fabien Potencier f5596be101 Merge branch '1.x' into 2.x
* 1.x:
  updated CHANGELOG
  Call clearstatcache() before calling is_dir().
  bumped version to 1.33
  fixed CHANGELOG
  Make "length" filter and "empty" test consider __toString [Twig 1.x]
2017-03-22 08:12:17 -07:00
Shigeki Morimoto 96638c0da6 Call clearstatcache() before calling is_dir(). 2017-03-22 08:05:13 -07:00
Fabien Potencier 5040e38885 bumped version to 1.33 2017-03-22 07:48:20 -07:00
Fabien Potencier f8d4c096ae feature #2420 Make "length" filter and "empty" test consider __toString [Twig 1.x] (mpdude)
This PR was squashed before being merged into the 1.x branch (closes #2420).

Discussion
----------

Make "length" filter and "empty" test consider __toString [Twig 1.x]

Use case: When you have variables in your views that are actually objects but implement `__toString`, they feel like strings: For example, `{{ something }}` will make use of that to-string-conversion.

What does *not* work is

**a)** `{{ something | length }}`, because that will only have a meaningful return value for objects implementing `\Countable`. This interface, however, may have a totally different semantic/purpose for the object in question.

**b)** `{% if something is empty %}`, because

> empty checks if a variable is an empty string, an empty array, an empty hash, exactly false, or exactly null  `[http://twig.sensiolabs.org/doc/2.x/tests/empty.html]`

... and obviously `something !== null` in this case.

For template designers, this may be surprising if they don't actually care about the object-or-string difference, they just "use" the variable.

This change tries to address this as it changes the behavior for  such objects that have a `__toString` method and are *not* `\Countable`.

*Yes*, it's a BC break in edge cases:

For a), objects that implement a `__toString` but not `\Countable` would previously yield `1` for `{{ object | length }}`, and now would return the length of the string returned by `__toString`.

For b), testing (defined) variables that are objects implementing  `__toString` and that return `''`,  the test now is `false`.

Commits
-------

f5193e92 Make "length" filter and "empty" test consider __toString [Twig 1.x]
2017-03-22 07:45:54 -07:00
Matthias Pigulla f5193e92c5 Make "length" filter and "empty" test consider __toString [Twig 1.x] 2017-03-22 07:33:03 -07:00
Fabien Potencier 4d40c66dbc Merge branch '1.x' into 2.x
* 1.x:
  fixed risky tests
2017-03-20 09:12:13 -07:00
Fabien Potencier 7259e52fa4 fixed risky tests 2017-03-20 08:35:32 -07:00
Fabien Potencier 563f6d0de4 Merge branch '1.x' into 2.x
* 1.x:
  Fixed JS escaping for unicode characters with higher code points
2017-03-17 10:22:07 -07:00
Mike Almond 7f9134952d Fixed JS escaping for unicode characters with higher code points 2017-03-17 10:19:06 -07:00
Fabien Potencier ea2ca30d00 Merge branch '1.x' into 2.x
* 1.x:
  Updated the vim-twig link
  PHPUnit 6 compatability
  Fix codeblock
  Update Compiler.php
2017-03-12 08:30:20 -07:00
Pierre du Plessis 4587f67621 Add error message when calling parent() in a block that doesn't exist 2017-03-10 08:55:35 -08:00
SpacePossum 9de41cfed9 Update Compiler.php 2017-03-08 18:10:11 +01:00
Fabien Potencier 82004b85f8 bug #2384 Fix undef. source in exception. (SpacePossum)
This PR was merged into the 2.x branch.

Discussion
----------

Fix undef. source in exception.

closes https://github.com/twigphp/Twig/issues/2383

Two things:
- the tests fails without a corrupt cache, so maybe the message is of or the cache generation is off (i.e. not respecting the `$index`)
- passing the `$source` seems superfluous (but maybe that is only the case in the exception message)

Commits
-------

772373cf Fix undef. source in exception.
2017-03-05 13:51:23 -08:00
Fabien Potencier 31bf7951fd bumped version to 2.2.1-DEV 2017-02-26 16:17:12 -08:00
Fabien Potencier 29bb02dde0 prepared the 2.2.0 release 2017-02-26 16:16:20 -08:00
Fabien Potencier d37b38d79b Merge branch '1.x' into 2.x
* 1.x:
  bumped version to 1.32.1-DEV
  prepared the 1.32.0 release
  udpated CHANGELOG
  improved some tests
  removed trailing space
2017-02-26 16:08:51 -08:00
Fabien Potencier 27d7ea9675 bumped version to 1.32.1-DEV 2017-02-26 16:07:56 -08:00
Fabien Potencier 9935b662e2 prepared the 1.32.0 release 2017-02-26 16:07:03 -08:00
Fabien Potencier 8ff73ca55b removed trailing space 2017-02-23 06:56:46 -08:00
Fabien Potencier 4569e476a8 Merge branch '1.x' into 2.x
* 1.x:
  fixed CS
  #1802 left/right trim
2017-02-23 06:55:46 -08:00
Fabien Potencier af0d787c43 fixed CS 2017-02-23 06:54:27 -08:00
Antony D'Andrea 7d8e75504c #1802 left/right trim 2017-02-23 06:52:03 -08:00
Fabien Potencier 236c429ee0 Merge branch '1.x' into 2.x
* 1.x:
  added some missing tests
2017-02-21 18:52:53 -08:00
Fabien Potencier 236c1bdc32 added some missing tests 2017-02-21 18:49:28 -08:00
Fabien Potencier 39c74d99db Merge branch '1.x' into 2.x
* 1.x:
  Fix tokenize call in DeprecationCollector
2017-02-21 08:25:58 -08:00
Vincent Dechenaux 13ca97c16f Fix tokenize call in DeprecationCollector 2017-02-21 07:46:38 -08:00
Fabien Potencier a818ab3ac3 bumped version to 2.2 2017-02-17 11:33:43 -08:00
Fabien Potencier 9578c35227 Merge branch '1.x' into 2.x
* 1.x:
  fixed tests for PHP 5.2
  fixed tests for PHP 5.2
  fixed tests for PHP 5.2
  Fix typo in test filename
  added a note in the docs about the PSR-11 runtime loader
  fixed typo
  updated CHANGELOG
  bumped version to 1.32
  Add ContainerRuntimeLoader
  tweaked docs
  Update striptags.rst
  fixed CS
  Mention autoescape=true deprecation (issue #2386)
  Fix typo.
  bumped version to 1.31.1-DEV
  prepared the 1.31.0 release
  added a note about macros usage in the deprecated docs
2017-02-17 11:32:53 -08:00
Fabien Potencier c9ce259c9f fixed typo 2017-02-17 11:15:01 -08:00