From c8f69d764b3c18bad1d901b3670c53e40d97cf9f Mon Sep 17 00:00:00 2001 From: Jean pasqualini Date: Thu, 5 Jan 2017 18:35:52 +0100 Subject: [PATCH 1/6] Fix the argument name of filter replace The argument name in the code is $from See https://github.com/jean-pasqualini/Twig/blob/1.x/lib/Twig/Extension/Core.php#L475. Issue : https://github.com/twigphp/Twig/issues/2329 --- doc/filters/replace.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/filters/replace.rst b/doc/filters/replace.rst index 1227957b9..8dbb74593 100644 --- a/doc/filters/replace.rst +++ b/doc/filters/replace.rst @@ -14,6 +14,6 @@ The ``replace`` filter formats a given string by replacing the placeholders Arguments --------- -* ``replace_pairs``: The placeholder values +* ``from``: The placeholder values .. seealso:: :doc:`format` From a33fb6ce2cc8ef2ea275460016e7dc90b8c8dedf Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 9 Jan 2017 17:10:34 +0100 Subject: [PATCH 2/6] Delay marking the environment as initialized until it is done --- lib/Twig/Environment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index f13f1b73a..36b8d98b6 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -1439,7 +1439,6 @@ class Twig_Environment return; } - $this->extensionInitialized = true; $this->parsers = new Twig_TokenParserBroker(array(), array(), false); $this->filters = array(); $this->functions = array(); @@ -1452,6 +1451,8 @@ class Twig_Environment $this->initExtension($extension); } $this->initExtension($this->staging); + // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception + $this->extensionInitialized = true; } /** From 3cdbd325d42588e1b4d6eacd0b062f00cc3c8903 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 10 Jan 2017 14:00:36 -0800 Subject: [PATCH 3/6] bumped version to 1.31.0 --- CHANGELOG | 2 +- composer.json | 2 +- ext/twig/php_twig.h | 2 +- lib/Twig/Environment.php | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index be442db30..283886247 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -* 1.30.1 (2017-XX-XX) +* 1.31.0 (2017-XX-XX) * n/a diff --git a/composer.json b/composer.json index dee921d4f..b1ef8f220 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.30-dev" + "dev-master": "1.31-dev" } } } diff --git a/ext/twig/php_twig.h b/ext/twig/php_twig.h index 3320aa9c6..9ea1e78bd 100644 --- a/ext/twig/php_twig.h +++ b/ext/twig/php_twig.h @@ -15,7 +15,7 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.30.1-DEV" +#define PHP_TWIG_VERSION "1.31.0-DEV" #include "php.h" diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 36b8d98b6..bbf7f0acf 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -16,11 +16,11 @@ */ class Twig_Environment { - const VERSION = '1.30.1-DEV'; - const VERSION_ID = 13001; + const VERSION = '1.31.0-DEV'; + const VERSION_ID = 13100; const MAJOR_VERSION = 1; - const MINOR_VERSION = 30; - const RELEASE_VERSION = 1; + const MINOR_VERSION = 31; + const RELEASE_VERSION = 0; const EXTRA_VERSION = 'DEV'; protected $charset; From bc6a91335da9deec4081f83ca29c88f821a89e00 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 6 Jan 2017 12:25:44 -0800 Subject: [PATCH 4/6] feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output --- lib/Twig/Node/Set.php | 2 +- lib/Twig/NodeCaptureInterface.php | 19 +++++++++++++++++++ lib/Twig/Parser.php | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 lib/Twig/NodeCaptureInterface.php diff --git a/lib/Twig/Node/Set.php b/lib/Twig/Node/Set.php index b77b8b6ef..9d75dbfde 100644 --- a/lib/Twig/Node/Set.php +++ b/lib/Twig/Node/Set.php @@ -14,7 +14,7 @@ * * @author Fabien Potencier */ -class Twig_Node_Set extends Twig_Node +class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface { public function __construct($capture, Twig_NodeInterface $names, Twig_NodeInterface $values, $lineno, $tag = null) { diff --git a/lib/Twig/NodeCaptureInterface.php b/lib/Twig/NodeCaptureInterface.php new file mode 100644 index 000000000..a37599737 --- /dev/null +++ b/lib/Twig/NodeCaptureInterface.php @@ -0,0 +1,19 @@ + + */ +interface Twig_NodeCaptureInterface +{ +} diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index 0fd0adaa4..7bbccc90f 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -386,8 +386,8 @@ class Twig_Parser implements Twig_ParserInterface throw new Twig_Error_Syntax('A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); } - // bypass "set" nodes as they "capture" the output - if ($node instanceof Twig_Node_Set) { + // bypass nodes that will "capture" the output + if ($node instanceof Twig_NodeCaptureInterface) { return $node; } From 44eba84e2414e55a8ec60002598036291936656e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 10 Jan 2017 14:02:12 -0800 Subject: [PATCH 5/6] fixed typo --- lib/Twig/NodeCaptureInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Twig/NodeCaptureInterface.php b/lib/Twig/NodeCaptureInterface.php index a37599737..97ffb6af2 100644 --- a/lib/Twig/NodeCaptureInterface.php +++ b/lib/Twig/NodeCaptureInterface.php @@ -3,14 +3,14 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** - * Represents a node that will capture any nested displayable nodes. + * Represents a node that captures any nested displayable nodes. * * @author Fabien Potencier */ From 0f9f76a17b717091543fef6fa26ef767a479fbc3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 10 Jan 2017 14:04:11 -0800 Subject: [PATCH 6/6] updated CHANGELOG --- CHANGELOG | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 283886247..48b8be8d7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ * 1.31.0 (2017-XX-XX) - * n/a + * added Twig_NodeCaptureInterface for nodes that capture all output + * fixed marking the environment as initialized too early + * fixed C89 compat for the C extension * 1.30.0 (2016-12-23)