diff --git a/core/composer.json b/core/composer.json index 26938e3..b1547df 100644 --- a/core/composer.json +++ b/core/composer.json @@ -18,7 +18,7 @@ "symfony/validator": "2.7.*", "symfony/process": "2.7.*", "symfony/yaml": "2.7.*", - "twig/twig": "1.18.*", + "twig/twig": "1.20.*", "doctrine/common": "~2.4.2", "doctrine/annotations": "1.2.*", "guzzlehttp/guzzle": "dev-master#1879fbe853b0c64d109e369c7aeff09849e62d1e", diff --git a/core/composer.lock b/core/composer.lock index 676d0bf..c121990 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "3708d8fdb54957e5ce661cda1df88353", + "hash": "6d065bd806544df5f446905bc3d6379f", "packages": [ { "name": "behat/mink", @@ -796,7 +796,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1879fbe853b0c64d109e369c7aeff09849e62d1e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e4046d42e6abc055c16d47bfbae573ae4c8646d1", "reference": "1879fbe853b0c64d109e369c7aeff09849e62d1e", "shasum": "" }, @@ -3111,16 +3111,16 @@ }, { "name": "twig/twig", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f" + "reference": "1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/9f70492f44398e276d1b81c1b43adfe6751c7b7f", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844", + "reference": "1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844", "shasum": "" }, "require": { @@ -3129,7 +3129,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-master": "1.20-dev" } }, "autoload": { @@ -3164,7 +3164,7 @@ "keywords": [ "templating" ], - "time": "2015-04-19 08:30:27" + "time": "2015-08-12 15:56:39" }, { "name": "zendframework/zend-diactoros", diff --git a/core/vendor/composer/ClassLoader.php b/core/vendor/composer/ClassLoader.php index 4e05d3b..5e1469e 100644 --- a/core/vendor/composer/ClassLoader.php +++ b/core/vendor/composer/ClassLoader.php @@ -351,7 +351,7 @@ private function findFileWithExtension($class, $ext) foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { if (0 === strpos($class, $prefix)) { foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } @@ -361,7 +361,7 @@ private function findFileWithExtension($class, $ext) // PSR-4 fallback dirs foreach ($this->fallbackDirsPsr4 as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { return $file; } } @@ -380,7 +380,7 @@ private function findFileWithExtension($class, $ext) foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } @@ -390,7 +390,7 @@ private function findFileWithExtension($class, $ext) // PSR-0 fallback dirs foreach ($this->fallbackDirsPsr0 as $dir) { - if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index e063543..018da3e 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -1108,65 +1108,6 @@ ] }, { - "name": "twig/twig", - "version": "v1.18.1", - "version_normalized": "1.18.1.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/9f70492f44398e276d1b81c1b43adfe6751c7b7f", - "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f", - "shasum": "" - }, - "require": { - "php": ">=5.2.7" - }, - "time": "2015-04-19 08:30:27", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ] - }, - { "name": "sebastian/version", "version": "1.0.5", "version_normalized": "1.0.5.0", @@ -3265,7 +3206,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1879fbe853b0c64d109e369c7aeff09849e62d1e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e4046d42e6abc055c16d47bfbae573ae4c8646d1", "reference": "1879fbe853b0c64d109e369c7aeff09849e62d1e", "shasum": "" }, @@ -3477,5 +3418,64 @@ "validation", "validator" ] + }, + { + "name": "twig/twig", + "version": "v1.20.0", + "version_normalized": "1.20.0.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844", + "reference": "1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844", + "shasum": "" + }, + "require": { + "php": ">=5.2.7" + }, + "time": "2015-08-12 15:56:39", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.20-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ] } ] diff --git a/core/vendor/twig/twig/.travis.yml b/core/vendor/twig/twig/.travis.yml index a6274ff..223a3be 100644 --- a/core/vendor/twig/twig/.travis.yml +++ b/core/vendor/twig/twig/.travis.yml @@ -8,11 +8,9 @@ php: - 5.6 - hhvm - nightly - - hhvm-nightly allow_failures: - php: nightly - - php: hhvm-nightly env: - TWIG_EXT=no @@ -26,7 +24,5 @@ matrix: exclude: - php: hhvm env: TWIG_EXT=yes - - php: hhvm-nightly - env: TWIG_EXT=yes - php: nightly env: TWIG_EXT=yes diff --git a/core/vendor/twig/twig/CHANGELOG b/core/vendor/twig/twig/CHANGELOG index edd6757..d4d951b 100644 --- a/core/vendor/twig/twig/CHANGELOG +++ b/core/vendor/twig/twig/CHANGELOG @@ -1,3 +1,27 @@ +* 1.20.0 (2015-08-12) + + * forbid access to the Twig environment from templates and internal parts of Twig_Template + * fixed limited RCEs when in sandbox mode + * deprecated Twig_Template::getEnvironment() + * deprecated the _self variable for usage outside of the from and import tags + * added Twig_BaseNodeVisitor to ease the compatibility of node visitors + between 1.x and 2.x + +* 1.19.0 (2015-07-31) + + * fixed wrong error message when including an undefined template in a child template + * added support for variadic filters, functions, and tests + * added support for extra positional arguments in macros + * added ignore_missing flag to the source function + * fixed batch filter with zero items + * deprecated Twig_Environment::clearTemplateCache() + * fixed sandbox disabling when using the include function + +* 1.18.2 (2015-06-06) + + * fixed template/line guessing in exceptions for nested templates + * optimized the number of inodes and the size of realpath cache when using the cache + * 1.18.1 (2015-04-19) * fixed memory leaks in the C extension diff --git a/core/vendor/twig/twig/composer.json b/core/vendor/twig/twig/composer.json index 20d8ca7..14f59c3 100644 --- a/core/vendor/twig/twig/composer.json +++ b/core/vendor/twig/twig/composer.json @@ -36,7 +36,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-master": "1.20-dev" } } } diff --git a/core/vendor/twig/twig/doc/advanced.rst b/core/vendor/twig/twig/doc/advanced.rst index 0e3be90..6953f55 100644 --- a/core/vendor/twig/twig/doc/advanced.rst +++ b/core/vendor/twig/twig/doc/advanced.rst @@ -224,6 +224,23 @@ through your filter:: $filter = new Twig_SimpleFilter('somefilter', 'somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); +Variadic Filters +~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.19 + Support for variadic filters was added in Twig 1.19. + +When a filter should accept an arbitrary number of arguments, set the +``is_variadic`` option to ``true``; Twig will pass the extra arguments as the +last argument to the filter call as an array:: + + $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) { + // ... + }, array('is_variadic' => true)); + +Be warned that named arguments passed to a variadic filter cannot be checked +for validity as they will automatically end up in the option array. + Dynamic Filters ~~~~~~~~~~~~~~~ @@ -331,6 +348,10 @@ The ``node`` sub-node will contain an expression of ``my_value``. Node-based tests also have access to the ``arguments`` node. This node will contain the various other arguments that have been provided to your test. +If you want to pass a variable number of positional or named arguments to the +test, set the ``is_variadic`` option to ``true``. Tests also support dynamic +name feature as filters and functions. + Tags ---- diff --git a/core/vendor/twig/twig/doc/api.rst b/core/vendor/twig/twig/doc/api.rst index cdeaffd..f367db0 100644 --- a/core/vendor/twig/twig/doc/api.rst +++ b/core/vendor/twig/twig/doc/api.rst @@ -72,29 +72,43 @@ options as the constructor second argument:: The following options are available: -* ``debug``: When set to ``true``, the generated templates have a +* ``debug`` *boolean* + + When set to ``true``, the generated templates have a ``__toString()`` method that you can use to display the generated nodes (default to ``false``). -* ``charset``: The charset used by the templates (default to ``utf-8``). +* ``charset`` *string (default to ``utf-8``)* + + The charset used by the templates. + +* ``base_template_class`` *string (default to ``Twig_Template``)* + + The base template class to use for generated + templates. -* ``base_template_class``: The base template class to use for generated - templates (default to ``Twig_Template``). +* ``cache`` *string|false* -* ``cache``: An absolute path where to store the compiled templates, or + An absolute path where to store the compiled templates, or ``false`` to disable caching (which is the default). -* ``auto_reload``: When developing with Twig, it's useful to recompile the +* ``auto_reload`` *boolean* + + When developing with Twig, it's useful to recompile the template whenever the source code changes. If you don't provide a value for the ``auto_reload`` option, it will be determined automatically based on the ``debug`` value. -* ``strict_variables``: If set to ``false``, Twig will silently ignore invalid +* ``strict_variables`` *boolean* + + If set to ``false``, Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a ``null`` value. When set to ``true``, Twig throws an exception instead (default to ``false``). -* ``autoescape``: If set to ``true``, HTML auto-escaping will be enabled by +* ``autoescape`` *string|boolean* + + If set to ``true``, HTML auto-escaping will be enabled by default for all templates (default to ``true``). As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``, @@ -110,7 +124,9 @@ The following options are available: strategy does not incur any overhead at runtime as auto-escaping is done at compilation time.) -* ``optimizations``: A flag that indicates which optimizations to apply +* ``optimizations`` *integer* + + A flag that indicates which optimizations to apply (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to disable). diff --git a/core/vendor/twig/twig/doc/deprecated.rst b/core/vendor/twig/twig/doc/deprecated.rst index bde62ba..9afc241 100644 --- a/core/vendor/twig/twig/doc/deprecated.rst +++ b/core/vendor/twig/twig/doc/deprecated.rst @@ -107,9 +107,30 @@ Loaders * As of Twig 1.x, ``Twig_Loader_String`` is deprecated and will be removed in 2.0. +Node Visitors +------------- + +* Because of the removal of ``Twig_NodeInterface`` in 2.0, you need to extend + ``Twig_BaseNodeVistor`` instead of implementing ``Twig_NodeVisitorInterface`` + directly to make your node visitors compatible with both Twig 1.x and 2.x. + Globals ------- * As of Twig 2.x, the ability to register a global variable after the runtime or the extensions have been initialized is not possible anymore (but changing the value of an already registered global is possible). + +* As of Twig 1.x, the ``_self`` global variable is deprecated except for usage + in the ``from`` and the ``import`` tags. In Twig 2.0, ``_self`` is not + exposed anymore but still usable in the ``from`` and the ``import`` tags. + +Miscellaneous +------------- + +* As of Twig 1.x, ``Twig_Environment::clearTemplateCache()`` is deprecated and + will be removed in 2.0. + +* As of Twig 1.x, ``Twig_Template::getEnvironment()`` and + ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be + removed in 2.0. diff --git a/core/vendor/twig/twig/doc/filters/batch.rst b/core/vendor/twig/twig/doc/filters/batch.rst index da47eb6..f8b6fa9 100644 --- a/core/vendor/twig/twig/doc/filters/batch.rst +++ b/core/vendor/twig/twig/doc/filters/batch.rst @@ -43,3 +43,9 @@ The above example will be rendered as: No item + +Arguments +--------- + +* ``size``: The size of the batch; fractional numbers will be rounded up +* ``fill``: Used to fill in missing items diff --git a/core/vendor/twig/twig/doc/functions/source.rst b/core/vendor/twig/twig/doc/functions/source.rst index 8ff39c2..3c921b1 100644 --- a/core/vendor/twig/twig/doc/functions/source.rst +++ b/core/vendor/twig/twig/doc/functions/source.rst @@ -4,6 +4,9 @@ .. versionadded:: 1.15 The ``source`` function was added in Twig 1.15. +.. versionadded:: 1.18.3 + The ``ignore_missing`` flag was added in Twig 1.18.3. + The ``source`` function returns the content of a template without rendering it: .. code-block:: jinja @@ -11,6 +14,13 @@ The ``source`` function returns the content of a template without rendering it: {{ source('template.html') }} {{ source(some_var) }} +When you set the ``ignore_missing`` flag, Twig will return an empty string if +the template does not exist: + +.. code-block:: jinja + + {{ source('template.html', ignore_missing = true) }} + The function uses the same template loaders as the ones used to include templates. So, if you are using the filesystem loader, the templates are looked for in the paths defined by it. @@ -19,3 +29,4 @@ Arguments --------- * ``name``: The name of the template to read +* ``ignore_missing``: Whether to ignore missing templates or not diff --git a/core/vendor/twig/twig/doc/internals.rst b/core/vendor/twig/twig/doc/internals.rst index a68796b..ef1174d 100644 --- a/core/vendor/twig/twig/doc/internals.rst +++ b/core/vendor/twig/twig/doc/internals.rst @@ -124,7 +124,7 @@ using):: { // line 1 echo "Hello "; - echo twig_escape_filter($this->env, $this->getContext($context, "name"), "html", null, true); + echo twig_escape_filter($this->env, isset($context["name"]) ? $context["name"] : null), "html", null, true); } // some more code diff --git a/core/vendor/twig/twig/doc/intro.rst b/core/vendor/twig/twig/doc/intro.rst index 773c476..9b38c97 100644 --- a/core/vendor/twig/twig/doc/intro.rst +++ b/core/vendor/twig/twig/doc/intro.rst @@ -21,10 +21,14 @@ The key-features are... * *Flexible*: Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL. +Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, +phpBB, Piwik, OroCRM, and many frameworks have support for it as well like +Slim, Yii, Laravel, Codeigniter, and Kohana, just to name a few. + Prerequisites ------------- -Twig needs at least **PHP 5.2.4** to run. +Twig needs at least **PHP 5.2.7** to run. Installation ------------ diff --git a/core/vendor/twig/twig/doc/tags/if.rst b/core/vendor/twig/twig/doc/tags/if.rst index b10dcb4..12edf98 100644 --- a/core/vendor/twig/twig/doc/tags/if.rst +++ b/core/vendor/twig/twig/doc/tags/if.rst @@ -37,8 +37,16 @@ You can also use ``not`` to check for values that evaluate to ``false``:

You are not subscribed to our mailing list.

{% endif %} -For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use -more complex ``expressions`` there too: +For multiple conditions, ``and`` and ``or`` can be used: + +.. code-block:: jinja + + {% if temperature > 18 and temperature < 27 %} +

It's a nice day for a walk in the park.

+ {% endif %} + +For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can +use more complex ``expressions`` there too: .. code-block:: jinja diff --git a/core/vendor/twig/twig/doc/tags/macro.rst b/core/vendor/twig/twig/doc/tags/macro.rst index 11c115a..60a1567 100644 --- a/core/vendor/twig/twig/doc/tags/macro.rst +++ b/core/vendor/twig/twig/doc/tags/macro.rst @@ -20,6 +20,9 @@ Macros differs from native PHP functions in a few ways: * Arguments of a macro are always optional. +* If extra positional arguments are passed to a macro, they end up in the + special ``varargs`` variable as a list of values. + But as with PHP functions, macros don't have access to the current template variables. diff --git a/core/vendor/twig/twig/doc/tags/spaceless.rst b/core/vendor/twig/twig/doc/tags/spaceless.rst index 12e77b2..b39cb27 100644 --- a/core/vendor/twig/twig/doc/tags/spaceless.rst +++ b/core/vendor/twig/twig/doc/tags/spaceless.rst @@ -33,5 +33,5 @@ quirks under some circumstances. .. tip:: For more information on whitespace control, read the - :doc:`dedicated<../templates>` section of the documentation and learn how + :ref:`dedicated section ` of the documentation and learn how you can also use the whitespace control modifier on your tags. diff --git a/core/vendor/twig/twig/doc/tags/use.rst b/core/vendor/twig/twig/doc/tags/use.rst index a2f3af0..071b197 100644 --- a/core/vendor/twig/twig/doc/tags/use.rst +++ b/core/vendor/twig/twig/doc/tags/use.rst @@ -74,7 +74,7 @@ is ignored. To avoid name conflicts, you can rename imported blocks: {% extends "base.html" %} - {% use "blocks.html" with sidebar as base_sidebar %} + {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} {% block sidebar %}{% endblock %} {% block title %}{% endblock %} diff --git a/core/vendor/twig/twig/doc/templates.rst b/core/vendor/twig/twig/doc/templates.rst index 7ff7862..ebdea9e 100644 --- a/core/vendor/twig/twig/doc/templates.rst +++ b/core/vendor/twig/twig/doc/templates.rst @@ -93,7 +93,7 @@ access the variable attribute: don't put the braces around them. If a variable or attribute does not exist, you will receive a ``null`` value -when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` +when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` is set, Twig will throw an error (see :ref:`environment options`). .. sidebar:: Implementation @@ -124,7 +124,7 @@ Global Variables The following variables are always available in templates: -* ``_self``: references the current template; +* ``_self``: references the current template (deprecated since Twig 1.20); * ``_context``: references the current context; * ``_charset``: references the current charset. @@ -541,6 +541,9 @@ macro call: {% endmacro %} +If extra positional arguments are passed to a macro call, they end up in the +special ``varargs`` variable as a list of values. + .. _twig-expressions: Expressions @@ -669,6 +672,10 @@ You can combine multiple expressions with the following operators: Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). +.. note:: + + Operators are case sensitive. + Comparisons ~~~~~~~~~~~ @@ -801,6 +808,8 @@ inserted into the string: {{ "foo #{bar} baz" }} {{ "foo #{1 + 2} baz" }} +.. _templates-whitespace-control: + Whitespace Control ------------------ diff --git a/core/vendor/twig/twig/ext/twig/php_twig.h b/core/vendor/twig/twig/ext/twig/php_twig.h index 9bf6d11..11d7be5 100644 --- a/core/vendor/twig/twig/ext/twig/php_twig.h +++ b/core/vendor/twig/twig/ext/twig/php_twig.h @@ -15,7 +15,7 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.18.1" +#define PHP_TWIG_VERSION "1.20.0" #include "php.h" diff --git a/core/vendor/twig/twig/ext/twig/twig.c b/core/vendor/twig/twig/ext/twig/twig.c index ae5b147..92d1add 100644 --- a/core/vendor/twig/twig/ext/twig/twig.c +++ b/core/vendor/twig/twig/ext/twig/twig.c @@ -55,7 +55,7 @@ ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_ ZEND_END_ARG_INFO() #ifndef PHP_FE_END -#define PHP_FE_END { NULL, NULL, NULL, 0, 0 } +#define PHP_FE_END { NULL, NULL, NULL} #endif static const zend_function_entry twig_functions[] = { @@ -609,6 +609,7 @@ static char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC) static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) { + zend_class_entry *ce; zval *retval; char *item; size_t item_len; @@ -619,12 +620,23 @@ static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, v return 0; } + ce = *va_arg(args, zend_class_entry**); retval = va_arg(args, zval*); item_len = strlen(mptr->common.function_name); item = estrndup(mptr->common.function_name, item_len); php_strtolower(item, item_len); + if (strcmp("getenvironment", item) == 0) { + zend_class_entry **twig_template_ce; + if (zend_lookup_class("Twig_Template", strlen("Twig_Template"), &twig_template_ce TSRMLS_CC) == FAILURE) { + return 0; + } + if (instanceof_function(ce, *twig_template_ce TSRMLS_CC)) { + return 0; + } + } + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); return 0; @@ -670,7 +682,7 @@ static void twig_add_class_to_cache(zval *cache, zval *object, char *class_name array_init(class_methods); array_init(class_properties); // add all methods to self::cache[$class]['methods'] - zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 1, class_methods); + zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 2, &class_ce, class_methods); zend_hash_apply_with_arguments(&class_ce->properties_info APPLY_TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties); add_assoc_zval(class_info, "methods", class_methods); @@ -779,12 +791,18 @@ PHP_FUNCTION(twig_template_get_attributes) $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface', $item, get_class($object)); } elseif (is_array($object)) { if (empty($object)) { - $message = sprintf('Key "%s" does not exist as the array is empty', $arrayItem); + $message = sprintf('Key "%s" does not exist as the array is empty', $arrayItem); } else { - $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); + $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); } } elseif (Twig_Template::ARRAY_CALL === $type) { - $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable', $item); } else { $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object); } @@ -807,12 +825,21 @@ PHP_FUNCTION(twig_template_get_attributes) } else { char *type_name = zend_zval_type_name(object); Z_ADDREF_P(object); - convert_to_string(object); - TWIG_RUNTIME_ERROR(template TSRMLS_CC, - (strcmp("array", type) == 0) - ? "Impossible to access a key (\"%s\") on a %s variable (\"%s\")" - : "Impossible to access an attribute (\"%s\") on a %s variable (\"%s\")", - item, type_name, Z_STRVAL_P(object)); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable" + : "Impossible to access an attribute (\"%s\") on a %s variable", + item, type_name); + } else { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable (\"%s\")" + : "Impossible to access an attribute (\"%s\") on a %s variable (\"%s\")", + item, type_name, Z_STRVAL_P(object)); + } zval_ptr_dtor(&object); } efree(item); @@ -836,7 +863,14 @@ PHP_FUNCTION(twig_template_get_attributes) if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { return null; } - throw new Twig_Error_Runtime(sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName()); + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + + throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); } */ if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { @@ -846,9 +880,15 @@ PHP_FUNCTION(twig_template_get_attributes) type_name = zend_zval_type_name(object); Z_ADDREF_P(object); - convert_to_string_ex(&object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string_ex(&object); - TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable (\"%s\")", item, type_name, Z_STRVAL_P(object)); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable", item, type_name); + } else { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable (\"%s\")", item, type_name, Z_STRVAL_P(object)); + } zval_ptr_dtor(&object); efree(item); @@ -870,7 +910,7 @@ PHP_FUNCTION(twig_template_get_attributes) /* // object property - if (Twig_Template::METHOD_CALL !== $type) { + if (Twig_Template::METHOD_CALL !== $type && !$object instanceof Twig_Template) { if (isset($object->$item) || array_key_exists((string) $item, $object)) { if ($isDefinedTest) { return true; @@ -884,7 +924,7 @@ PHP_FUNCTION(twig_template_get_attributes) } } */ - if (strcmp("method", type) != 0) { + if (strcmp("method", type) != 0 && !TWIG_INSTANCE_OF_USERLAND(object, "Twig_Template" TSRMLS_CC)) { zval *tmp_properties, *tmp_item; tmp_properties = TWIG_GET_ARRAY_ELEMENT(tmp_class, "properties", strlen("properties") TSRMLS_CC); @@ -911,7 +951,23 @@ PHP_FUNCTION(twig_template_get_attributes) /* // object method if (!isset(self::$cache[$class]['methods'])) { - self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + if ($object instanceof self) { + $ref = new ReflectionClass($class); + $methods = array(); + + foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { + $methodName = strtolower($refMethod->name); + + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== $methodName) { + $methods[$methodName] = true; + } + } + + self::$cache[$class]['methods'] = $methods; + } else { + self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + } } $call = false; diff --git a/core/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php b/core/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php new file mode 100644 index 0000000..bb865d6 --- /dev/null +++ b/core/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php @@ -0,0 +1,62 @@ + + */ +abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface +{ + /** + * {@inheritdoc} + */ + final public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if (!$node instanceof Twig_Node) { + throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); + } + + return $this->doEnterNode($node, $env); + } + + /** + * {@inheritdoc} + */ + final public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if (!$node instanceof Twig_Node) { + throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); + } + + return $this->doLeaveNode($node, $env); + } + + /** + * Called before child nodes are visited. + * + * @param Twig_Node $node The node to visit + * @param Twig_Environment $env The Twig environment instance + * + * @return Twig_Node The modified node + */ + abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env); + + /** + * Called after child nodes are visited. + * + * @param Twig_Node $node The node to visit + * @param Twig_Environment $env The Twig environment instance + * + * @return Twig_Node|false The modified node or false if the node must be removed + */ + abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env); +} diff --git a/core/vendor/twig/twig/lib/Twig/Environment.php b/core/vendor/twig/twig/lib/Twig/Environment.php index 9acc31a..3ac9124 100644 --- a/core/vendor/twig/twig/lib/Twig/Environment.php +++ b/core/vendor/twig/twig/lib/Twig/Environment.php @@ -16,7 +16,7 @@ */ class Twig_Environment { - const VERSION = '1.18.1'; + const VERSION = '1.20.0'; protected $charset; protected $loader; @@ -89,21 +89,21 @@ public function __construct(Twig_LoaderInterface $loader = null, $options = arra } $options = array_merge(array( - 'debug' => false, - 'charset' => 'UTF-8', + 'debug' => false, + 'charset' => 'UTF-8', 'base_template_class' => 'Twig_Template', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, + 'strict_variables' => false, + 'autoescape' => 'html', + 'cache' => false, + 'auto_reload' => null, + 'optimizations' => -1, ), $options); - $this->debug = (bool) $options['debug']; - $this->charset = strtoupper($options['charset']); - $this->baseTemplateClass = $options['base_template_class']; - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; + $this->debug = (bool) $options['debug']; + $this->charset = strtoupper($options['charset']); + $this->baseTemplateClass = $options['base_template_class']; + $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; + $this->strictVariables = (bool) $options['strict_variables']; $this->runtimeInitialized = false; $this->setCache($options['cache']); $this->functionCallbacks = array(); @@ -250,7 +250,7 @@ public function getCacheFilename($name) $class = substr($this->getTemplateClass($name), strlen($this->templateClassPrefix)); - return $this->getCache().'/'.substr($class, 0, 2).'/'.substr($class, 2, 2).'/'.substr($class, 4).'.php'; + return $this->getCache().'/'.$class[0].'/'.$class[1].'/'.$class.'.php'; } /** @@ -351,8 +351,7 @@ public function loadTemplate($name, $index = null) * * This method should not be used as a generic way to load templates. * - * @param string $name The template name - * @param int $index The index if it is an embedded template + * @param string $template The template name * * @return Twig_Template A template instance representing the given template name * @@ -444,6 +443,8 @@ public function resolveTemplate($names) /** * Clears the internal template cache. + * + * @deprecated since 1.18.3 (to be removed in 2.0) */ public function clearTemplateCache() { @@ -483,7 +484,7 @@ public function getLexer() /** * Sets the Lexer instance. * - * @param Twig_LexerInterface A Twig_LexerInterface instance + * @param Twig_LexerInterface $lexer A Twig_LexerInterface instance */ public function setLexer(Twig_LexerInterface $lexer) { @@ -522,7 +523,7 @@ public function getParser() /** * Sets the Parser instance. * - * @param Twig_ParserInterface A Twig_ParserInterface instance + * @param Twig_ParserInterface $parser A Twig_ParserInterface instance */ public function setParser(Twig_ParserInterface $parser) { @@ -1271,11 +1272,11 @@ protected function writeCacheFile($file, $content) if (false === @mkdir($dir, 0777, true)) { clearstatcache(false, $dir); if (!is_dir($dir)) { - throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir)); + throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); } } } elseif (!is_writable($dir)) { - throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir)); + throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); } $tmpFile = tempnam($dir, basename($file)); diff --git a/core/vendor/twig/twig/lib/Twig/ExpressionParser.php b/core/vendor/twig/twig/lib/Twig/ExpressionParser.php index fa9fa35..135958a 100644 --- a/core/vendor/twig/twig/lib/Twig/ExpressionParser.php +++ b/core/vendor/twig/twig/lib/Twig/ExpressionParser.php @@ -315,7 +315,7 @@ public function getFunctionNode($name, $line) { switch ($name) { case 'parent': - $args = $this->parseArguments(); + $this->parseArguments(); if (!count($this->parser->getBlockStack())) { throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden', $line, $this->parser->getFilename()); } @@ -387,7 +387,13 @@ public function parseSubscriptExpression($node) throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s")', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); } - $node = new Twig_Node_Expression_MethodCall($node, 'get'.$arg->getAttribute('value'), $arguments, $lineno); + $name = $arg->getAttribute('value'); + + if ($this->parser->isReservedMacroName($name)) { + throw new Twig_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword', $name), $token->getLine(), $this->parser->getFilename()); + } + + $node = new Twig_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno); $node->setAttribute('safe', true); return $node; @@ -468,6 +474,10 @@ public function parseFilterExpressionRaw($node, $tag = null) * * @param bool $namedArguments Whether to allow named arguments or not * @param bool $definition Whether we are parsing arguments for a function definition + * + * @return Twig_Node + * + * @throws Twig_Error_Syntax */ public function parseArguments($namedArguments = false, $definition = false) { diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Core.php b/core/vendor/twig/twig/lib/Twig/Extension/Core.php index 346006d..dd69a05 100644 --- a/core/vendor/twig/twig/lib/Twig/Extension/Core.php +++ b/core/vendor/twig/twig/lib/Twig/Extension/Core.php @@ -255,37 +255,37 @@ public function getOperators() return array( array( 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), - '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), + '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), + '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), ), array( - 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'matches' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Matches', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'matches' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Matches', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'starts with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_StartsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'ends with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_EndsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is' => array('precedence' => 100, 'callable' => array($this, 'parseTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is not' => array('precedence' => 100, 'callable' => array($this, 'parseNotTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), + 'ends with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_EndsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'is' => array('precedence' => 100, 'callable' => array($this, 'parseTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'is not' => array('precedence' => 100, 'callable' => array($this, 'parseNotTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), ), ); } @@ -382,7 +382,7 @@ function twig_cycle($values, $position) * Returns a random value depending on the supplied parameter type: * - a random item from a Traversable or array * - a random character from a string - * - a random integer between 0 and the integer parameter + * - a random integer between 0 and the integer parameter. * * @param Twig_Environment $env A Twig_Environment instance * @param Traversable|array|int|string $values The values to pick a random item from @@ -466,7 +466,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $ } /** - * Returns a new date object modified + * Returns a new date object modified. * *
  *   {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
@@ -921,7 +921,9 @@ function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false
 /**
  * Sorts an array.
  *
- * @param array $array An array
+ * @param array $array
+ *
+ * @return array
  */
 function twig_sort_filter($array)
 {
@@ -952,6 +954,8 @@ function twig_in_filter($value, $compare)
  * @param string           $strategy   The escaping strategy
  * @param string           $charset    The charset
  * @param bool             $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false)
+ *
+ * @return string
  */
 function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
 {
@@ -1186,7 +1190,7 @@ function _twig_escape_html_attr_callback($matches)
     $chr = $matches[0];
     $ord = ord($chr);
 
-    /**
+    /*
      * The following replaces characters undefined in HTML with the
      * hex entity for the Unicode replacement character.
      */
@@ -1194,7 +1198,7 @@ function _twig_escape_html_attr_callback($matches)
         return '�';
     }
 
-    /**
+    /*
      * Check if the current character to escape has a name entity we should
      * replace it with while grabbing the hex value of the character.
      */
@@ -1210,7 +1214,7 @@ function _twig_escape_html_attr_callback($matches)
         return sprintf('&%s;', $entityMap[$int]);
     }
 
-    /**
+    /*
      * Per OWASP recommendations, we'll use hex entities for any other
      * characters where a named entity does not exist.
      */
@@ -1398,11 +1402,13 @@ function twig_test_iterable($value)
 /**
  * Renders a template.
  *
- * @param string|array $template       The template to render or an array of templates to try consecutively
- * @param array        $variables      The variables to pass to the template
- * @param bool         $with_context   Whether to pass the current context variables or not
- * @param bool         $ignore_missing Whether to ignore missing templates or not
- * @param bool         $sandboxed      Whether to sandbox the template or not
+ * @param Twig_Environment $env
+ * @param array            $context
+ * @param string|array     $template      The template to render or an array of templates to try consecutively
+ * @param array            $variables     The variables to pass to the template
+ * @param bool             $withContext
+ * @param bool             $ignoreMissing Whether to ignore missing templates or not
+ * @param bool             $sandboxed     Whether to sandbox the template or not
  *
  * @return string The rendered template
  */
@@ -1421,10 +1427,15 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
         }
     }
 
+    $result = null;
     try {
-        return $env->resolveTemplate($template)->render($variables);
+        $result = $env->resolveTemplate($template)->render($variables);
     } catch (Twig_Error_Loader $e) {
         if (!$ignoreMissing) {
+            if ($isSandboxed && !$alreadySandboxed) {
+                $sandbox->disableSandbox();
+            }
+
             throw $e;
         }
     }
@@ -1432,18 +1443,27 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
     if ($isSandboxed && !$alreadySandboxed) {
         $sandbox->disableSandbox();
     }
+
+    return $result;
 }
 
 /**
  * Returns a template content without rendering it.
  *
- * @param string $name The template name
+ * @param string $name          The template name
+ * @param bool   $ignoreMissing Whether to ignore missing templates or not
  *
  * @return string The template source
  */
-function twig_source(Twig_Environment $env, $name)
+function twig_source(Twig_Environment $env, $name, $ignoreMissing = false)
 {
-    return $env->getLoader()->getSource($name);
+    try {
+        return $env->getLoader()->getSource($name);
+    } catch (Twig_Error_Loader $e) {
+        if (!$ignoreMissing) {
+            throw $e;
+        }
+    }
 }
 
 /**
@@ -1482,7 +1502,7 @@ function twig_array_batch($items, $size, $fill = null)
 
     $result = array_chunk($items, $size, true);
 
-    if (null !== $fill) {
+    if (null !== $fill && !empty($result)) {
         $last = count($result) - 1;
         if ($fillCount = $size - count($result[$last])) {
             $result[$last] = array_merge(
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Debug.php b/core/vendor/twig/twig/lib/Twig/Extension/Debug.php
index e3a85bf..86d07c2 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/Debug.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Debug.php
@@ -62,7 +62,7 @@ function twig_var_dump(Twig_Environment $env, $context)
 
         var_dump($vars);
     } else {
-        for ($i = 2; $i < $count; $i++) {
+        for ($i = 2; $i < $count; ++$i) {
             var_dump(func_get_arg($i));
         }
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
index 0edf563..cf2020e 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
@@ -104,6 +104,8 @@ public function getName()
  * Marks a variable as being safe.
  *
  * @param string $string A PHP variable
+ *
+ * @return string
  */
 function twig_raw_filter($string)
 {
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php b/core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php
index c58259c..3593e9e 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php
@@ -16,7 +16,7 @@ class Twig_Extension_Sandbox extends Twig_Extension
 
     public function __construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false)
     {
-        $this->policy            = $policy;
+        $this->policy = $policy;
         $this->sandboxedGlobally = $sandboxed;
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/Filter.php b/core/vendor/twig/twig/lib/Twig/Filter.php
index 5cfbb66..a6e923d 100644
--- a/core/vendor/twig/twig/lib/Twig/Filter.php
+++ b/core/vendor/twig/twig/lib/Twig/Filter.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface
@@ -26,10 +27,10 @@ public function __construct(array $options = array())
     {
         $this->options = array_merge(array(
             'needs_environment' => false,
-            'needs_context'     => false,
-            'pre_escape'        => null,
-            'preserves_safety'  => null,
-            'callable'          => null,
+            'needs_context' => false,
+            'pre_escape' => null,
+            'preserves_safety' => null,
+            'callable' => null,
         ), $options);
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/Filter/Function.php b/core/vendor/twig/twig/lib/Twig/Filter/Function.php
index ad374a5..45c14c7 100644
--- a/core/vendor/twig/twig/lib/Twig/Filter/Function.php
+++ b/core/vendor/twig/twig/lib/Twig/Filter/Function.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Filter_Function extends Twig_Filter
diff --git a/core/vendor/twig/twig/lib/Twig/Filter/Method.php b/core/vendor/twig/twig/lib/Twig/Filter/Method.php
index 63c8c3b..f32435f 100644
--- a/core/vendor/twig/twig/lib/Twig/Filter/Method.php
+++ b/core/vendor/twig/twig/lib/Twig/Filter/Method.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Filter_Method extends Twig_Filter
diff --git a/core/vendor/twig/twig/lib/Twig/Filter/Node.php b/core/vendor/twig/twig/lib/Twig/Filter/Node.php
index 8744c5e..efbcc29 100644
--- a/core/vendor/twig/twig/lib/Twig/Filter/Node.php
+++ b/core/vendor/twig/twig/lib/Twig/Filter/Node.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Filter_Node extends Twig_Filter
diff --git a/core/vendor/twig/twig/lib/Twig/FilterCallableInterface.php b/core/vendor/twig/twig/lib/Twig/FilterCallableInterface.php
index 145534d..5679861 100644
--- a/core/vendor/twig/twig/lib/Twig/FilterCallableInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/FilterCallableInterface.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_FilterCallableInterface
diff --git a/core/vendor/twig/twig/lib/Twig/FilterInterface.php b/core/vendor/twig/twig/lib/Twig/FilterInterface.php
index 5319ecc..6b0be0e 100644
--- a/core/vendor/twig/twig/lib/Twig/FilterInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/FilterInterface.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFilter instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_FilterInterface
diff --git a/core/vendor/twig/twig/lib/Twig/Function.php b/core/vendor/twig/twig/lib/Twig/Function.php
index b5ffb2b..0f6ac97 100644
--- a/core/vendor/twig/twig/lib/Twig/Function.php
+++ b/core/vendor/twig/twig/lib/Twig/Function.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface
@@ -26,8 +27,8 @@ public function __construct(array $options = array())
     {
         $this->options = array_merge(array(
             'needs_environment' => false,
-            'needs_context'     => false,
-            'callable'          => null,
+            'needs_context' => false,
+            'callable' => null,
         ), $options);
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/Function/Function.php b/core/vendor/twig/twig/lib/Twig/Function/Function.php
index d1e1b96..e7f3845 100644
--- a/core/vendor/twig/twig/lib/Twig/Function/Function.php
+++ b/core/vendor/twig/twig/lib/Twig/Function/Function.php
@@ -16,6 +16,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Arnaud Le Blanc 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Function_Function extends Twig_Function
diff --git a/core/vendor/twig/twig/lib/Twig/Function/Method.php b/core/vendor/twig/twig/lib/Twig/Function/Method.php
index 67039a9..17a7bd8 100644
--- a/core/vendor/twig/twig/lib/Twig/Function/Method.php
+++ b/core/vendor/twig/twig/lib/Twig/Function/Method.php
@@ -16,6 +16,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Arnaud Le Blanc 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Function_Method extends Twig_Function
diff --git a/core/vendor/twig/twig/lib/Twig/Function/Node.php b/core/vendor/twig/twig/lib/Twig/Function/Node.php
index 06a0d0d..550a379 100644
--- a/core/vendor/twig/twig/lib/Twig/Function/Node.php
+++ b/core/vendor/twig/twig/lib/Twig/Function/Node.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Function_Node extends Twig_Function
diff --git a/core/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php b/core/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php
index 0aab4f5..87d795e 100644
--- a/core/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php
@@ -15,6 +15,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_FunctionCallableInterface
diff --git a/core/vendor/twig/twig/lib/Twig/FunctionInterface.php b/core/vendor/twig/twig/lib/Twig/FunctionInterface.php
index 67f4f89..f449234 100644
--- a/core/vendor/twig/twig/lib/Twig/FunctionInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/FunctionInterface.php
@@ -16,6 +16,7 @@
  * Use Twig_SimpleFunction instead.
  *
  * @author Arnaud Le Blanc 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_FunctionInterface
diff --git a/core/vendor/twig/twig/lib/Twig/Lexer.php b/core/vendor/twig/twig/lib/Twig/Lexer.php
index 19380b5..d03a1bf 100644
--- a/core/vendor/twig/twig/lib/Twig/Lexer.php
+++ b/core/vendor/twig/twig/lib/Twig/Lexer.php
@@ -33,42 +33,42 @@ class Twig_Lexer implements Twig_LexerInterface
     protected $positions;
     protected $currentVarBlockLine;
 
-    const STATE_DATA            = 0;
-    const STATE_BLOCK           = 1;
-    const STATE_VAR             = 2;
-    const STATE_STRING          = 3;
-    const STATE_INTERPOLATION   = 4;
-
-    const REGEX_NAME            = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A';
-    const REGEX_NUMBER          = '/[0-9]+(?:\.[0-9]+)?/A';
-    const REGEX_STRING          = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As';
+    const STATE_DATA = 0;
+    const STATE_BLOCK = 1;
+    const STATE_VAR = 2;
+    const STATE_STRING = 3;
+    const STATE_INTERPOLATION = 4;
+
+    const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A';
+    const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A';
+    const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As';
     const REGEX_DQ_STRING_DELIM = '/"/A';
-    const REGEX_DQ_STRING_PART  = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
-    const PUNCTUATION           = '()[]{}?:.,|';
+    const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
+    const PUNCTUATION = '()[]{}?:.,|';
 
     public function __construct(Twig_Environment $env, array $options = array())
     {
         $this->env = $env;
 
         $this->options = array_merge(array(
-            'tag_comment'     => array('{#', '#}'),
-            'tag_block'       => array('{%', '%}'),
-            'tag_variable'    => array('{{', '}}'),
+            'tag_comment' => array('{#', '#}'),
+            'tag_block' => array('{%', '%}'),
+            'tag_variable' => array('{{', '}}'),
             'whitespace_trim' => '-',
-            'interpolation'   => array('#{', '}'),
+            'interpolation' => array('#{', '}'),
         ), $options);
 
         $this->regexes = array(
-            'lex_var'             => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A',
-            'lex_block'           => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A',
-            'lex_raw_data'        => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s',
-            'operator'            => $this->getOperatorRegex(),
-            'lex_comment'         => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s',
-            'lex_block_raw'       => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As',
-            'lex_block_line'      => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As',
-            'lex_tokens_start'    => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s',
+            'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A',
+            'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A',
+            'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s',
+            'operator' => $this->getOperatorRegex(),
+            'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s',
+            'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As',
+            'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As',
+            'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s',
             'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A',
-            'interpolation_end'   => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A',
+            'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A',
         );
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/LoaderInterface.php b/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
index b87058e..544ea4e 100644
--- a/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
@@ -41,8 +41,9 @@ public function getCacheKey($name);
     /**
      * Returns true if the template is still fresh.
      *
-     * @param string    $name The template name
-     * @param timestamp $time The last modification time of the cached template
+     * @param string $name The template name
+     * @param int    $time Timestamp of the last modification time of the
+     *                     cached template
      *
      * @return bool true if the template is fresh, false otherwise
      *
diff --git a/core/vendor/twig/twig/lib/Twig/Node.php b/core/vendor/twig/twig/lib/Twig/Node.php
index 515d81b..1c78e7b 100644
--- a/core/vendor/twig/twig/lib/Twig/Node.php
+++ b/core/vendor/twig/twig/lib/Twig/Node.php
@@ -122,7 +122,7 @@ public function getNodeTag()
     /**
      * Returns true if the attribute is defined.
      *
-     * @param  string  The attribute name
+     * @param string $name The attribute name
      *
      * @return bool true if the attribute is defined, false otherwise
      */
@@ -132,11 +132,11 @@ public function hasAttribute($name)
     }
 
     /**
-     * Gets an attribute.
+     * Gets an attribute value by name.
      *
-     * @param  string The attribute name
+     * @param string $name
      *
-     * @return mixed The attribute value
+     * @return mixed
      */
     public function getAttribute($name)
     {
@@ -148,10 +148,10 @@ public function getAttribute($name)
     }
 
     /**
-     * Sets an attribute.
+     * Sets an attribute by name to a value.
      *
-     * @param string The attribute name
-     * @param mixed  The attribute value
+     * @param string $name
+     * @param mixed  $value
      */
     public function setAttribute($name, $value)
     {
@@ -159,9 +159,9 @@ public function setAttribute($name, $value)
     }
 
     /**
-     * Removes an attribute.
+     * Removes an attribute by name.
      *
-     * @param string The attribute name
+     * @param string $name
      */
     public function removeAttribute($name)
     {
@@ -169,11 +169,11 @@ public function removeAttribute($name)
     }
 
     /**
-     * Returns true if the node with the given identifier exists.
+     * Returns true if the node with the given name exists.
      *
-     * @param  string  The node name
+     * @param string $name
      *
-     * @return bool true if the node with the given name exists, false otherwise
+     * @return bool
      */
     public function hasNode($name)
     {
@@ -183,9 +183,9 @@ public function hasNode($name)
     /**
      * Gets a node by name.
      *
-     * @param  string The node name
+     * @param string $name
      *
-     * @return Twig_Node A Twig_Node instance
+     * @return Twig_Node
      */
     public function getNode($name)
     {
@@ -199,8 +199,8 @@ public function getNode($name)
     /**
      * Sets a node.
      *
-     * @param string    The node name
-     * @param Twig_Node A Twig_Node instance
+     * @param string    $name
+     * @param Twig_Node $node
      */
     public function setNode($name, $node = null)
     {
@@ -210,7 +210,7 @@ public function setNode($name, $node = null)
     /**
      * Removes a node by name.
      *
-     * @param string The node name
+     * @param string $name
      */
     public function removeNode($name)
     {
diff --git a/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php b/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php
index 3040b76..b4a436a 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php
@@ -41,9 +41,9 @@ public function compile(Twig_Compiler $compiler)
         }
 
         $compiler
-            ->write("\$tags = ")->repr(array_filter($tags))->raw(";\n")
-            ->write("\$filters = ")->repr(array_filter($filters))->raw(";\n")
-            ->write("\$functions = ")->repr(array_filter($functions))->raw(";\n\n")
+            ->write('$tags = ')->repr(array_filter($tags))->raw(";\n")
+            ->write('$filters = ')->repr(array_filter($filters))->raw(";\n")
+            ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n")
             ->write("try {\n")
             ->indent()
             ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n")
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Embed.php b/core/vendor/twig/twig/lib/Twig/Node/Embed.php
index c54d2cc..a213040 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Embed.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Embed.php
@@ -28,7 +28,7 @@ public function __construct($filename, $index, Twig_Node_Expression $variables =
     protected function addGetTemplate(Twig_Compiler $compiler)
     {
         $compiler
-            ->write("\$this->loadTemplate(")
+            ->write('$this->loadTemplate(')
             ->string($this->getAttribute('filename'))
             ->raw(', ')
             ->repr($compiler->getFilename())
@@ -36,7 +36,7 @@ protected function addGetTemplate(Twig_Compiler $compiler)
             ->repr($this->getLine())
             ->raw(', ')
             ->string($this->getAttribute('index'))
-            ->raw(")")
+            ->raw(')')
         ;
     }
 }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php
index 4ddb2cf..c25aadd 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php
@@ -36,15 +36,15 @@ public function compile(Twig_Compiler $compiler)
         if ($this->getAttribute('output')) {
             $compiler
                 ->addDebugInfo($this)
-                ->write("\$this->displayBlock(")
+                ->write('$this->displayBlock(')
                 ->subcompile($this->getNode('name'))
                 ->raw(", \$context, \$blocks);\n")
             ;
         } else {
             $compiler
-                ->raw("\$this->renderBlock(")
+                ->raw('$this->renderBlock(')
                 ->subcompile($this->getNode('name'))
-                ->raw(", \$context, \$blocks)")
+                ->raw(', $context, $blocks)')
             ;
         }
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php
index 998160b..51e2cac 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php
@@ -106,12 +106,19 @@ protected function getArguments($callable, $arguments)
             $parameters[$name] = $node;
         }
 
-        if (!$named) {
+        $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic');
+        if (!$named && !$isVariadic) {
             return $parameters;
         }
 
         if (!$callable) {
-            throw new LogicException(sprintf('Named arguments are not supported for %s "%s".', $callType, $callName));
+            if ($named) {
+                $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName);
+            } else {
+                $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName);
+            }
+
+            throw new LogicException($message);
         }
 
         // manage named arguments
@@ -141,6 +148,19 @@ protected function getArguments($callable, $arguments)
                 array_shift($definition);
             }
         }
+        if ($isVariadic) {
+            $argument = end($definition);
+            if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && array() === $argument->getDefaultValue()) {
+                array_pop($definition);
+            } else {
+                $callableName = $r->name;
+                if ($r->getDeclaringClass()) {
+                    $callableName = $r->getDeclaringClass()->name.'::'.$callableName;
+                }
+
+                throw new LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = array()".', $callableName, $callType, $callName));
+            }
+        }
 
         $arguments = array();
         $names = array();
@@ -185,6 +205,23 @@ protected function getArguments($callable, $arguments)
             }
         }
 
+        if ($isVariadic) {
+            $arbitraryArguments = new Twig_Node_Expression_Array(array(), -1);
+            foreach ($parameters as $key => $value) {
+                if (is_int($key)) {
+                    $arbitraryArguments->addElement($value);
+                } else {
+                    $arbitraryArguments->addElement($value, new Twig_Node_Expression_Constant($key, -1));
+                }
+                unset($parameters[$key]);
+            }
+
+            if ($arbitraryArguments->count()) {
+                $arguments = array_merge($arguments, $optionalArguments);
+                $arguments[] = $arbitraryArguments;
+            }
+        }
+
         if (!empty($parameters)) {
             $unknownParameter = null;
             foreach ($parameters as $parameter) {
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php
index 207b062..a906232 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php
@@ -30,6 +30,9 @@ public function compile(Twig_Compiler $compiler)
         if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) {
             $this->setAttribute('callable', $filter->getCallable());
         }
+        if ($filter instanceof Twig_SimpleFilter) {
+            $this->setAttribute('is_variadic', $filter->isVariadic());
+        }
 
         $this->compileCallable($compiler);
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php
index 3e1f6b5..7326ede 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php
@@ -29,6 +29,9 @@ public function compile(Twig_Compiler $compiler)
         if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
             $this->setAttribute('callable', $function->getCallable());
         }
+        if ($function instanceof Twig_SimpleFunction) {
+            $this->setAttribute('is_variadic', $function->isVariadic());
+        }
 
         $this->compileCallable($compiler);
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php
index 0bfcdbc..a6e0ff4 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php
@@ -12,7 +12,7 @@
 class Twig_Node_Expression_Name extends Twig_Node_Expression
 {
     protected $specialVars = array(
-        '_self'    => '$this',
+        '_self' => '$this',
         '_context' => '$context',
         '_charset' => '$this->env->getCharset()',
     );
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php
index a22ce03..bd5024b 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php
@@ -32,15 +32,15 @@ public function compile(Twig_Compiler $compiler)
         if ($this->getAttribute('output')) {
             $compiler
                 ->addDebugInfo($this)
-                ->write("\$this->displayParentBlock(")
+                ->write('$this->displayParentBlock(')
                 ->string($this->getAttribute('name'))
                 ->raw(", \$context, \$blocks);\n")
             ;
         } else {
             $compiler
-                ->raw("\$this->renderParentBlock(")
+                ->raw('$this->renderParentBlock(')
                 ->string($this->getAttribute('name'))
-                ->raw(", \$context, \$blocks)")
+                ->raw(', $context, $blocks)')
             ;
         }
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php
index 639f501..c0358c8 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php
@@ -26,6 +26,9 @@ public function compile(Twig_Compiler $compiler)
         if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) {
             $this->setAttribute('callable', $test->getCallable());
         }
+        if ($test instanceof Twig_SimpleTest) {
+            $this->setAttribute('is_variadic', $test->isVariadic());
+        }
 
         $this->compileCallable($compiler);
     }
diff --git a/core/vendor/twig/twig/lib/Twig/Node/For.php b/core/vendor/twig/twig/lib/Twig/Node/For.php
index c54a23c..36e9de8 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/For.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/For.php
@@ -82,7 +82,7 @@ public function compile(Twig_Compiler $compiler)
         $compiler
             ->write("foreach (\$context['_seq'] as ")
             ->subcompile($this->getNode('key_target'))
-            ->raw(" => ")
+            ->raw(' => ')
             ->subcompile($this->getNode('value_target'))
             ->raw(") {\n")
             ->indent()
diff --git a/core/vendor/twig/twig/lib/Twig/Node/If.php b/core/vendor/twig/twig/lib/Twig/Node/If.php
index 980274e..1b6104d 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/If.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/If.php
@@ -34,7 +34,7 @@ public function compile(Twig_Compiler $compiler)
             if ($i > 0) {
                 $compiler
                     ->outdent()
-                    ->write("} elseif (")
+                    ->write('} elseif (')
                 ;
             } else {
                 $compiler
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Import.php b/core/vendor/twig/twig/lib/Twig/Node/Import.php
index 5e4aa11..515ff2a 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Import.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Import.php
@@ -36,7 +36,7 @@ public function compile(Twig_Compiler $compiler)
         ;
 
         if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) {
-            $compiler->raw("\$this");
+            $compiler->raw('$this');
         } else {
             $compiler
                 ->raw('$this->loadTemplate(')
@@ -45,7 +45,7 @@ public function compile(Twig_Compiler $compiler)
                 ->repr($compiler->getFilename())
                 ->raw(', ')
                 ->repr($this->getLine())
-                ->raw(")")
+                ->raw(')')
             ;
         }
 
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Include.php b/core/vendor/twig/twig/lib/Twig/Node/Include.php
index 46b0685..fecaa82 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Include.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Include.php
@@ -61,13 +61,13 @@ public function compile(Twig_Compiler $compiler)
     protected function addGetTemplate(Twig_Compiler $compiler)
     {
         $compiler
-             ->write("\$this->loadTemplate(")
+             ->write('$this->loadTemplate(')
              ->subcompile($this->getNode('expr'))
              ->raw(', ')
              ->repr($compiler->getFilename())
              ->raw(', ')
              ->repr($this->getLine())
-             ->raw(")")
+             ->raw(')')
          ;
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Macro.php b/core/vendor/twig/twig/lib/Twig/Node/Macro.php
index ab7e8d2..03cf4dd 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Macro.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Macro.php
@@ -16,8 +16,16 @@
  */
 class Twig_Node_Macro extends Twig_Node
 {
+    const VARARGS_NAME = 'varargs';
+
     public function __construct($name, Twig_NodeInterface $body, Twig_NodeInterface $arguments, $lineno, $tag = null)
     {
+        foreach ($arguments as $argumentName => $argument) {
+            if (self::VARARGS_NAME === $argumentName) {
+                throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getLine());
+            }
+        }
+
         parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag);
     }
 
@@ -30,7 +38,7 @@ public function compile(Twig_Compiler $compiler)
     {
         $compiler
             ->addDebugInfo($this)
-            ->write(sprintf("public function get%s(", $this->getAttribute('name')))
+            ->write(sprintf('public function get%s(', $this->getAttribute('name')))
         ;
 
         $count = count($this->getNode('arguments'));
@@ -46,36 +54,55 @@ public function compile(Twig_Compiler $compiler)
             }
         }
 
+        if (PHP_VERSION_ID >= 50600) {
+            if ($count) {
+                $compiler->raw(', ');
+            }
+
+            $compiler->raw('...$__varargs__');
+        }
+
         $compiler
             ->raw(")\n")
             ->write("{\n")
             ->indent()
         ;
 
-        if (!count($this->getNode('arguments'))) {
-            $compiler->write("\$context = \$this->env->getGlobals();\n\n");
-        } else {
+        $compiler
+            ->write("\$context = \$this->env->mergeGlobals(array(\n")
+            ->indent()
+        ;
+
+        foreach ($this->getNode('arguments') as $name => $default) {
             $compiler
-                ->write("\$context = \$this->env->mergeGlobals(array(\n")
-                ->indent()
+                ->addIndentation()
+                ->string($name)
+                ->raw(' => $__'.$name.'__')
+                ->raw(",\n")
             ;
+        }
 
-            foreach ($this->getNode('arguments') as $name => $default) {
-                $compiler
-                    ->write('')
-                    ->string($name)
-                    ->raw(' => $__'.$name.'__')
-                    ->raw(",\n")
-                ;
-            }
+        $compiler
+            ->addIndentation()
+            ->string(self::VARARGS_NAME)
+            ->raw(' => ')
+        ;
 
+        if (PHP_VERSION_ID >= 50600) {
+            $compiler->raw("\$__varargs__,\n");
+        } else {
             $compiler
-                ->outdent()
-                ->write("));\n\n")
+                ->raw('func_num_args() > ')
+                ->repr($count)
+                ->raw(' ? array_slice(func_get_args(), ')
+                ->repr($count)
+                ->raw(") : array(),\n")
             ;
         }
 
         $compiler
+            ->outdent()
+            ->write("));\n\n")
             ->write("\$blocks = array();\n\n")
             ->write("ob_start();\n")
             ->write("try {\n")
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Module.php b/core/vendor/twig/twig/lib/Twig/Node/Module.php
index 7802263..327b5e6 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Module.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Module.php
@@ -107,20 +107,20 @@ protected function compileGetParent(Twig_Compiler $compiler)
             ->write("protected function doGetParent(array \$context)\n", "{\n")
             ->indent()
             ->addDebugInfo($parent)
-            ->write("return ")
+            ->write('return ')
         ;
 
         if ($parent instanceof Twig_Node_Expression_Constant) {
             $compiler->subcompile($parent);
         } else {
             $compiler
-                ->raw("\$this->loadTemplate(")
+                ->raw('$this->loadTemplate(')
                 ->subcompile($parent)
                 ->raw(', ')
                 ->repr($compiler->getFilename())
                 ->raw(', ')
                 ->repr($this->getNode('parent')->getLine())
-                ->raw(")")
+                ->raw(')')
             ;
         }
 
@@ -136,7 +136,7 @@ protected function compileClassHeader(Twig_Compiler $compiler)
         $compiler
             ->write("\n\n")
             // if the filename contains */, add a blank to avoid a PHP parse error
-            ->write("/* ".str_replace('*/', '* /', $this->getAttribute('filename'))." */\n")
+            ->write('/* '.str_replace('*/', '* /', $this->getAttribute('filename'))." */\n")
             ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'), $this->getAttribute('index')))
             ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass()))
             ->write("{\n")
@@ -159,7 +159,7 @@ protected function compileConstructor(Twig_Compiler $compiler)
         } elseif ($parent instanceof Twig_Node_Expression_Constant) {
             $compiler
                 ->addDebugInfo($parent)
-                ->write("\$this->parent = \$this->loadTemplate(")
+                ->write('$this->parent = $this->loadTemplate(')
                 ->subcompile($parent)
                 ->raw(', ')
                 ->repr($compiler->getFilename())
@@ -189,23 +189,23 @@ protected function compileConstructor(Twig_Compiler $compiler)
 
                 foreach ($trait->getNode('targets') as $key => $value) {
                     $compiler
-                        ->write(sprintf("if (!isset(\$_trait_%s_blocks[", $i))
+                        ->write(sprintf('if (!isset($_trait_%s_blocks[', $i))
                         ->string($key)
                         ->raw("])) {\n")
                         ->indent()
                         ->write("throw new Twig_Error_Runtime(sprintf('Block ")
                         ->string($key)
-                        ->raw(" is not defined in trait ")
+                        ->raw(' is not defined in trait ')
                         ->subcompile($trait->getNode('template'))
                         ->raw(".'));\n")
                         ->outdent()
                         ->write("}\n\n")
 
-                        ->write(sprintf("\$_trait_%s_blocks[", $i))
+                        ->write(sprintf('$_trait_%s_blocks[', $i))
                         ->subcompile($value)
-                        ->raw(sprintf("] = \$_trait_%s_blocks[", $i))
+                        ->raw(sprintf('] = $_trait_%s_blocks[', $i))
                         ->string($key)
-                        ->raw(sprintf("]; unset(\$_trait_%s_blocks[", $i))
+                        ->raw(sprintf(']; unset($_trait_%s_blocks[', $i))
                         ->string($key)
                         ->raw("]);\n\n")
                     ;
@@ -218,9 +218,9 @@ protected function compileConstructor(Twig_Compiler $compiler)
                     ->indent()
                 ;
 
-                for ($i = 0; $i < $countTraits; $i++) {
+                for ($i = 0; $i < $countTraits; ++$i) {
                     $compiler
-                        ->write(sprintf("\$_trait_%s_blocks".($i == $countTraits - 1 ? '' : ',')."\n", $i))
+                        ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i))
                     ;
                 }
 
@@ -285,9 +285,9 @@ protected function compileDisplay(Twig_Compiler $compiler)
         if (null !== $parent = $this->getNode('parent')) {
             $compiler->addDebugInfo($parent);
             if ($parent instanceof Twig_Node_Expression_Constant) {
-                $compiler->write("\$this->parent");
+                $compiler->write('$this->parent');
             } else {
-                $compiler->write("\$this->getParent(\$context)");
+                $compiler->write('$this->getParent($context)');
             }
             $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n");
         }
@@ -393,7 +393,7 @@ protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var)
     {
         if ($node instanceof Twig_Node_Expression_Constant) {
             $compiler
-                ->write(sprintf("%s = \$this->loadTemplate(", $var))
+                ->write(sprintf('%s = $this->loadTemplate(', $var))
                 ->subcompile($node)
                 ->raw(', ')
                 ->repr($compiler->getFilename())
@@ -403,13 +403,13 @@ protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var)
             ;
         } else {
             $compiler
-                ->write(sprintf("%s = ", $var))
+                ->write(sprintf('%s = ', $var))
                 ->subcompile($node)
                 ->raw(";\n")
-                ->write(sprintf("if (!%s", $var))
+                ->write(sprintf('if (!%s', $var))
                 ->raw(" instanceof Twig_Template) {\n")
                 ->indent()
-                ->write(sprintf("%s = \$this->loadTemplate(%s")
+                ->write(sprintf('%s = $this->loadTemplate(%s')
                 ->raw(', ')
                 ->repr($compiler->getFilename())
                 ->raw(', ')
diff --git a/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php b/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php
index 91872cc..823e7ac 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php
@@ -47,6 +47,8 @@ public function compile(Twig_Compiler $compiler)
      * This is mostly needed when another visitor adds filters (like the escaper one).
      *
      * @param Twig_Node $node A Node
+     *
+     * @return Twig_Node
      */
     protected function removeNodeFilter($node)
     {
diff --git a/core/vendor/twig/twig/lib/Twig/NodeTraverser.php b/core/vendor/twig/twig/lib/Twig/NodeTraverser.php
index 8178a55..6024e65 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeTraverser.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeTraverser.php
@@ -54,6 +54,8 @@ public function addVisitor(Twig_NodeVisitorInterface $visitor)
      * Traverses a node and calls the registered visitors.
      *
      * @param Twig_NodeInterface $node A Twig_NodeInterface instance
+     *
+     * @return Twig_NodeInterface
      */
     public function traverse(Twig_NodeInterface $node)
     {
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php
index cc4b3d7..5c94977 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php
@@ -14,7 +14,7 @@
  *
  * @author Fabien Potencier 
  */
-class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface
+class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
 {
     protected $statusStack = array();
     protected $blocks = array();
@@ -29,14 +29,9 @@ public function __construct()
     }
 
     /**
-     * Called before child nodes are visited.
-     *
-     * @param Twig_NodeInterface $node The node to visit
-     * @param Twig_Environment   $env  The Twig environment instance
-     *
-     * @return Twig_NodeInterface The modified node
+     * {@inheritdoc}
      */
-    public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
     {
         if ($node instanceof Twig_Node_Module) {
             if ($env->hasExtension('escaper') && $defaultStrategy = $env->getExtension('escaper')->getDefaultStrategy($node->getAttribute('filename'))) {
@@ -55,14 +50,9 @@ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
     }
 
     /**
-     * Called after child nodes are visited.
-     *
-     * @param Twig_NodeInterface $node The node to visit
-     * @param Twig_Environment   $env  The Twig environment instance
-     *
-     * @return Twig_NodeInterface The modified node
+     * {@inheritdoc}
      */
-    public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
     {
         if ($node instanceof Twig_Node_Module) {
             $this->defaultStrategy = false;
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
index b9f9a5b..872b7fe 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
@@ -19,13 +19,13 @@
  *
  * @author Fabien Potencier 
  */
-class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface
+class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
 {
-    const OPTIMIZE_ALL         = -1;
-    const OPTIMIZE_NONE        = 0;
-    const OPTIMIZE_FOR         = 2;
-    const OPTIMIZE_RAW_FILTER  = 4;
-    const OPTIMIZE_VAR_ACCESS  = 8;
+    const OPTIMIZE_ALL = -1;
+    const OPTIMIZE_NONE = 0;
+    const OPTIMIZE_FOR = 2;
+    const OPTIMIZE_RAW_FILTER = 4;
+    const OPTIMIZE_VAR_ACCESS = 8;
 
     protected $loops = array();
     protected $loopsTargets = array();
@@ -50,7 +50,7 @@ public function __construct($optimizers = -1)
     /**
      * {@inheritdoc}
      */
-    public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
     {
         if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
             $this->enterOptimizeFor($node, $env);
@@ -76,7 +76,7 @@ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
     /**
      * {@inheritdoc}
      */
-    public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
     {
         $expression = $node instanceof Twig_Node_Expression;
 
@@ -129,6 +129,8 @@ protected function optimizeVariables(Twig_NodeInterface $node, Twig_Environment
      *
      * @param Twig_NodeInterface $node A Node
      * @param Twig_Environment   $env  The current Twig environment
+     *
+     * @return Twig_NodeInterface
      */
     protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
     {
@@ -153,6 +155,8 @@ protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment
      *
      * @param Twig_NodeInterface $node A Node
      * @param Twig_Environment   $env  The current Twig environment
+     *
+     * @return Twig_NodeInterface
      */
     protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
     {
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php
index a5d06de..439f5bf 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php
@@ -1,6 +1,15 @@
 
  */
-class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface
+class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor
 {
     protected $inAModule = false;
     protected $tags;
@@ -22,14 +22,9 @@ class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface
     protected $functions;
 
     /**
-     * Called before child nodes are visited.
-     *
-     * @param Twig_NodeInterface $node The node to visit
-     * @param Twig_Environment   $env  The Twig environment instance
-     *
-     * @return Twig_NodeInterface The modified node
+     * {@inheritdoc}
      */
-    public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
     {
         if ($node instanceof Twig_Node_Module) {
             $this->inAModule = true;
@@ -64,14 +59,9 @@ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
     }
 
     /**
-     * Called after child nodes are visited.
-     *
-     * @param Twig_NodeInterface $node The node to visit
-     * @param Twig_Environment   $env  The Twig environment instance
-     *
-     * @return Twig_NodeInterface The modified node
+     * {@inheritdoc}
      */
-    public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
     {
         if ($node instanceof Twig_Node_Module) {
             $this->inAModule = false;
diff --git a/core/vendor/twig/twig/lib/Twig/Parser.php b/core/vendor/twig/twig/lib/Twig/Parser.php
index 549ce2b..dd9c1fc 100644
--- a/core/vendor/twig/twig/lib/Twig/Parser.php
+++ b/core/vendor/twig/twig/lib/Twig/Parser.php
@@ -254,19 +254,28 @@ public function hasMacro($name)
 
     public function setMacro($name, Twig_Node_Macro $node)
     {
+        if ($this->isReservedMacroName($name)) {
+            throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine(), $this->getFilename());
+        }
+
+        $this->macros[$name] = $node;
+    }
+
+    public function isReservedMacroName($name)
+    {
         if (null === $this->reservedMacroNames) {
             $this->reservedMacroNames = array();
             $r = new ReflectionClass($this->env->getBaseTemplateClass());
             foreach ($r->getMethods() as $method) {
-                $this->reservedMacroNames[] = $method->getName();
-            }
-        }
+                $methodName = strtolower($method->getName());
 
-        if (in_array($name, $this->reservedMacroNames)) {
-            throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine(), $this->getFilename());
+                if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) {
+                    $this->reservedMacroNames[] = substr($methodName, 3);
+                }
+            }
         }
 
-        $this->macros[$name] = $node;
+        return in_array(strtolower($name), $this->reservedMacroNames);
     }
 
     public function addTrait($trait)
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php
index c898520..f066da7 100644
--- a/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php
@@ -14,7 +14,7 @@
  */
 class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text
 {
-    static private $colors = array(
+    private static $colors = array(
         'block' => '#dfd',
         'macro' => '#ddf',
         'template' => '#ffd',
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php b/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php
index 11c1114..2f97214 100644
--- a/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php
@@ -27,12 +27,12 @@ public function __construct($extensionName, $type, $name, $varName)
     public function compile(Twig_Compiler $compiler)
     {
         $compiler
-            ->write(sprintf("\$%s = \$this->env->getExtension(", $this->getAttribute('var_name')))
+            ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name')))
             ->repr($this->getAttribute('extension_name'))
             ->raw(");\n")
-            ->write(sprintf("\$%s->enter(\$%s = new Twig_Profiler_Profile(\$this->getTemplateName(), ", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof'))
+            ->write(sprintf('$%s->enter($%s = new Twig_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof'))
             ->repr($this->getAttribute('type'))
-            ->raw(", ")
+            ->raw(', ')
             ->repr($this->getAttribute('name'))
             ->raw("));\n\n")
         ;
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
index 58beb0a..4b0baa8 100644
--- a/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
@@ -12,7 +12,7 @@
 /**
  * @author Fabien Potencier 
  */
-class Twig_Profiler_NodeVisitor_Profiler implements Twig_NodeVisitorInterface
+class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
 {
     private $extensionName;
 
@@ -24,7 +24,7 @@ public function __construct($extensionName)
     /**
      * {@inheritdoc}
      */
-    public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
     {
         return $node;
     }
@@ -32,7 +32,7 @@ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
     /**
      * {@inheritdoc}
      */
-    public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
+    protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
     {
         if ($node instanceof Twig_Node_Module) {
             $varName = $this->getVarName();
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php b/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php
index fe48a4d..ec9e254 100644
--- a/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php
@@ -26,7 +26,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
     private $ends = array();
     private $profiles = array();
 
-    public function __construct($template = 'main', $type = Twig_Profiler_Profile::ROOT, $name = 'main')
+    public function __construct($template = 'main', $type = self::ROOT, $name = 'main')
     {
         $this->template = $template;
         $this->type = $type;
diff --git a/core/vendor/twig/twig/lib/Twig/SimpleFilter.php b/core/vendor/twig/twig/lib/Twig/SimpleFilter.php
index d35c563..5d6d27b 100644
--- a/core/vendor/twig/twig/lib/Twig/SimpleFilter.php
+++ b/core/vendor/twig/twig/lib/Twig/SimpleFilter.php
@@ -27,12 +27,13 @@ public function __construct($name, $callable, array $options = array())
         $this->callable = $callable;
         $this->options = array_merge(array(
             'needs_environment' => false,
-            'needs_context'     => false,
-            'is_safe'           => null,
-            'is_safe_callback'  => null,
-            'pre_escape'        => null,
-            'preserves_safety'  => null,
-            'node_class'        => 'Twig_Node_Expression_Filter',
+            'needs_context' => false,
+            'is_variadic' => false,
+            'is_safe' => null,
+            'is_safe_callback' => null,
+            'pre_escape' => null,
+            'preserves_safety' => null,
+            'node_class' => 'Twig_Node_Expression_Filter',
         ), $options);
     }
 
@@ -91,4 +92,9 @@ public function getPreEscape()
     {
         return $this->options['pre_escape'];
     }
+
+    public function isVariadic()
+    {
+        return $this->options['is_variadic'];
+    }
 }
diff --git a/core/vendor/twig/twig/lib/Twig/SimpleFunction.php b/core/vendor/twig/twig/lib/Twig/SimpleFunction.php
index 8ef6aca..8085f57 100644
--- a/core/vendor/twig/twig/lib/Twig/SimpleFunction.php
+++ b/core/vendor/twig/twig/lib/Twig/SimpleFunction.php
@@ -27,10 +27,11 @@ public function __construct($name, $callable, array $options = array())
         $this->callable = $callable;
         $this->options = array_merge(array(
             'needs_environment' => false,
-            'needs_context'     => false,
-            'is_safe'           => null,
-            'is_safe_callback'  => null,
-            'node_class'        => 'Twig_Node_Expression_Function',
+            'needs_context' => false,
+            'is_variadic' => false,
+            'is_safe' => null,
+            'is_safe_callback' => null,
+            'node_class' => 'Twig_Node_Expression_Function',
         ), $options);
     }
 
@@ -81,4 +82,9 @@ public function getSafe(Twig_Node $functionArgs)
 
         return array();
     }
+
+    public function isVariadic()
+    {
+        return $this->options['is_variadic'];
+    }
 }
diff --git a/core/vendor/twig/twig/lib/Twig/SimpleTest.php b/core/vendor/twig/twig/lib/Twig/SimpleTest.php
index 225459c..87b0935 100644
--- a/core/vendor/twig/twig/lib/Twig/SimpleTest.php
+++ b/core/vendor/twig/twig/lib/Twig/SimpleTest.php
@@ -25,6 +25,7 @@ public function __construct($name, $callable, array $options = array())
         $this->name = $name;
         $this->callable = $callable;
         $this->options = array_merge(array(
+            'is_variadic' => false,
             'node_class' => 'Twig_Node_Expression_Test',
         ), $options);
     }
@@ -43,4 +44,9 @@ public function getNodeClass()
     {
         return $this->options['node_class'];
     }
+
+    public function isVariadic()
+    {
+        return $this->options['is_variadic'];
+    }
 }
diff --git a/core/vendor/twig/twig/lib/Twig/Template.php b/core/vendor/twig/twig/lib/Twig/Template.php
index caf9642..73150bb 100644
--- a/core/vendor/twig/twig/lib/Twig/Template.php
+++ b/core/vendor/twig/twig/lib/Twig/Template.php
@@ -45,10 +45,12 @@ public function __construct(Twig_Environment $env)
     abstract public function getTemplateName();
 
     /**
-     * {@inheritdoc}
+     * @deprecated since 1.20 (to be removed in 2.0)
      */
     public function getEnvironment()
     {
+        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED);
+
         return $this->env;
     }
 
@@ -58,6 +60,8 @@ public function getEnvironment()
      * This method is for internal use only and should never be called
      * directly.
      *
+     * @param array $context
+     *
      * @return Twig_TemplateInterface|false The parent template or false if there is no parent
      */
     public function getParent(array $context)
@@ -73,7 +77,7 @@ public function getParent(array $context)
                 return false;
             }
 
-            if ($parent instanceof Twig_Template) {
+            if ($parent instanceof self) {
                 return $this->parents[$parent->getTemplateName()] = $parent;
             }
 
@@ -150,9 +154,25 @@ public function displayBlock($name, array $context, array $blocks = array(), $us
         }
 
         if (null !== $template) {
+            // avoid RCEs when sandbox is enabled
+            if (!$template instanceof Twig_Template) {
+                throw new \LogicException('A block must be a method on a Twig_Template instance.');
+            }
+
             try {
                 $template->$block($context, $blocks);
             } catch (Twig_Error $e) {
+                if (!$e->getTemplateFile()) {
+                    $e->setTemplateFile($template->getTemplateName());
+                }
+
+                // this is mostly useful for Twig_Error_Loader exceptions
+                // see Twig_Error_Loader
+                if (false === $e->getTemplateLine()) {
+                    $e->setTemplateLine(-1);
+                    $e->guess();
+                }
+
                 throw $e;
             } catch (Exception $e) {
                 throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getTemplateName(), $e);
@@ -247,13 +267,20 @@ protected function loadTemplate($template, $templateName = null, $line = null, $
                 return $this->env->resolveTemplate($template);
             }
 
-            if ($template instanceof Twig_Template) {
+            if ($template instanceof self) {
                 return $template;
             }
 
             return $this->env->loadTemplate($template, $index);
         } catch (Twig_Error $e) {
-            $e->setTemplateFile($templateName ? $templateName : $this->getTemplateName());
+            if (!$e->getTemplateFile()) {
+                $e->setTemplateFile($templateName ? $templateName : $this->getTemplateName());
+            }
+
+            if ($e->getTemplateLine()) {
+                throw $e;
+            }
+
             if (!$line) {
                 $e->guess();
             } else {
@@ -352,7 +379,7 @@ protected function displayWithErrorHandling(array $context, array $blocks = arra
      * @param string $item              The variable to return from the context
      * @param bool   $ignoreStrictCheck Whether to ignore the strict variable check or not
      *
-     * @return The content of the context variable
+     * @return mixed The content of the context variable
      *
      * @throws Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode
      */
@@ -383,10 +410,10 @@ protected function displayWithErrorHandling(array $context, array $blocks = arra
      *
      * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
      */
-    protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
+    protected function getAttribute($object, $item, array $arguments = array(), $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
     {
         // array
-        if (Twig_Template::METHOD_CALL !== $type) {
+        if (self::METHOD_CALL !== $type) {
             $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
 
             if ((is_array($object) && array_key_exists($arrayItem, $object))
@@ -399,7 +426,7 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
                 return $object[$arrayItem];
             }
 
-            if (Twig_Template::ARRAY_CALL === $type || !is_object($object)) {
+            if (self::ARRAY_CALL === $type || !is_object($object)) {
                 if ($isDefinedTest) {
                     return false;
                 }
@@ -418,8 +445,14 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
                     } else {
                         $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object)));
                     }
-                } elseif (Twig_Template::ARRAY_CALL === $type) {
-                    $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
+                } elseif (self::ARRAY_CALL === $type) {
+                    if (null === $object) {
+                        $message = sprintf('Impossible to access a key ("%s") on a null variable', $item);
+                    } else {
+                        $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
+                    }
+                } elseif (null === $object) {
+                    $message = sprintf('Impossible to access an attribute ("%s") on a null variable', $item);
                 } else {
                     $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
                 }
@@ -437,11 +470,17 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
                 return;
             }
 
-            throw new Twig_Error_Runtime(sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName());
+            if (null === $object) {
+                $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item);
+            } else {
+                $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
+            }
+
+            throw new Twig_Error_Runtime($message, -1, $this->getTemplateName());
         }
 
         // object property
-        if (Twig_Template::METHOD_CALL !== $type) {
+        if (self::METHOD_CALL !== $type && !$object instanceof self) { // Twig_Template does not have public properties, and we don't want to allow access to internal ones
             if (isset($object->$item) || array_key_exists((string) $item, $object)) {
                 if ($isDefinedTest) {
                     return true;
@@ -459,7 +498,24 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
 
         // object method
         if (!isset(self::$cache[$class]['methods'])) {
-            self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object)));
+            // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates
+            if ($object instanceof self) {
+                $ref = new ReflectionClass($class);
+                $methods = array();
+
+                foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) {
+                    $methodName = strtolower($refMethod->name);
+
+                    // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
+                    if ('getenvironment' !== $methodName) {
+                        $methods[$methodName] = true;
+                    }
+                }
+
+                self::$cache[$class]['methods'] = $methods;
+            } else {
+                self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object)));
+            }
         }
 
         $call = false;
diff --git a/core/vendor/twig/twig/lib/Twig/TemplateInterface.php b/core/vendor/twig/twig/lib/Twig/TemplateInterface.php
index d178832..3274640 100644
--- a/core/vendor/twig/twig/lib/Twig/TemplateInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/TemplateInterface.php
@@ -18,8 +18,8 @@
  */
 interface Twig_TemplateInterface
 {
-    const ANY_CALL    = 'any';
-    const ARRAY_CALL  = 'array';
+    const ANY_CALL = 'any';
+    const ARRAY_CALL = 'array';
     const METHOD_CALL = 'method';
 
     /**
diff --git a/core/vendor/twig/twig/lib/Twig/Test.php b/core/vendor/twig/twig/lib/Twig/Test.php
index 3baff88..c53c3cc 100644
--- a/core/vendor/twig/twig/lib/Twig/Test.php
+++ b/core/vendor/twig/twig/lib/Twig/Test.php
@@ -13,6 +13,7 @@
  * Represents a template test.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface
diff --git a/core/vendor/twig/twig/lib/Twig/Test/Function.php b/core/vendor/twig/twig/lib/Twig/Test/Function.php
index 4be6b9b..30e1c62 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/Function.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/Function.php
@@ -13,6 +13,7 @@
  * Represents a function template test.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Test_Function extends Twig_Test
diff --git a/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
index b8bceb8..261acd4 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
@@ -10,7 +10,7 @@
  */
 
 /**
- * Integration test helper
+ * Integration test helper.
  *
  * @author Fabien Potencier 
  * @author Karma Dordrak 
@@ -74,7 +74,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
 
         $loader = new Twig_Loader_Array($templates);
 
-        foreach ($outputs as $match) {
+        foreach ($outputs as $i => $match) {
             $config = array_merge(array(
                 'cache' => false,
                 'strict_variables' => true,
@@ -85,6 +85,14 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
                 $twig->addExtension($extension);
             }
 
+            // avoid using the same PHP class name for different cases
+            // only for PHP 5.2+
+            if (PHP_VERSION_ID >= 50300) {
+                $p = new ReflectionProperty($twig, 'templateClassPrefix');
+                $p->setAccessible(true);
+                $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_');
+            }
+
             try {
                 $template = $twig->loadTemplate('index.twig');
             } catch (Exception $e) {
@@ -122,14 +130,14 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
             }
 
             if (false !== $exception) {
-                list($class, ) = explode(':', $exception);
+                list($class) = explode(':', $exception);
                 $this->assertThat(null, new PHPUnit_Framework_Constraint_Exception($class));
             }
 
             $expected = trim($match[3], "\n ");
 
             if ($expected != $output) {
-                echo 'Compiled template that failed:';
+                printf("Compiled templates that failed on case %d:\n", $i + 1);
 
                 foreach (array_keys($templates) as $name) {
                     echo "Template: $name\n";
diff --git a/core/vendor/twig/twig/lib/Twig/Test/Method.php b/core/vendor/twig/twig/lib/Twig/Test/Method.php
index 17c6c04..7fc250b 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/Method.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/Method.php
@@ -13,6 +13,7 @@
  * Represents a method template test.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Test_Method extends Twig_Test
diff --git a/core/vendor/twig/twig/lib/Twig/Test/Node.php b/core/vendor/twig/twig/lib/Twig/Test/Node.php
index c832a57..cdf0b24 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/Node.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/Node.php
@@ -13,6 +13,7 @@
  * Represents a template test as a Node.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_Test_Node extends Twig_Test
diff --git a/core/vendor/twig/twig/lib/Twig/TestCallableInterface.php b/core/vendor/twig/twig/lib/Twig/TestCallableInterface.php
index 0db4368..98d3457 100644
--- a/core/vendor/twig/twig/lib/Twig/TestCallableInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/TestCallableInterface.php
@@ -13,6 +13,7 @@
  * Represents a callable template test.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_TestCallableInterface
diff --git a/core/vendor/twig/twig/lib/Twig/TestInterface.php b/core/vendor/twig/twig/lib/Twig/TestInterface.php
index 30d8a2c..2fa821c 100644
--- a/core/vendor/twig/twig/lib/Twig/TestInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/TestInterface.php
@@ -13,6 +13,7 @@
  * Represents a template test.
  *
  * @author Fabien Potencier 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_TestInterface
diff --git a/core/vendor/twig/twig/lib/Twig/Token.php b/core/vendor/twig/twig/lib/Twig/Token.php
index 15dd4eb..a0a029b 100644
--- a/core/vendor/twig/twig/lib/Twig/Token.php
+++ b/core/vendor/twig/twig/lib/Twig/Token.php
@@ -21,19 +21,19 @@ class Twig_Token
     protected $type;
     protected $lineno;
 
-    const EOF_TYPE                  = -1;
-    const TEXT_TYPE                 = 0;
-    const BLOCK_START_TYPE          = 1;
-    const VAR_START_TYPE            = 2;
-    const BLOCK_END_TYPE            = 3;
-    const VAR_END_TYPE              = 4;
-    const NAME_TYPE                 = 5;
-    const NUMBER_TYPE               = 6;
-    const STRING_TYPE               = 7;
-    const OPERATOR_TYPE             = 8;
-    const PUNCTUATION_TYPE          = 9;
-    const INTERPOLATION_START_TYPE  = 10;
-    const INTERPOLATION_END_TYPE    = 11;
+    const EOF_TYPE = -1;
+    const TEXT_TYPE = 0;
+    const BLOCK_START_TYPE = 1;
+    const VAR_START_TYPE = 2;
+    const BLOCK_END_TYPE = 3;
+    const VAR_END_TYPE = 4;
+    const NAME_TYPE = 5;
+    const NUMBER_TYPE = 6;
+    const STRING_TYPE = 7;
+    const OPERATOR_TYPE = 8;
+    const PUNCTUATION_TYPE = 9;
+    const INTERPOLATION_START_TYPE = 10;
+    const INTERPOLATION_END_TYPE = 11;
 
     /**
      * Constructor.
@@ -44,8 +44,8 @@ class Twig_Token
      */
     public function __construct($type, $value, $lineno)
     {
-        $this->type   = $type;
-        $this->value  = $value;
+        $this->type = $type;
+        $this->value = $value;
         $this->lineno = $lineno;
     }
 
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParser.php b/core/vendor/twig/twig/lib/Twig/TokenParser.php
index decebd5..fa9b6d8 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParser.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParser.php
@@ -22,9 +22,9 @@
     protected $parser;
 
     /**
-     * Sets the parser associated with this token parser
+     * Sets the parser associated with this token parser.
      *
-     * @param $parser A Twig_Parser instance
+     * @param Twig_Parser $parser A Twig_Parser instance
      */
     public function setParser(Twig_Parser $parser)
     {
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParser/Block.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Block.php
index 81e6b1c..0a46200 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParser/Block.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParser/Block.php
@@ -47,7 +47,7 @@ public function parse(Twig_Token $token)
                 $value = $token->getValue();
 
                 if ($value != $name) {
-                    throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
+                    throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given)', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename());
                 }
             }
         } else {
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParser/From.php b/core/vendor/twig/twig/lib/Twig/TokenParser/From.php
index dd73f99..5540efa 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParser/From.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParser/From.php
@@ -52,6 +52,10 @@ public function parse(Twig_Token $token)
         $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag());
 
         foreach ($targets as $name => $alias) {
+            if ($this->parser->isReservedMacroName($name)) {
+                throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword', $name), $token->getLine(), $stream->getFilename());
+            }
+
             $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var'));
         }
 
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php
index 87a299d..ad910b5 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php
@@ -42,7 +42,7 @@ public function parse(Twig_Token $token)
             $value = $token->getValue();
 
             if ($value != $name) {
-                throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
+                throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given)', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename());
             }
         }
         $this->parser->popLocalScope();
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParser/Set.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Set.php
index 84f7e94..0b41909 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParser/Set.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParser/Set.php
@@ -48,13 +48,13 @@ public function parse(Twig_Token $token)
             $stream->expect(Twig_Token::BLOCK_END_TYPE);
 
             if (count($names) !== count($values)) {
-                throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignments.", $stream->getCurrent()->getLine(), $stream->getFilename());
+                throw new Twig_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getFilename());
             }
         } else {
             $capture = true;
 
             if (count($names) > 1) {
-                throw new Twig_Error_Syntax("When using set with a block, you cannot have a multi-target.", $stream->getCurrent()->getLine(), $stream->getFilename());
+                throw new Twig_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getFilename());
             }
 
             $stream->expect(Twig_Token::BLOCK_END_TYPE);
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParserBroker.php b/core/vendor/twig/twig/lib/Twig/TokenParserBroker.php
index ec3fba6..4a9cb5c 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParserBroker.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParserBroker.php
@@ -14,6 +14,7 @@
  * Default implementation of a token parser broker.
  *
  * @author Arnaud Le Blanc 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php b/core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php
index 3f006e3..3ec2a88 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php
@@ -16,6 +16,7 @@
  * Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name.
  *
  * @author Arnaud Le Blanc 
+ *
  * @deprecated since 1.12 (to be removed in 2.0)
  */
 interface Twig_TokenParserBrokerInterface
diff --git a/core/vendor/twig/twig/lib/Twig/TokenParserInterface.php b/core/vendor/twig/twig/lib/Twig/TokenParserInterface.php
index 31e8d5d..12ec396 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenParserInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenParserInterface.php
@@ -17,9 +17,9 @@
 interface Twig_TokenParserInterface
 {
     /**
-     * Sets the parser associated with this token parser
+     * Sets the parser associated with this token parser.
      *
-     * @param $parser A Twig_Parser instance
+     * @param Twig_Parser $parser A Twig_Parser instance
      */
     public function setParser(Twig_Parser $parser);
 
diff --git a/core/vendor/twig/twig/lib/Twig/TokenStream.php b/core/vendor/twig/twig/lib/Twig/TokenStream.php
index 7e95a4f..89d2575 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenStream.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenStream.php
@@ -29,9 +29,9 @@ class Twig_TokenStream
      */
     public function __construct(array $tokens, $filename = null)
     {
-        $this->tokens     = $tokens;
-        $this->current    = 0;
-        $this->filename   = $filename;
+        $this->tokens = $tokens;
+        $this->current = 0;
+        $this->filename = $filename;
     }
 
     /**
@@ -115,7 +115,7 @@ public function look($number = 1)
     }
 
     /**
-     * Tests the current token
+     * Tests the current token.
      *
      * @return bool
      */
@@ -125,7 +125,7 @@ public function test($primary, $secondary = null)
     }
 
     /**
-     * Checks if end of stream was reached
+     * Checks if end of stream was reached.
      *
      * @return bool
      */
@@ -135,7 +135,7 @@ public function isEOF()
     }
 
     /**
-     * Gets the current token
+     * Gets the current token.
      *
      * @return Twig_Token
      */
@@ -145,7 +145,7 @@ public function getCurrent()
     }
 
     /**
-     * Gets the filename associated with this stream
+     * Gets the filename associated with this stream.
      *
      * @return string
      */
diff --git a/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php
index e24b0b5..2c8b445 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php
@@ -22,7 +22,7 @@ public function testReprNumericValueWithLocale()
 
         $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
         if (false === setlocale(LC_NUMERIC, $required_locales)) {
-            $this->markTestSkipped('Could not set any of required locales: '.implode(", ", $required_locales));
+            $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales));
         }
 
         $this->assertEquals('1.2', $compiler->repr(1.2)->getSource());
diff --git a/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
index ee127e0..f8389ea 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
@@ -25,12 +25,12 @@ public function testAutoescapeOption()
     {
         $loader = new Twig_Loader_Array(array(
             'html' => '{{ foo }} {{ foo }}',
-            'js'   => '{{ bar }} {{ bar }}',
+            'js' => '{{ bar }} {{ bar }}',
         ));
 
         $twig = new Twig_Environment($loader, array(
-            'debug'      => true,
-            'cache'      => false,
+            'debug' => true,
+            'cache' => false,
             'autoescape' => array($this, 'escapingStrategyCallback'),
         ));
 
@@ -56,7 +56,7 @@ public function testGlobals()
         // globals can be modified after runtime init
         $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
         $twig->addGlobal('foo', 'foo');
-        $globals = $twig->getGlobals();
+        $twig->getGlobals();
         $twig->initRuntime();
         $twig->addGlobal('foo', 'bar');
         $globals = $twig->getGlobals();
@@ -91,7 +91,7 @@ public function testGlobals()
         // globals cannot be added after runtime init
         $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
         $twig->addGlobal('foo', 'foo');
-        $globals = $twig->getGlobals();
+        $twig->getGlobals();
         $twig->initRuntime();
         try {
             $twig->addGlobal('bar', 'bar');
@@ -103,7 +103,7 @@ public function testGlobals()
         // globals cannot be added after extensions init
         $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
         $twig->addGlobal('foo', 'foo');
-        $globals = $twig->getGlobals();
+        $twig->getGlobals();
         $twig->getFunctions();
         try {
             $twig->addGlobal('bar', 'bar');
@@ -115,7 +115,7 @@ public function testGlobals()
         // globals cannot be added after extensions and runtime init
         $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
         $twig->addGlobal('foo', 'foo');
-        $globals = $twig->getGlobals();
+        $twig->getGlobals();
         $twig->getFunctions();
         $twig->initRuntime();
         try {
diff --git a/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
index 6a78d2b..d58c40b 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
@@ -99,7 +99,7 @@ public function getErroredTemplates()
             // error occurs in an included template
             array(
                 array(
-                    'index'   => "{% include 'partial' %}",
+                    'index' => "{% include 'partial' %}",
                     'partial' => '{{ foo.bar }}',
                 ),
                 'partial', 1,
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
index b3b1cb0..8e9b764 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
@@ -18,7 +18,7 @@ public function testRandomFunction($value, $expectedInArray)
     {
         $env = new Twig_Environment();
 
-        for ($i = 0; $i < 100; $i++) {
+        for ($i = 0; $i < 100; ++$i) {
             $this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type
         }
     }
@@ -26,31 +26,31 @@ public function testRandomFunction($value, $expectedInArray)
     public function getRandomFunctionTestData()
     {
         return array(
-            array( // array
+            array(// array
                 array('apple', 'orange', 'citrus'),
                 array('apple', 'orange', 'citrus'),
             ),
-            array( // Traversable
+            array(// Traversable
                 new ArrayObject(array('apple', 'orange', 'citrus')),
                 array('apple', 'orange', 'citrus'),
             ),
-            array( // unicode string
+            array(// unicode string
                 'Ä€é',
                 array('Ä', '€', 'é'),
             ),
-            array( // numeric but string
+            array(// numeric but string
                 '123',
                 array('1', '2', '3'),
             ),
-            array( // integer
+            array(// integer
                 5,
                 range(0, 5, 1),
             ),
-            array( // float
+            array(// float
                 5.9,
                 range(0, 5, 1),
             ),
-            array( // negative
+            array(// negative
                 -2,
                 array(0, -1, -2),
             ),
@@ -61,7 +61,7 @@ public function testRandomFunctionWithoutParameter()
     {
         $max = mt_getrandmax();
 
-        for ($i = 0; $i < 100; $i++) {
+        for ($i = 0; $i < 100; ++$i) {
             $val = twig_random(new Twig_Environment());
             $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max);
         }
@@ -94,7 +94,7 @@ public function testRandomFunctionOnNonUTF8String()
         $twig->setCharset('ISO-8859-1');
 
         $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
-        for ($i = 0; $i < 30; $i++) {
+        for ($i = 0; $i < 30; ++$i) {
             $rand = twig_random($twig, $text);
             $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true));
         }
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
index fee35a0..3f62736 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
@@ -17,8 +17,8 @@ public function setUp()
     {
         self::$params = array(
             'name' => 'Fabien',
-            'obj'  => new FooObject(),
-            'arr'  => array('obj' => new FooObject()),
+            'obj' => new FooObject(),
+            'arr' => array('obj' => new FooObject()),
         );
 
         self::$templates = array(
@@ -31,9 +31,9 @@ public function setUp()
             '1_basic7' => '{{ cycle(["foo","bar"], 1) }}',
             '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}',
             '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}',
-            '1_basic'  => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
+            '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
             '1_layout' => '{% block content %}{% endblock %}',
-            '1_child'  => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
+            '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}",
         );
     }
 
@@ -141,7 +141,7 @@ public function testSandboxGloballySet()
     public function testSandboxLocallySetForAnInclude()
     {
         self::$templates = array(
-            '2_basic'    => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}',
+            '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}',
             '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
         );
 
@@ -149,7 +149,7 @@ public function testSandboxLocallySetForAnInclude()
         $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include');
 
         self::$templates = array(
-            '3_basic'    => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}',
+            '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}',
             '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}',
         );
 
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test
new file mode 100644
index 0000000..5dd9f38
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test
@@ -0,0 +1,10 @@
+--TEST--
+Exception for syntax error in reused template
+--TEMPLATE--
+{% use 'foo.twig' %}
+--TEMPLATE(foo.twig)--
+{% block bar %}
+    {% do node.data = 5 %}
+{% endblock %}
+--EXCEPTION--
+Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test
new file mode 100644
index 0000000..1992510
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test
@@ -0,0 +1,15 @@
+--TEST--
+Exception for an undefined template in a child template
+--TEMPLATE--
+{% extends 'base.twig' %}
+
+{% block sidebar %}
+    {{ include('include.twig') }}
+{% endblock %}
+--TEMPLATE(base.twig)--
+{% block sidebar %}
+{% endblock %}
+--DATA--
+return array()
+--EXCEPTION--
+Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5.
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test
new file mode 100644
index 0000000..6015380
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test
@@ -0,0 +1,10 @@
+--TEST--
+"batch" filter preserves array keys
+--TEMPLATE--
+{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',')  }}
+{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',')  }}
+--DATA--
+return array()
+--EXPECT--
+foo,key
+foo,key,0,1
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test
new file mode 100644
index 0000000..b9c058d
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test
@@ -0,0 +1,10 @@
+--TEST--
+"batch" filter with zero elements
+--TEMPLATE--
+{{ []|batch(3)|length }}
+{{ []|batch(3, 'fill')|length }}
+--DATA--
+return array()
+--EXPECT--
+0
+0
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test
new file mode 100644
index 0000000..8ffc492
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test
@@ -0,0 +1,16 @@
+--TEST--
+"include" tag sandboxed
+--TEMPLATE--
+{{ include("foo.twig", sandboxed = true) }}
+{{ include("bar.twig") }}
+--TEMPLATE(foo.twig)--
+foo
+--TEMPLATE(bar.twig)--
+{{ foo|e }}
+--DATA--
+return array('foo' => 'bar
') +--EXPECT-- +foo + + +bar<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test new file mode 100644 index 0000000..8bf6e10 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("unknown.twig", sandboxed = true, ignore_missing = true) }} +{{ include("bar.twig") }} +--TEMPLATE(bar.twig)-- +{{ foo|e }} +--DATA-- +return array('foo' => 'bar
') +--EXPECT-- + + +bar<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test new file mode 100644 index 0000000..412c90f --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test @@ -0,0 +1,21 @@ +--TEST-- +macro with arbitrary arguments +--TEMPLATE-- +{% from _self import test1, test2 %} + +{% macro test1(var) %} + {{- var }}: {{ varargs|join(", ") }} +{% endmacro %} + +{% macro test2() %} + {{- varargs|join(", ") }} +{% endmacro %} + +{{ test1("foo", "bar", "foobar") }} +{{ test2("foo", "bar", "foobar") }} +--DATA-- +return array(); +--EXPECT-- +foo: bar, foobar + +foo, bar, foobar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test new file mode 100644 index 0000000..b08c8ec --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test @@ -0,0 +1,8 @@ +--TEST-- +macro with varargs argument +--TEMPLATE-- +{% macro test(varargs) %} +{% endmacro %} +--EXCEPTION-- +Twig_Error_Syntax: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2 + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test new file mode 100644 index 0000000..6df4f5d --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test @@ -0,0 +1,9 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% from 'forms.twig' import templateName %} +--TEMPLATE(forms.twig)-- +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test new file mode 100644 index 0000000..e5aa749 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test @@ -0,0 +1,11 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% import 'forms.twig' as macros %} + +{{ macros.parent() }} +--TEMPLATE(forms.twig)-- +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test new file mode 100644 index 0000000..a2dde5a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test @@ -0,0 +1,10 @@ +--TEST-- +"macro" tag with reserved name +--TEMPLATE-- +{% macro parent(arg1, arg2) %} + parent +{% endmacro %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test index d212f5d..545f51f 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -50,6 +50,7 @@ {{ [] in [true, ''] ? 'TRUE' : 'FALSE' }} {{ [] in [true, []] ? 'TRUE' : 'FALSE' }} +{{ resource ? 'TRUE' : 'FALSE' }} {{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }} {{ object in 'stdClass' ? 'TRUE' : 'FALSE' }} {{ [] in 'Array' ? 'TRUE' : 'FALSE' }} @@ -73,7 +74,7 @@ {{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} {{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} --DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => fopen(dirname(__FILE__), 'r')) +return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => opendir(dirname(__FILE__))) --EXPECT-- TRUE TRUE @@ -102,6 +103,7 @@ FALSE TRUE +TRUE FALSE FALSE FALSE diff --git a/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php index 70f9b80..1908bcd 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php @@ -175,7 +175,7 @@ public function §Function($value) } /** - * nl2br which also escapes, for testing escaper filters + * nl2br which also escapes, for testing escaper filters. */ public function escape_and_nl2br($env, $value, $sep = '
') { @@ -183,7 +183,7 @@ public function escape_and_nl2br($env, $value, $sep = '
') } /** - * nl2br only, for testing filters with pre_escape + * nl2br only, for testing filters with pre_escape. */ public function nl2br($value, $sep = '
') { diff --git a/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php index c4d7083..bf602eb 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -144,16 +144,16 @@ public function testBigNumbers() $lexer = new Twig_Lexer(new Twig_Environment()); $stream = $lexer->tokenize($template); + $stream->next(); $node = $stream->next(); - $node = $stream->next(); - $this->assertEquals("922337203685477580700", $node->getValue()); + $this->assertEquals('922337203685477580700', $node->getValue()); } public function testStringWithEscapedDelimiter() { $tests = array( "{{ 'foo \' bar' }}" => 'foo \' bar', - '{{ "foo \" bar" }}' => "foo \" bar", + '{{ "foo \" bar" }}' => 'foo " bar', ); $lexer = new Twig_Lexer(new Twig_Environment()); foreach ($tests as $template => $expected) { diff --git a/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php index 03c1eb9..e07f374 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -78,8 +78,8 @@ public function testPaths() ), $loader->getPaths('named')); $this->assertEquals( - $basePath.'/named_quater/named_absolute.html', - $loader->getCacheKey('@named/named_absolute.html') + realpath($basePath.'/named_quater/named_absolute.html'), + realpath($loader->getCacheKey('@named/named_absolute.html')) ); $this->assertEquals("path (final)\n", $loader->getSource('index.html')); $this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html')); diff --git a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php index 36b6329..942aff9 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php @@ -18,8 +18,8 @@ public function testGetProperties() } $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array( - 'debug' => true, - 'cache' => false, + 'debug' => true, + 'cache' => false, 'autoescape' => false, )); diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php index af4e351..43afcd2 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php @@ -73,7 +73,7 @@ public function testResolveArgumentsWithMissingValueForOptionalArgument() public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); $this->assertEquals(array('arg1'), $node->getArguments(array($this, 'customFunction'), array('arg1' => 'arg1'))); } @@ -84,6 +84,16 @@ public function testGetArgumentsForStaticMethod() $this->assertEquals(array('arg1'), $node->getArguments(__CLASS__.'::customStaticFunction', array('arg1' => 'arg1'))); } + /** + * @expectedException LogicException + * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = array()". + */ + public function testResolveArgumentsWithMissingParameterForArbitraryArguments() + { + $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); + $node->getArguments(array($this, 'customFunctionWithArbitraryArguments'), array()); + } + public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = array()) { } @@ -91,6 +101,10 @@ public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = ar public function customFunction($arg1, $arg2 = 'default', $arg3 = array()) { } + + public function customFunctionWithArbitraryArguments() + { + } } class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php index 4aefa7e..e822e2f 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -25,6 +25,10 @@ public function testConstructor() public function getTests() { + $environment = new Twig_Environment(); + $environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true))); + $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); + $tests = array(); $expr = new Twig_Node_Expression_Constant('foo', 1); @@ -41,7 +45,7 @@ public function getTests() $date = new Twig_Node_Expression_Constant(0, 1); $node = $this->createFilter($date, 'date', array( 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), + 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), )); $tests[] = array($node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'); @@ -69,6 +73,31 @@ public function getTests() $tests[] = array($node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), array("foo"))'); } + // needs environment + $node = $this->createFilter($string, 'bar'); + $tests[] = array($node, 'bar($this->env, "abc")', $environment); + + $node = $this->createFilter($string, 'bar', array(new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'bar($this->env, "abc", "bar")', $environment); + + // arbitrary named arguments + $node = $this->createFilter($string, 'barbar'); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc")', $environment); + + $node = $this->createFilter($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, null, array("foo" => "bar"))', $environment); + + $node = $this->createFilter($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment); + + $node = $this->createFilter($string, 'barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + return $tests; } @@ -119,3 +148,7 @@ protected function getEnvironment() return parent::getEnvironment(); } } + +function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php index 209b8cf..35edfe1 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -28,6 +28,7 @@ public function getTests() $environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true))); $environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true))); $environment->addFunction(new Twig_SimpleFunction('foobar', 'foobar', array('needs_environment' => true, 'needs_context' => true))); + $environment->addFunction(new Twig_SimpleFunction('barbar', 'twig_tests_function_barbar', array('is_variadic' => true))); $tests = array(); @@ -58,10 +59,28 @@ public function getTests() // named arguments $node = $this->createFunction('date', array( 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'date' => new Twig_Node_Expression_Constant(0, 1), + 'date' => new Twig_Node_Expression_Constant(0, 1), )); $tests[] = array($node, 'twig_date_converter($this->env, 0, "America/Chicago")'); + // arbitrary named arguments + $node = $this->createFunction('barbar'); + $tests[] = array($node, 'twig_tests_function_barbar()', $environment); + + $node = $this->createFunction('barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment); + + $node = $this->createFunction('barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_function_barbar(null, "bar")', $environment); + + $node = $this->createFunction('barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment); + // function as an anonymous function if (PHP_VERSION_ID >= 50300) { $node = $this->createFunction('anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); @@ -85,3 +104,7 @@ protected function getEnvironment() return parent::getEnvironment(); } } + +function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php index e62a8af..47a6889 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -25,6 +25,9 @@ public function testConstructor() public function getTests() { + $environment = new Twig_Environment(); + $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); + $tests = array(); $expr = new Twig_Node_Expression_Constant('foo', 1); @@ -37,6 +40,25 @@ public function getTests() $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); } + // arbitrary named arguments + $string = new Twig_Node_Expression_Constant('abc', 1); + $node = $this->createTest($string, 'barbar'); + $tests[] = array($node, 'twig_tests_test_barbar("abc")', $environment); + + $node = $this->createTest($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_test_barbar("abc", null, null, array("foo" => "bar"))', $environment); + + $node = $this->createTest($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); + $tests[] = array($node, 'twig_tests_test_barbar("abc", null, "bar")', $environment); + + $node = $this->createTest($string, 'barbar', array( + new Twig_Node_Expression_Constant('1', 1), + new Twig_Node_Expression_Constant('2', 1), + new Twig_Node_Expression_Constant('3', 1), + 'foo' => new Twig_Node_Expression_Constant('bar', 1), + )); + $tests[] = array($node, 'twig_tests_test_barbar("abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + return $tests; } @@ -54,3 +76,7 @@ protected function getEnvironment() return parent::getEnvironment(); } } + +function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = array()) +{ +} diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php index 52ee8b7..901e57b 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -31,14 +31,23 @@ public function getTests() ), array(), 1); $node = new Twig_Node_Macro('foo', $body, $arguments, 1); + if (PHP_VERSION_ID >= 50600) { + $declaration = ', ...$__varargs__'; + $varargs = '$__varargs__'; + } else { + $declaration = ''; + $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : array()'; + } + return array( array($node, <<env->mergeGlobals(array( "foo" => \$__foo__, "bar" => \$__bar__, + "varargs" => $varargs, )); \$blocks = array(); diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php index 5facc55..5688af8 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -130,7 +130,7 @@ public function getDebugInfo() EOF , $twig); - $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant("foo", 4))), 4); + $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 4))), 4); $body = new Twig_Node(array($set)); $extends = new Twig_Node_Expression_Conditional( new Twig_Node_Expression_Constant(true, 2), diff --git a/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php index b4a3abb..a451aae 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -16,7 +16,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase public function testSetMacroThrowsExceptionOnReservedMethods() { $parser = $this->getParser(); - $parser->setMacro('display', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); + $parser->setMacro('parent', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); } /** diff --git a/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php index 555a5e7..da97f47 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php @@ -13,32 +13,88 @@ { protected function getProfile() { - $profile = new Twig_Profiler_Profile(); - $index = new Twig_Profiler_Profile('index.twig', Twig_Profiler_Profile::TEMPLATE); - $profile->addProfile($index); - $body = new Twig_Profiler_Profile('embedded.twig', Twig_Profiler_Profile::BLOCK, 'body'); - $body->leave(); - $index->addProfile($body); - $embedded = new Twig_Profiler_Profile('embedded.twig', Twig_Profiler_Profile::TEMPLATE); - $included = new Twig_Profiler_Profile('included.twig', Twig_Profiler_Profile::TEMPLATE); - $embedded->addProfile($included); - $index->addProfile($embedded); - $included->leave(); - $embedded->leave(); - - $macro = new Twig_Profiler_Profile('index.twig', Twig_Profiler_Profile::MACRO, 'foo'); - $macro->leave(); - $index->addProfile($macro); - - $embedded = clone $embedded; - $index->addProfile($embedded); - usleep(500); - $embedded->leave(); - - usleep(4500); - $index->leave(); - - $profile->leave(); + $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); + + $profile->expects($this->any())->method('isRoot')->will($this->returnValue(true)); + $profile->expects($this->any())->method('getName')->will($this->returnValue('main')); + $profile->expects($this->any())->method('getDuration')->will($this->returnValue(1)); + $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); + + $subProfiles = array( + $this->getIndexProfile( + array( + $this->getEmbeddedBlockProfile(), + $this->getEmbeddedTemplateProfile( + array( + $this->getIncludedTemplateProfile(), + ) + ), + $this->getMacroProfile(), + $this->getEmbeddedTemplateProfile( + array( + $this->getIncludedTemplateProfile(), + ) + ), + ) + ), + ); + + $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); + $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); + + return $profile; + } + + private function getIndexProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 1, true, 'template', 'index.twig', $subProfiles); + } + + private function getEmbeddedBlockProfile(array $subProfiles = array()) + { + return $this->generateProfile('body', 0.0001, false, 'block', 'embedded.twig', $subProfiles); + } + + private function getEmbeddedTemplateProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 0.0001, true, 'template', 'embedded.twig', $subProfiles); + } + + private function getIncludedTemplateProfile(array $subProfiles = array()) + { + return $this->generateProfile('main', 0.0001, true, 'template', 'included.twig', $subProfiles); + } + + private function getMacroProfile(array $subProfiles = array()) + { + return $this->generateProfile('foo', 0.0001, false, 'macro', 'index.twig', $subProfiles); + } + + /** + * @param string $name + * @param float $duration + * @param bool $isTemplate + * @param string $type + * @param string $templateName + * @param array $subProfiles + * + * @return Twig_Profiler_Profile + */ + private function generateProfile($name, $duration, $isTemplate, $type, $templateName, array $subProfiles = array()) + { + $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); + + $profile->expects($this->any())->method('isRoot')->will($this->returnValue(false)); + $profile->expects($this->any())->method('getName')->will($this->returnValue($name)); + $profile->expects($this->any())->method('getDuration')->will($this->returnValue($duration)); + $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); + $profile->expects($this->any())->method('isTemplate')->will($this->returnValue($isTemplate)); + $profile->expects($this->any())->method('getType')->will($this->returnValue($type)); + $profile->expects($this->any())->method('getTemplate')->will($this->returnValue($templateName)); + $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); + $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); return $profile; } diff --git a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php index 9010f28..64b77f5 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -11,6 +11,15 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase { /** + * @expectedException LogicException + */ + public function testDisplayBlocksAcceptTemplateOnlyAsBlocks() + { + $template = $this->getMockForAbstractClass('Twig_Template', array(), '', false); + $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo'))); + } + + /** * @dataProvider getAttributeExceptions */ public function testGetAttributeExceptions($template, $message, $useExt) @@ -27,12 +36,13 @@ public function testGetAttributeExceptions($template, $message, $useExt) $template = $env->loadTemplate($name); $context = array( - 'string' => 'foo', - 'empty_array' => array(), - 'array' => array('foo' => 'foo'), - 'array_access' => new Twig_TemplateArrayAccessObject(), + 'string' => 'foo', + 'null' => null, + 'empty_array' => array(), + 'array' => array('foo' => 'foo'), + 'array_access' => new Twig_TemplateArrayAccessObject(), 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), - 'object' => new stdClass(), + 'object' => new stdClass(), ); try { @@ -47,16 +57,19 @@ public function getAttributeExceptions() { $tests = array( array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1', false), + array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1', false), array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1', false), array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1', false), array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1', false), array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1', false), + array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1', false), + array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1', false), array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1', false), array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1', false), array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1', false), array('{{ array_access.a }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), - array('{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ _self.foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), + array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.', false), array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1', false), ); @@ -134,6 +147,11 @@ public function testGetAttributeWithTemplateAsObject($useExt) $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty')); $this->assertSame('', $template->getAttribute($template1, 'empty')); + + $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true)); } public function getGetAttributeWithTemplateAsObject() @@ -257,27 +275,27 @@ public function getGetAttributeTests() { $array = array( 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', ); - $objectArray = new Twig_TemplateArrayAccessObject(); - $stdObject = (object) $array; + $objectArray = new Twig_TemplateArrayAccessObject(); + $stdObject = (object) $array; $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); - $propertyObject = new Twig_TemplatePropertyObject(); - $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); - $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); - $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); - $methodObject = new Twig_TemplateMethodObject(); - $magicMethodObject = new Twig_TemplateMagicMethodObject(); - - $anyType = Twig_Template::ANY_CALL; + $propertyObject = new Twig_TemplatePropertyObject(); + $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); + $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); + $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); + $methodObject = new Twig_TemplateMethodObject(); + $magicMethodObject = new Twig_TemplateMagicMethodObject(); + + $anyType = Twig_Template::ANY_CALL; $methodType = Twig_Template::METHOD_CALL; - $arrayType = Twig_Template::ARRAY_CALL; + $arrayType = Twig_Template::ARRAY_CALL; $basicTests = array( // array(defined, value, property to fetch) @@ -370,7 +388,7 @@ public function getGetAttributeTests() // tests when input is not an array or object $tests = array_merge($tests, array( array(false, null, 42, 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a integer variable ("42")'), - array(false, null, "string", 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string")'), + array(false, null, 'string', 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string")'), array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty'), )); @@ -452,12 +470,12 @@ class Twig_TemplateArrayAccessObject implements ArrayAccess public $attributes = array( 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', ); public function offsetExists($name) @@ -484,12 +502,12 @@ class Twig_TemplateMagicPropertyObject public $defined = 'defined'; public $attributes = array( - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - '09' => '09', - '+4' => '+4', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + '09' => '09', + '+4' => '+4', ); protected $protected = 'protected'; @@ -509,16 +527,16 @@ class Twig_TemplateMagicPropertyObjectWithException { public function __isset($key) { - throw new Exception("Hey! Don't try to isset me!"); + throw new Exception('Hey! Don\'t try to isset me!'); } } class Twig_TemplatePropertyObject { public $defined = 'defined'; - public $zero = 0; - public $null = null; - public $bar = true; + public $zero = 0; + public $null = null; + public $bar = true; protected $protected = 'protected'; } diff --git a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php index b28d3cd..98422a5 100644 --- a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php @@ -9,137 +9,137 @@ class Twig_Test_EscapingTest extends PHPUnit_Framework_TestCase { /** - * All character encodings supported by htmlspecialchars() + * All character encodings supported by htmlspecialchars(). */ protected $htmlSpecialChars = array( - '\'' => ''', - '"' => '"', - '<' => '<', - '>' => '>', - '&' => '&', + '\'' => ''', + '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&', ); protected $htmlAttrSpecialChars = array( - '\'' => ''', + '\'' => ''', /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => 'Ā', + 'Ā' => 'Ā', /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '-' => '-', - '_' => '_', + ',' => ',', + '.' => '.', + '-' => '-', + '_' => '_', /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', /* Basic control characters and null */ - "\r" => ' ', - "\n" => ' ', - "\t" => ' ', - "\0" => '�', // should use Unicode replacement char + "\r" => ' ', + "\n" => ' ', + "\t" => ' ', + "\0" => '�', // should use Unicode replacement char /* Encode chars as named entities where possible */ - '<' => '<', - '>' => '>', - '&' => '&', - '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&', + '"' => '"', /* Encode spaces for quoteless attribute protection */ - ' ' => ' ', + ' ' => ' ', ); protected $jsSpecialChars = array( /* HTML special chars - escape without exception to hex */ - '<' => '\\x3C', - '>' => '\\x3E', - '\'' => '\\x27', - '"' => '\\x22', - '&' => '\\x26', + '<' => '\\x3C', + '>' => '\\x3E', + '\'' => '\\x27', + '"' => '\\x22', + '&' => '\\x26', /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\u0100', + 'Ā' => '\\u0100', /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '_' => '_', + ',' => ',', + '.' => '.', + '_' => '_', /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', /* Basic control characters and null */ - "\r" => '\\x0D', - "\n" => '\\x0A', - "\t" => '\\x09', - "\0" => '\\x00', + "\r" => '\\x0D', + "\n" => '\\x0A', + "\t" => '\\x09', + "\0" => '\\x00', /* Encode spaces for quoteless attribute protection */ - ' ' => '\\x20', + ' ' => '\\x20', ); protected $urlSpecialChars = array( /* HTML special chars - escape without exception to percent encoding */ - '<' => '%3C', - '>' => '%3E', - '\'' => '%27', - '"' => '%22', - '&' => '%26', + '<' => '%3C', + '>' => '%3E', + '\'' => '%27', + '"' => '%22', + '&' => '%26', /* Characters beyond ASCII value 255 to hex sequence */ - 'Ā' => '%C4%80', + 'Ā' => '%C4%80', /* Punctuation and unreserved check */ - ',' => '%2C', - '.' => '.', - '_' => '_', - '-' => '-', - ':' => '%3A', - ';' => '%3B', - '!' => '%21', + ',' => '%2C', + '.' => '.', + '_' => '_', + '-' => '-', + ':' => '%3A', + ';' => '%3B', + '!' => '%21', /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', /* Basic control characters and null */ - "\r" => '%0D', - "\n" => '%0A', - "\t" => '%09', - "\0" => '%00', + "\r" => '%0D', + "\n" => '%0A', + "\t" => '%09', + "\0" => '%00', /* PHP quirks from the past */ - ' ' => '%20', - '~' => '~', - '+' => '%2B', + ' ' => '%20', + '~' => '~', + '+' => '%2B', ); protected $cssSpecialChars = array( /* HTML special chars - escape without exception to hex */ - '<' => '\\3C ', - '>' => '\\3E ', - '\'' => '\\27 ', - '"' => '\\22 ', - '&' => '\\26 ', + '<' => '\\3C ', + '>' => '\\3E ', + '\'' => '\\27 ', + '"' => '\\22 ', + '&' => '\\26 ', /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\100 ', + 'Ā' => '\\100 ', /* Immune chars excluded */ - ',' => '\\2C ', - '.' => '\\2E ', - '_' => '\\5F ', + ',' => '\\2C ', + '.' => '\\2E ', + '_' => '\\5F ', /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', /* Basic control characters and null */ - "\r" => '\\D ', - "\n" => '\\A ', - "\t" => '\\9 ', - "\0" => '\\0 ', + "\r" => '\\D ', + "\n" => '\\A ', + "\t" => '\\9 ', + "\0" => '\\0 ', /* Encode spaces for quoteless attribute protection */ - ' ' => '\\20 ', + ' ' => '\\20 ', ); protected $env; @@ -205,16 +205,16 @@ public function testUrlEscapingConvertsSpecialChars() } /** - * Range tests to confirm escaped range of characters is within OWASP recommendation + * Range tests to confirm escaped range of characters is within OWASP recommendation. */ /** * Only testing the first few 2 ranges on this prot. function as that's all these - * other range tests require + * other range tests require. */ public function testUnicodeCodepointConversionToUtf8() { - $expected = " ~ޙ"; + $expected = ' ~ޙ'; $codepoints = array(0x20, 0x7e, 0x799); $result = ''; foreach ($codepoints as $value) { @@ -226,7 +226,8 @@ public function testUnicodeCodepointConversionToUtf8() /** * Convert a Unicode Codepoint to a literal UTF-8 character. * - * @param int $codepoint Unicode codepoint in hex notation + * @param int $codepoint Unicode codepoint in hex notation + * * @return string UTF-8 literal string */ protected function codepointToUtf8($codepoint) @@ -255,7 +256,7 @@ protected function codepointToUtf8($codepoint) public function testJavascriptEscapingEscapesOwaspRecommendedRanges() { $immune = array(',', '.', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; $chr++) { + for ($chr = 0; $chr < 0xFF; ++$chr) { if ($chr >= 0x30 && $chr <= 0x39 || $chr >= 0x41 && $chr <= 0x5A || $chr >= 0x61 && $chr <= 0x7A) { @@ -278,7 +279,7 @@ public function testJavascriptEscapingEscapesOwaspRecommendedRanges() public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() { $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; $chr++) { + for ($chr = 0; $chr < 0xFF; ++$chr) { if ($chr >= 0x30 && $chr <= 0x39 || $chr >= 0x41 && $chr <= 0x5A || $chr >= 0x61 && $chr <= 0x7A) { @@ -301,7 +302,7 @@ public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() public function testCssEscapingEscapesOwaspRecommendedRanges() { // CSS has no exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; $chr++) { + for ($chr = 0; $chr < 0xFF; ++$chr) { if ($chr >= 0x30 && $chr <= 0x39 || $chr >= 0x41 && $chr <= 0x5A || $chr >= 0x61 && $chr <= 0x7A) {