Commit Graph

3949 Commits

Author SHA1 Message Date
Fabien Potencier ba7fdd9122 Merge branch '1.x' into 2.x
* 1.x:
  Update .travis.yml
  fiwed internal link
  Make sure twig_include returns a string
2018-11-30 07:25:29 +01:00
Fabien Potencier 5163803ea5 minor #2769 Update .travis.yml (andreybolonin)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2769).

Discussion
----------

Update .travis.yml

Commits
-------

721fb3f6 Update .travis.yml
2018-11-30 07:24:41 +01:00
Andrey Bolonin 721fb3f615 Update .travis.yml 2018-11-30 07:24:00 +01:00
Fabien Potencier f28e4872ca minor #2778 Remove mention of the Twig C extension (yesdevnull)
This PR was merged into the 2.x branch.

Discussion
----------

Remove mention of the Twig C extension

As per #2318 there's no additional installation methods so it should be removed from the intro page.

Commits
-------

434589bd Remove mention of the Twig C extension
2018-11-30 07:19:08 +01:00
Dan Barrett 434589bd8a Remove mention of the Twig C extension
As per https://github.com/twigphp/Twig/pull/2318
2018-11-30 11:05:44 +11:00
Fabien Potencier f2b8e9acad fiwed internal link 2018-10-12 07:15:08 -07:00
Fabien Potencier 60592fa5f8 bug #2760 Make sure twig_include returns a string (thewilkybarkid)
This PR was merged into the 1.x branch.

Discussion
----------

Make sure twig_include returns a string

Currently returns `null` if `$ignoreMissing` is `true` and it's not found, but the return type is `string`.

Commits
-------

a55f76bf Make sure twig_include returns a string
2018-10-12 05:58:49 -07:00
Fabien Potencier c8020aa5d8 Merge branch '1.x' into 2.x
* 1.x:
  fixed ReST format
  Document combining JSON constants
2018-10-12 05:54:33 -07:00
Fabien Potencier d59dfc979b fixed ReST format 2018-10-12 05:53:19 -07:00
Fabien Potencier eadba855bb minor #2764 Document combining JSON constants (pbowyer)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2764).

Discussion
----------

Document combining JSON constants

Working out how to do this took a Slack conversation and a StackOverflow answer. I'm adding ti to the documentation so others can get the answer immediately.

Apologies for any reST errors, it's been 10+ years since I wrote any.

Commits
-------

7f4ecd66 Document combining JSON constants
2018-10-12 05:51:40 -07:00
Peter Bowyer 7f4ecd66f1 Document combining JSON constants
Working out how to do this took Slack and StackOverflow. Documenting so others know what to do.
2018-10-12 05:51:35 -07:00
Chris Wilkinson a55f76bf4f Make sure twig_include returns a string 2018-10-05 07:46:05 +01:00
Fabien Potencier 5dd532eed8 Merge branch '1.x' into 2.x
* 1.x:
  Improved the code of an example
2018-09-27 16:33:35 +02:00
Fabien Potencier 4eea72c25c minor #2754 Improved the code of an example (javiereguiluz)
This PR was merged into the 1.x branch.

Discussion
----------

Improved the code of an example

The original code contains an unneeded *"pop culture"* reference. For those unaware of it, it contains two strong words ("kill" and "bastard").

The concern about this example was firstly raised in the `#diversity` channel of [Symfony Slack](https://symfony.com/support).

Commits
-------

f07a876d Improved the code of an example
2018-09-27 16:33:24 +02:00
Javier Eguiluz f07a876de6 Improved the code of an example 2018-09-27 16:26:19 +02:00
Fabien Potencier e90c786102 bug #2750 Fix multi-byte UFT-8 in escape('html_attr') (svalgaard)
This PR was merged into the 2.x branch.

Discussion
----------

Fix multi-byte UFT-8 in escape('html_attr')

Alternative to #2734

Commits
-------

dc3acfb7 Fix multi-byte UFT-8 in escape('html_attr')
2018-09-20 16:27:31 +02:00
Fabien Potencier 3da51873fa Merge branch '1.x' into 2.x
* 1.x:
  Fix multi-byte UFT-8 in escape('html_attr')
  added missing test
  Added "deprecated" tag
2018-09-20 16:26:04 +02:00
Fabien Potencier 1e99fb4eb3 bug #2751 Fix multi-byte UFT-8 in escape('html_attr') (nicolas-grekas)
This PR was merged into the 1.x branch.

Discussion
----------

Fix multi-byte UFT-8 in escape('html_attr')

same as #2750 but on  1.x

Commits
-------

8863b68c Fix multi-byte UFT-8 in escape('html_attr')
2018-09-20 16:23:43 +02:00
Nicolas Grekas 8863b68c93 Fix multi-byte UFT-8 in escape('html_attr') 2018-09-20 16:15:47 +02:00
Jens Svalgaard Kohrt dc3acfb7cd Fix multi-byte UFT-8 in escape('html_attr') 2018-09-20 15:45:46 +02:00
Fabien Potencier 82515f6339 added missing test 2018-08-03 07:53:41 +02:00
Fabien Potencier bbe8b3fcdf feature #2696 [RFC] Added new "deprecated" tag (yceruto)
This PR was merged into the 1.x branch.

Discussion
----------

[RFC] Added new "deprecated" tag

```twig
{% deprecated 'The message...' %}
```

This new tag would allow us to define a deprecation warning anywhere within a template, useful for Frameworks, bundles, etc. where breaking the BC is frequently when templates are involved.

It will be easy to guarantee a smooth migration path when we want e.g. rename/remove a template or block, as well as displaying an accurate depreciation message.

**Deprecating a whole template `{# base.twig #}`**
```twig
{% deprecated 'The "' ~ _self ~ '" template is deprecated, use "layout.twig" instead' %}

{% extends 'layout.twig' %}
```
If we're extending from this template `{% extends 'base.twig' %}` then:
```
The "base.twig" template is deprecated, use "layout.twig" instead ("base.twig" at line 1).
```
**Deprecating a block {# greeting/blocks.twig #}**
```twig
{% block hey %}
    {% deprecated 'The "hey" block is deprecated, use "greet" block instead' %}

    {{ block('greet') }}
{% endblock %}

{% block greet %}
    Hey you!
{% endblock %}
```
If we're using this block `{{ block('hey') }}` then:
```
The "hey" block is deprecated, use "greet" block instead ("greeting/blocks.twig" at line 2).
```
also other examples come from my mind like deprecating macros, and any other extension point.

Commits
-------

2ab43383 Added "deprecated" tag
2018-07-31 14:56:40 +02:00
Yonel Ceruto 2ab433833e Added "deprecated" tag 2018-07-31 08:18:50 -04:00
Fabien Potencier 1329b5580f bumped versionn to 2.6 2018-07-31 11:41:48 +02:00
Fabien Potencier 43c558088e fixed bad merge 2018-07-31 11:41:44 +02:00
Fabien Potencier 0837fda1b7 Merge branch '1.x' into 2.x
* 1.x:
  Add support for dynamic tests
2018-07-31 11:40:19 +02:00
Fabien Potencier a14d249004 feature #2730 Add support for dynamic tests (fabpot)
This PR was squashed before being merged into the 1.x branch (closes #2730).

Discussion
----------

Add support for dynamic tests

fixes #2589

Commits
-------

4beb7bfb Add support for dynamic tests
2018-07-31 11:11:03 +02:00
Fabien Potencier 4beb7bfb0b Add support for dynamic tests 2018-07-31 11:10:58 +02:00
Fabien Potencier 70db030571 Merge branch '1.x' into 2.x
* 1.x:
  Fix GlobalsInterface extends for IDE
2018-07-25 15:16:50 +02:00
Fabien Potencier 7a3d825969 bug #2726 Fix GlobalsInterface extends for IDE (ogizanagi)
This PR was merged into the 1.x branch.

Discussion
----------

Fix GlobalsInterface extends for IDE

Commits
-------

0b819abb Fix GlobalsInterface extends for IDE
2018-07-25 15:16:22 +02:00
Maxime Steinhausser 0b819abb0d Fix GlobalsInterface extends for IDE 2018-07-25 15:11:25 +02:00
Fabien Potencier fda20a6336 Merge branch '1.x' into 2.x
* 1.x:
  updated CHANGELOG
  Do not throw error on validate or parse name if throw var is false
2018-07-20 15:30:21 +02:00
Fabien Potencier 03542492e9 updated CHANGELOG 2018-07-20 15:30:04 +02:00
Fabien Potencier 3491e3590e bug #2721 Don't throw error on validate or parse name if throw var is false (yceruto)
This PR was merged into the 1.x branch.

Discussion
----------

Don't throw error on validate or parse name if throw var is false

As spotted here https://github.com/symfony/symfony/issues/28001 `$loader->exists('@foo')` shouldn't throw an exception. e.g.: https://github.com/symfony/symfony/blob/9bfa971bc5662a6f90408b58a7b2453d7dae4f83/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php#L145

Commits
-------

a0e8d58a Do not throw error on validate or parse name if throw var is false
2018-07-20 15:28:02 +02:00
Yonel Ceruto a0e8d58a6e Do not throw error on validate or parse name if throw var is false 2018-07-20 08:04:00 -04:00
Fabien Potencier 60a8f465d6 bumped version to 2.5.1-DEV 2018-07-13 09:18:38 +02:00
Fabien Potencier 6a5f676b77 prepared the 2.5.0 release v2.5.0 2018-07-13 09:18:09 +02:00
Fabien Potencier bcf3f82fff updated CHANGELOG 2018-07-13 09:17:42 +02:00
Fabien Potencier cf392dae9b Merge branch '1.x' into 2.x
* 1.x:
  bumped version to 1.35.5-DEV
  prepared the 1.35.4 release
  updated CHANGELOG
2018-07-13 09:17:29 +02:00
Fabien Potencier cb848ee0a4 bumped version to 1.35.5-DEV 2018-07-13 09:13:09 +02:00
Fabien Potencier 7e081e9837 prepared the 1.35.4 release v1.35.4 2018-07-13 09:12:17 +02:00
Fabien Potencier c45939350b updated CHANGELOG 2018-07-13 09:11:45 +02:00
Fabien Potencier 84b2eb5410 Merge branch '1.x' into 2.x
* 1.x:
  Fix test
2018-06-25 17:02:58 +02:00
Fabien Potencier 76cc34554b minor #2714 Fix test (jderusse)
This PR was merged into the 1.x branch.

Discussion
----------

Fix test

Commits
-------

625ac797 Fix test
2018-06-25 17:02:19 +02:00
Jérémy Derussé 625ac79766 Fix test 2018-06-25 16:36:38 +02:00
Fabien Potencier f9e04df9d3 Merge branch '1.x' into 2.x
* 1.x:
  Use isset before array_key_exists
2018-06-25 15:41:36 +02:00
Fabien Potencier 0f45c2a677 minor #2710 Use isset before array_key_exists (jderusse)
This PR was merged into the 1.x branch.

Discussion
----------

Use isset before array_key_exists

Small performance improvment when using

```
{% set foo = foo|default("bar") %}
```
Will render the following code
```
$context["foo"] = (((isset($context["foo"]) || array_key_exists("foo", $context))) ? (_twig_default_filter((isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new Twig_Error_Runtime('Variable "foo" does not exist.', 1, $this->source); })()), "bar")) : ("bar"));
```

instead of
```
$context["foo"] = ((array_key_exists("foo", $context)) ? (_twig_default_filter((isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new Twig_Error_Runtime('Variable "foo" does not exist.', 1, $this->source); })()), "bar")) : ("bar"));
```

Commits
-------

230d3412 Use isset before array_key_exists
2018-06-25 15:41:18 +02:00
Jérémy Derussé 230d34128d Use isset before array_key_exists 2018-06-25 14:32:40 +02:00
Fabien Potencier 53ca200b96 bug #2702 Fix the error handling for the optimized extension-based function calls (stof)
This PR was merged into the 2.x branch.

Discussion
----------

Fix the error handling for the optimized extension-based function calls

Triggering a Twig_Error_Runtime at compile-time breaks the contract of the Twig environment, as such exception is for errors during the rendering.
This moves back the exception to a runtime one (same behavior than before the optimization).

Another option would be to replace this with a `Twig_Error_Syntax` instead (reporting the error earlier), but that would change the exception being thrown for such case.

Commits
-------

9928ae14 Fix the error handling for the optimized extension-based function calls
2018-06-07 07:44:00 +02:00
Fabien Potencier 4d18a63248 bug #2700 Report the proper location for errors compiled in templates (stof)
This PR was merged into the 2.x branch.

Discussion
----------

Report the proper location for errors compiled in templates

The `{% use %}` and `{% with %}` tags are adding some runtime checks triggering exceptions in the compiled template. This ensures that they get the proper location.
While the guessing was generally working fine for the `{% with %}` (and so this only makes the code faster), the guessing was not working for `{% use %}` due to the exception happening in the class constructor rather than on display (and so the guessing was finding the template which was triggering the load of the faulty template).

Commits
-------

e4423576 Report the proper location for errors compiled in templates
2018-06-07 07:42:53 +02:00