3597 Commits

Author SHA1 Message Date
Fabien Potencier 85e8372c45 prepared the 2.3.2 release v2.3.2 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 v1.33.2 2017-04-20 11:39:48 -06:00
Fabien Potencier 0db54be684 bug #2449 fixed edge case in the method cache for Twig attributes (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed edge case in the method cache for Twig attributes

closes #2447

Commits
-------

413be416 fixed edge case in the method cache for Twig attributes
2017-04-20 11:37:13 -06:00
Fabien Potencier 6a8c3f9f9b fixed typo 2017-04-19 10:10:16 -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 v2.3.1 2017-04-18 15:50:11 -06:00
Fabien Potencier 0398cfddf6 Merge branch '1.x' into 2.x
* 1.x:
  bumped version to 1.33.2-DEV
  prepared the 1.33.1 release
  updated CHANGELOG
2017-04-18 15:47:32 -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 v1.33.1 2017-04-18 15:43:11 -06:00
Fabien Potencier 9b417f4212 updated CHANGELOG 2017-04-18 15:38:12 -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 dab65824ec minor #2448 Wrong stdClass class name generates warning (chrisCheeseBurgames)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #2448).

Discussion
----------

Wrong stdClass class name generates warning

Commits
-------

38987c93 Wrong stdClass class name generates warning
2017-04-18 07:54:16 -06:00
Christophe SAUVEUR 38987c9349 Wrong stdClass class name generates warning 2017-04-18 07:53:53 -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
Fabien Potencier cede5f3fbf minor #2434 Autoescape test addition; collision fix in Array Loader. (dave-newson)
This PR was squashed before being merged into the 1.x branch (closes #2434).

Discussion
----------

Autoescape test addition; collision fix in Array Loader.

This PR makes two changes. It was created while testing a third issue that was discovered to be fixed in the latest version.

## Added JS to Autoescape: name test

This adds "index.js.html" to the autoescape:name test, proving the functionality of the JS escape system and the name guessing strategy.

## Fixed collision in Array Loader

While trying to run the above test, it was discovered that the Array Loader uses the content of the template file as the "key" for determining which compiled template to load.
As the above test uses identical content for both HTML and JS templates this led to the compiled HTML template always being loaded.

This change prepends the content with the filename, which vaguely follows the same mechanism as the "options" (which are appended after `getCacheKey` is called).

**This change might be a backwards-incompatible change** depending on your interpretation of how `Loader/Array` is intended to be used.
The class itself states:
> This loader should only be used for unit testing.

The assumption is it's OK for this to occur.

Test cases have been updated to take this key change into account, and an additional test has been added to confirm `Loader/Array` specifically has the capability to resolve two files with the same content to different keys.

Commits
-------

da82b41a Autoescape test addition; collision fix in Array Loader.
2017-04-05 16:19:31 -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 v2.3.0 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 v1.33.0 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
Fabien Potencier 82ff9d6bb4 updated CHANGELOG 2017-03-22 08:06:31 -07:00
Fabien Potencier eaf6a3000d bug #2262 Call clearstatcache() before calling is_dir(). (hanabokuro)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #2262).

Discussion
----------

Call clearstatcache() before calling is_dir().

The result of is_dir() is cached.
So call clearstatcache() before calling 2nd is_dir().

Commits
-------

96638c0d Call clearstatcache() before calling is_dir().
2017-03-22 08:05:13 -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 8441aaab03 fixed CHANGELOG 2017-03-22 07:47:32 -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 98f0d2b128 minor #2429 fixed risky tests (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed risky tests

Commits
-------

7259e52f fixed risky tests
2017-03-20 08:49:31 -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
Fabien Potencier ae2d59da05 bug #2427 Fixed JS escaping for unicode characters with higher code points (mikealmond)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2427).

Discussion
----------

Fixed JS escaping for unicode characters with higher code points

Unicode characters with higher code points were being escaped incorrectly. When these characters are escaped, they should maintain their surrogate halves. Previously, Twig was dropping the first surrogate half.

https://mathiasbynens.be/notes/javascript-escapes#unicode-code-point
> The tetragram for centre symbol (𝌆) has code point U+1D306, so you could write it as \u{1D306}. For comparison, if you were to use simple Unicode escapes to represent this symbol, you’d have to write out the surrogate halves separately: '\uD834\uDF06'.

Commits
-------

7f913495 Fixed JS escaping for unicode characters with higher code points
2017-03-17 10:19:15 -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
Fabien Potencier c5ba65ca44 minor #2422 Updated the vim-twig link (InFog)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2422).

Discussion
----------

Updated the vim-twig link

The other project is not maintained anymore and the author recommends this fork.

Commits
-------

955d5abd Updated the vim-twig link
2017-03-12 08:19:55 -07:00
Evaldo Junior 955d5abd92 Updated the vim-twig link
The other project is not maintained anymore and the author recommends this fork.
2017-03-12 08:19:54 -07:00
Fabien Potencier 3fddfd41d0 minor #2423 PHPUnit 6 compatability (xabbuh)
This PR was merged into the 1.x branch.

Discussion
----------

PHPUnit 6 compatability

This should make builds on Traivs CI green again.

Commits
-------

0d791de6 PHPUnit 6 compatability
2017-03-12 08:17:33 -07:00
Christian Flothmann 0d791de63d PHPUnit 6 compatability 2017-03-11 20:03:13 +01:00
Fabien Potencier 261c4ec92d bug #2415 Add error message when calling parent() in a block that doesn't exist (pierredup)
This PR was squashed before being merged into the 2.x branch (closes #2415).

Discussion
----------

Add error message when calling parent() in a block that doesn't exist

Related: #2309

When calling `parent()` in a block that isn't defined in the parent template, you get an error message that states `Block "%s" on template "%s" does not exist`, even if the block is wrapped in an `is defined` check, which is confusing and makes debugging hard.

This fix adds a better error message indicating that you should not call `parent()` when the parent block is not defined.

Before:
![screen shot 2017-03-08 at 08 08 38](https://cloud.githubusercontent.com/assets/144858/23693410/0e476242-03dd-11e7-9621-4442bdc6bf05.png)

After:
![screen shot 2017-03-08 at 08 56 18](https://cloud.githubusercontent.com/assets/144858/23693424/234d9c2e-03dd-11e7-8d07-4e277d80f7e4.png)

Commits
-------

4587f676 Add error message when calling parent() in a block that doesn't exist
2017-03-10 08:55:37 -08: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
Fabien Potencier efb110d3d0 minor #2421 Fix codeblock in recipes documentation (aaa2000)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2421).

Discussion
----------

Fix codeblock in recipes documentation

Commits
-------

adba4c2a Fix codeblock
2017-03-10 08:51:30 -08:00