`_ first):
+
+.. code-block:: sh
+
+ blackfire --slot=7 upload /path/to/profile.prof
+
Optimizer Extension
~~~~~~~~~~~~~~~~~~~
diff --git a/core/vendor/twig/twig/doc/filters/batch.rst b/core/vendor/twig/twig/doc/filters/batch.rst
index 30dd782..da47eb6 100644
--- a/core/vendor/twig/twig/doc/filters/batch.rst
+++ b/core/vendor/twig/twig/doc/filters/batch.rst
@@ -5,7 +5,7 @@
The ``batch`` filter was added in Twig 1.12.3.
The ``batch`` filter "batches" items by returning a list of lists with the
-given number of items. If you provide a second parameter, it is used to fill
+given number of items. A second parameter can be provided and used to fill in
missing items:
.. code-block:: jinja
diff --git a/core/vendor/twig/twig/doc/filters/index.rst b/core/vendor/twig/twig/doc/filters/index.rst
index 3ed0952..8daa961 100644
--- a/core/vendor/twig/twig/doc/filters/index.rst
+++ b/core/vendor/twig/twig/doc/filters/index.rst
@@ -20,10 +20,9 @@ Filters
last
length
lower
+ merge
nl2br
number_format
- merge
- upper
raw
replace
reverse
@@ -34,4 +33,5 @@ Filters
striptags
title
trim
+ upper
url_encode
diff --git a/core/vendor/twig/twig/doc/filters/slice.rst b/core/vendor/twig/twig/doc/filters/slice.rst
index a856664..70bf139 100644
--- a/core/vendor/twig/twig/doc/filters/slice.rst
+++ b/core/vendor/twig/twig/doc/filters/slice.rst
@@ -32,7 +32,7 @@ As syntactic sugar, you can also use the ``[]`` notation:
{# ... #}
{% endfor %}
- {{ '12345'[1:2] }}
+ {{ '12345'[1:2] }} {# will display "23" #}
{# you can omit the first argument -- which is the same as 0 #}
{{ '12345'[:2] }} {# will display "12" #}
diff --git a/core/vendor/twig/twig/doc/installation.rst b/core/vendor/twig/twig/doc/installation.rst
index 2d19f75..eeaef9a 100644
--- a/core/vendor/twig/twig/doc/installation.rst
+++ b/core/vendor/twig/twig/doc/installation.rst
@@ -28,7 +28,7 @@ Installing the development version
.. code-block:: bash
- git clone git://github.com/fabpot/Twig.git
+ git clone git://github.com/twigphp/Twig.git
Installing the PEAR package
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -107,7 +107,7 @@ advantage of the C extension. Note that this extension does not replace the
PHP code but only provides an optimized version of the
``Twig_Template::getAttribute()`` method.
-.. _`download page`: https://github.com/fabpot/Twig/tags
-.. _`Composer`: https://getcomposer.org/download/
+.. _`download page`: https://github.com/twigphp/Twig/tags
+.. _`Composer`: https://getcomposer.org/download/
.. _`PHP documentation`: https://wiki.php.net/internals/windows/stepbystepbuild
-.. _`Zend Server FAQ`: http://www.zend.com/en/products/server/faq#faqD6
+.. _`Zend Server FAQ`: http://www.zend.com/en/products/server/faq#faqD6
diff --git a/core/vendor/twig/twig/doc/intro.rst b/core/vendor/twig/twig/doc/intro.rst
index 3a7c1d4..773c476 100644
--- a/core/vendor/twig/twig/doc/intro.rst
+++ b/core/vendor/twig/twig/doc/intro.rst
@@ -50,9 +50,9 @@ This section gives you a brief introduction to the PHP API for Twig.
require_once '/path/to/vendor/autoload.php';
- $loader = new Twig_Loader_Array(
+ $loader = new Twig_Loader_Array(array(
'index' => 'Hello {{ name }}!',
- );
+ ));
$twig = new Twig_Environment($loader);
echo $twig->render('index', array('name' => 'Fabien'));
diff --git a/core/vendor/twig/twig/doc/tags/if.rst b/core/vendor/twig/twig/doc/tags/if.rst
index 273207d..b10dcb4 100644
--- a/core/vendor/twig/twig/doc/tags/if.rst
+++ b/core/vendor/twig/twig/doc/tags/if.rst
@@ -29,6 +29,14 @@ You can also test if an array is not empty:
If you want to test if the variable is defined, use ``if users is
defined`` instead.
+You can also use ``not`` to check for values that evaluate to ``false``:
+
+.. code-block:: jinja
+
+ {% if not user.subscribed %}
+ 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:
diff --git a/core/vendor/twig/twig/doc/tags/index.rst b/core/vendor/twig/twig/doc/tags/index.rst
index 64e8864..e6a632b 100644
--- a/core/vendor/twig/twig/doc/tags/index.rst
+++ b/core/vendor/twig/twig/doc/tags/index.rst
@@ -6,10 +6,10 @@ Tags
autoescape
block
- filter
do
embed
extends
+ filter
flush
for
from
diff --git a/core/vendor/twig/twig/doc/templates.rst b/core/vendor/twig/twig/doc/templates.rst
index 82b6f0c..7ff7862 100644
--- a/core/vendor/twig/twig/doc/templates.rst
+++ b/core/vendor/twig/twig/doc/templates.rst
@@ -866,7 +866,7 @@ Extension` chapter.
.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig
.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin
.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language
-.. _`extension repository`: http://github.com/fabpot/Twig-extensions
+.. _`extension repository`: http://github.com/twigphp/Twig-extensions
.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode
.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode
.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig
diff --git a/core/vendor/twig/twig/ext/twig/php_twig.h b/core/vendor/twig/twig/ext/twig/php_twig.h
index e116b4c..13bb8cd 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.16.2"
+#define PHP_TWIG_VERSION "1.18.0"
#include "php.h"
diff --git a/core/vendor/twig/twig/lib/Twig/Autoloader.php b/core/vendor/twig/twig/lib/Twig/Autoloader.php
index 42f16f0..36b1095 100644
--- a/core/vendor/twig/twig/lib/Twig/Autoloader.php
+++ b/core/vendor/twig/twig/lib/Twig/Autoloader.php
@@ -19,7 +19,7 @@ class Twig_Autoloader
/**
* Registers Twig_Autoloader as an SPL autoloader.
*
- * @param bool $prepend Whether to prepend the autoloader or not.
+ * @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
diff --git a/core/vendor/twig/twig/lib/Twig/Compiler.php b/core/vendor/twig/twig/lib/Twig/Compiler.php
index 93dc876..2514c31 100644
--- a/core/vendor/twig/twig/lib/Twig/Compiler.php
+++ b/core/vendor/twig/twig/lib/Twig/Compiler.php
@@ -231,13 +231,15 @@ public function addDebugInfo(Twig_NodeInterface $node)
public function getDebugInfo()
{
+ ksort($this->debugInfo);
+
return $this->debugInfo;
}
/**
* Indents the generated code.
*
- * @param int $step The number of indentation to add
+ * @param int $step The number of indentation to add
*
* @return Twig_Compiler The current compiler instance
*/
@@ -251,7 +253,7 @@ public function indent($step = 1)
/**
* Outdents the generated code.
*
- * @param int $step The number of indentation to remove
+ * @param int $step The number of indentation to remove
*
* @return Twig_Compiler The current compiler instance
*
diff --git a/core/vendor/twig/twig/lib/Twig/Environment.php b/core/vendor/twig/twig/lib/Twig/Environment.php
index 17e88ab..0cb9bb7 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.16.2';
+ const VERSION = '1.18.0';
protected $charset;
protected $loader;
@@ -72,6 +72,7 @@ class Twig_Environment
* * false: disable auto-escaping
* * true: equivalent to html
* * html, js: set the autoescaping to one of the supported strategies
+ * * filename: set the autoescaping strategy based on the template filename extension
* * PHP callback: a PHP callback that returns an escaping strategy based on the template "filename"
*
* * optimizations: A flag that indicates which optimizations to apply
@@ -154,7 +155,7 @@ public function disableDebug()
/**
* Checks if debug mode is enabled.
*
- * @return bool true if debug mode is enabled, false otherwise
+ * @return bool true if debug mode is enabled, false otherwise
*/
public function isDebug()
{
@@ -180,7 +181,7 @@ public function disableAutoReload()
/**
* Checks if the auto_reload option is enabled.
*
- * @return bool true if auto_reload is enabled, false otherwise
+ * @return bool true if auto_reload is enabled, false otherwise
*/
public function isAutoReload()
{
@@ -206,7 +207,7 @@ public function disableStrictVariables()
/**
* Checks if the strict_variables option is enabled.
*
- * @return bool true if strict_variables is enabled, false otherwise
+ * @return bool true if strict_variables is enabled, false otherwise
*/
public function isStrictVariables()
{
@@ -223,12 +224,12 @@ public function getCache()
return $this->cache;
}
- /**
- * Sets the cache directory or false if cache is disabled.
- *
- * @param string|false $cache The absolute path to the compiled templates,
- * or false to disable cache
- */
+ /**
+ * Sets the cache directory or false if cache is disabled.
+ *
+ * @param string|false $cache The absolute path to the compiled templates,
+ * or false to disable cache
+ */
public function setCache($cache)
{
$this->cache = $cache ? $cache : false;
@@ -255,8 +256,8 @@ public function getCacheFilename($name)
/**
* Gets the template class associated with the given string.
*
- * @param string $name The name for which to calculate the template class name
- * @param int $index The index if it is an embedded template
+ * @param string $name The name for which to calculate the template class name
+ * @param int $index The index if it is an embedded template
*
* @return string The template class name
*/
@@ -310,8 +311,8 @@ public function display($name, array $context = array())
/**
* Loads a template by name.
*
- * @param string $name The template name
- * @param int $index The index if it is an embedded template
+ * @param string $name The template name
+ * @param int $index The index if it is an embedded template
*
* @return Twig_TemplateInterface A template instance representing the given template name
*
@@ -346,16 +347,51 @@ public function loadTemplate($name, $index = null)
}
/**
+ * Creates a template from source.
+ *
+ * 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
+ *
+ * @return Twig_Template A template instance representing the given template name
+ *
+ * @throws Twig_Error_Loader When the template cannot be found
+ * @throws Twig_Error_Syntax When an error occurred during compilation
+ */
+ public function createTemplate($template)
+ {
+ $name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false));
+
+ $loader = new Twig_Loader_Chain(array(
+ new Twig_Loader_Array(array($name => $template)),
+ $current = $this->getLoader(),
+ ));
+
+ $this->setLoader($loader);
+ try {
+ $template = $this->loadTemplate($name);
+ } catch (Exception $e) {
+ $this->setLoader($current);
+
+ throw $e;
+ }
+ $this->setLoader($current);
+
+ return $template;
+ }
+
+ /**
* Returns true if the template is still fresh.
*
* Besides checking the loader for freshness information,
* this method also checks if the enabled extensions have
* not changed.
*
- * @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 The last modification time of the cached template
*
- * @return bool true if the template is fresh, false otherwise
+ * @return bool true if the template is fresh, false otherwise
*/
public function isTemplateFresh($name, $time)
{
@@ -626,7 +662,7 @@ public function initRuntime()
*
* @param string $name The extension name
*
- * @return bool Whether the extension is registered or not
+ * @return bool Whether the extension is registered or not
*/
public function hasExtension($name)
{
@@ -1232,8 +1268,11 @@ protected function writeCacheFile($file, $content)
{
$dir = dirname($file);
if (!is_dir($dir)) {
- if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
- throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir));
+ 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));
+ }
}
} elseif (!is_writable($dir)) {
throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir));
diff --git a/core/vendor/twig/twig/lib/Twig/Error.php b/core/vendor/twig/twig/lib/Twig/Error.php
index 5b253dd..afb8ddd 100644
--- a/core/vendor/twig/twig/lib/Twig/Error.php
+++ b/core/vendor/twig/twig/lib/Twig/Error.php
@@ -111,7 +111,7 @@ public function setTemplateFile($filename)
/**
* Gets the template line where the error occurred.
*
- * @return int The template line
+ * @return int The template line
*/
public function getTemplateLine()
{
@@ -121,7 +121,7 @@ public function getTemplateLine()
/**
* Sets the template line where the error occurred.
*
- * @param int $lineno The template line
+ * @param int $lineno The template line
*/
public function setTemplateLine($lineno)
{
diff --git a/core/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php b/core/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php
index 48df9e1..b168c3c 100644
--- a/core/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php
@@ -23,7 +23,7 @@
*
* @param string $name The name of the template to check if we can load
*
- * @return bool If the template source code is handled by this loader or not
+ * @return bool If the template source code is handled by this loader or not
*/
public function exists($name);
}
diff --git a/core/vendor/twig/twig/lib/Twig/ExpressionParser.php b/core/vendor/twig/twig/lib/Twig/ExpressionParser.php
index f685bad..fa9fa35 100644
--- a/core/vendor/twig/twig/lib/Twig/ExpressionParser.php
+++ b/core/vendor/twig/twig/lib/Twig/ExpressionParser.php
@@ -164,6 +164,21 @@ public function parsePrimaryExpression()
$this->parser->getStream()->next();
$node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine());
break;
+ } elseif (isset($this->unaryOperators[$token->getValue()])) {
+ $class = $this->unaryOperators[$token->getValue()]['class'];
+
+ $ref = new ReflectionClass($class);
+ $negClass = 'Twig_Node_Expression_Unary_Neg';
+ $posClass = 'Twig_Node_Expression_Unary_Pos';
+ if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) {
+ throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s"', $token->getValue()), $token->getLine(), $this->parser->getFilename());
+ }
+
+ $this->parser->getStream()->next();
+ $expr = $this->parsePrimaryExpression();
+
+ $node = new $class($expr, $token->getLine());
+ break;
}
default:
@@ -451,8 +466,8 @@ public function parseFilterExpressionRaw($node, $tag = null)
/**
* Parses arguments.
*
- * @param bool $namedArguments Whether to allow named arguments or not
- * @param bool $definition Whether we are parsing arguments for a function definition
+ * @param bool $namedArguments Whether to allow named arguments or not
+ * @param bool $definition Whether we are parsing arguments for a function definition
*/
public function parseArguments($namedArguments = false, $definition = false)
{
@@ -583,7 +598,9 @@ protected function getFilterNodeClass($name, $line)
// checks that the node only contains "constant" elements
protected function checkConstantExpression(Twig_NodeInterface $node)
{
- if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array)) {
+ if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array
+ || $node instanceof Twig_Node_Expression_Unary_Neg || $node instanceof Twig_Node_Expression_Unary_Pos
+ )) {
return false;
}
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Core.php b/core/vendor/twig/twig/lib/Twig/Extension/Core.php
index e71d741..4dbee87 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/Core.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Core.php
@@ -95,9 +95,9 @@ public function getTimezone()
/**
* Sets the default format to be used by the number_format filter.
*
- * @param int $decimal The number of decimal places to use.
- * @param string $decimalPoint The character(s) to use for the decimal point.
- * @param string $thousandSep The character(s) to use for the thousands separator.
+ * @param int $decimal The number of decimal places to use.
+ * @param string $decimalPoint The character(s) to use for the decimal point.
+ * @param string $thousandSep The character(s) to use for the thousands separator.
*/
public function setNumberFormat($decimal, $decimalPoint, $thousandSep)
{
@@ -621,8 +621,8 @@ function twig_urlencode_filter($url)
/**
* JSON encodes a variable.
*
- * @param mixed $value The value to encode.
- * @param int $options Not used on PHP 5.2.x
+ * @param mixed $value The value to encode.
+ * @param int $options Not used on PHP 5.2.x
*
* @return mixed The JSON encoded value
*/
@@ -640,8 +640,8 @@ function twig_jsonencode_filter($value, $options = 0)
/**
* JSON encodes a variable.
*
- * @param mixed $value The value to encode.
- * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT
+ * @param mixed $value The value to encode.
+ * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT
*
* @return mixed The JSON encoded value
*/
@@ -708,7 +708,11 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
}
if ($start >= 0 && $length >= 0) {
- return iterator_to_array(new LimitIterator($item, $start, $length === null ? -1 : $length), $preserveKeys);
+ try {
+ return iterator_to_array(new LimitIterator($item, $start, $length === null ? -1 : $length), $preserveKeys);
+ } catch (OutOfBoundsException $exception) {
+ return array();
+ }
}
$item = iterator_to_array($item, $preserveKeys);
@@ -930,15 +934,11 @@ function twig_sort_filter($array)
function twig_in_filter($value, $compare)
{
if (is_array($compare)) {
- return in_array($value, $compare, is_object($value));
- } elseif (is_string($compare)) {
- if (!strlen($value)) {
- return empty($compare);
- }
-
- return false !== strpos($compare, (string) $value);
+ return in_array($value, $compare, is_object($value) || is_resource($value));
+ } elseif (is_string($compare) && (is_string($value) || is_int($value) || is_float($value))) {
+ return '' === $value || false !== strpos($compare, (string) $value);
} elseif ($compare instanceof Traversable) {
- return in_array($value, iterator_to_array($compare, false), is_object($value));
+ return in_array($value, iterator_to_array($compare, false), is_object($value) || is_resource($value));
}
return false;
@@ -1216,7 +1216,6 @@ function _twig_escape_html_attr_callback($matches)
* Per OWASP recommendations, we'll use hex entities for any other
* characters where a named entity does not exist.
*/
-
return sprintf('%s;', $hex);
}
@@ -1228,7 +1227,7 @@ function _twig_escape_html_attr_callback($matches)
* @param Twig_Environment $env A Twig_Environment instance
* @param mixed $thing A variable
*
- * @return int The length of the value
+ * @return int The length of the value
*/
function twig_length_filter(Twig_Environment $env, $thing)
{
@@ -1312,7 +1311,7 @@ function twig_capitalize_string_filter(Twig_Environment $env, $string)
* @param Twig_Environment $env A Twig_Environment instance
* @param mixed $thing A variable
*
- * @return int The length of the value
+ * @return int The length of the value
*/
function twig_length_filter(Twig_Environment $env, $thing)
{
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
index d3e5ad0..0edf563 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php
@@ -64,6 +64,10 @@ public function setDefaultStrategy($defaultStrategy)
$defaultStrategy = 'html';
}
+ if ('filename' === $defaultStrategy) {
+ $defaultStrategy = array('Twig_FileExtensionEscapingStrategy', 'guess');
+ }
+
$this->defaultStrategy = $defaultStrategy;
}
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/Profiler.php b/core/vendor/twig/twig/lib/Twig/Extension/Profiler.php
new file mode 100644
index 0000000..35e04a0
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Extension/Profiler.php
@@ -0,0 +1,52 @@
+actives = array($profile);
+ }
+
+ public function enter(Twig_Profiler_Profile $profile)
+ {
+ $this->actives[0]->addProfile($profile);
+ array_unshift($this->actives, $profile);
+ }
+
+ public function leave(Twig_Profiler_Profile $profile)
+ {
+ $profile->leave();
+ array_shift($this->actives);
+
+ if (1 === count($this->actives)) {
+ $this->actives[0]->leave();
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getNodeVisitors()
+ {
+ return array(new Twig_Profiler_NodeVisitor_Profiler($this->getName()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName()
+ {
+ return 'profiler';
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Extension/StringLoader.php b/core/vendor/twig/twig/lib/Twig/Extension/StringLoader.php
index 5e1a60d..4e1a546 100644
--- a/core/vendor/twig/twig/lib/Twig/Extension/StringLoader.php
+++ b/core/vendor/twig/twig/lib/Twig/Extension/StringLoader.php
@@ -43,22 +43,5 @@ public function getName()
*/
function twig_template_from_string(Twig_Environment $env, $template)
{
- $name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false));
-
- $loader = new Twig_Loader_Chain(array(
- new Twig_Loader_Array(array($name => $template)),
- $current = $env->getLoader(),
- ));
-
- $env->setLoader($loader);
- try {
- $template = $env->loadTemplate($name);
- } catch (Exception $e) {
- $env->setLoader($current);
-
- throw $e;
- }
- $env->setLoader($current);
-
- return $template;
+ return $env->createTemplate($template);
}
diff --git a/core/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php b/core/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php
new file mode 100644
index 0000000..b1ace7d
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php
@@ -0,0 +1,49 @@
+
+ */
+class Twig_FileExtensionEscapingStrategy
+{
+ /**
+ * Guesses the best autoescaping strategy based on the file name.
+ *
+ * @param string $filename The template file name
+ *
+ * @return string The escaping strategy name to use
+ */
+ public static function guess($filename)
+ {
+ if (!preg_match('{\.(js|css|txt)(?:\.[^/\\\\]+)?$}', $filename, $match)) {
+ return 'html';
+ }
+
+ switch ($match[1]) {
+ case 'js':
+ return 'js';
+
+ case 'css':
+ return 'css';
+
+ case 'txt':
+ return false;
+ }
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Lexer.php b/core/vendor/twig/twig/lib/Twig/Lexer.php
index ad3ec7d..19380b5 100644
--- a/core/vendor/twig/twig/lib/Twig/Lexer.php
+++ b/core/vendor/twig/twig/lib/Twig/Lexer.php
@@ -317,11 +317,9 @@ protected function lexString()
$this->pushToken(Twig_Token::INTERPOLATION_START_TYPE);
$this->moveCursor($match[0]);
$this->pushState(self::STATE_INTERPOLATION);
-
} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) {
$this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0]));
$this->moveCursor($match[0]);
-
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
list($expect, $lineno) = array_pop($this->brackets);
if ($this->code[$this->cursor] != '"') {
diff --git a/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php b/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
index d0ae1cc..329a23f 100644
--- a/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
+++ b/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
@@ -183,6 +183,9 @@ protected function findTemplate($name)
}
foreach ($this->paths[$namespace] as $path) {
+ if (false !== $realpath = realpath($path.'/'.$shortname)) {
+ return $this->cache[$name] = $realpath;
+ }
if (is_file($path.'/'.$shortname)) {
return $this->cache[$name] = $path.'/'.$shortname;
}
diff --git a/core/vendor/twig/twig/lib/Twig/LoaderInterface.php b/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
index 4405291..b87058e 100644
--- a/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/LoaderInterface.php
@@ -44,7 +44,7 @@ public function getCacheKey($name);
* @param string $name The template name
* @param timestamp $time The last modification time of the cached template
*
- * @return bool true if the template is fresh, false otherwise
+ * @return bool true if the template is fresh, false otherwise
*
* @throws Twig_Error_Loader When $name is not found
*/
diff --git a/core/vendor/twig/twig/lib/Twig/Node.php b/core/vendor/twig/twig/lib/Twig/Node.php
index 20af544..515d81b 100644
--- a/core/vendor/twig/twig/lib/Twig/Node.php
+++ b/core/vendor/twig/twig/lib/Twig/Node.php
@@ -28,10 +28,10 @@ class Twig_Node implements Twig_NodeInterface
* The nodes are automatically made available as properties ($this->node).
* The attributes are automatically made available as array items ($this['name']).
*
- * @param array $nodes An array of named nodes
- * @param array $attributes An array of attributes (should not be nodes)
- * @param int $lineno The line number
- * @param string $tag The tag name associated with the Node
+ * @param array $nodes An array of named nodes
+ * @param array $attributes An array of attributes (should not be nodes)
+ * @param int $lineno The line number
+ * @param string $tag The tag name associated with the Node
*/
public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
{
@@ -124,7 +124,7 @@ public function getNodeTag()
*
* @param string The attribute name
*
- * @return bool true if the attribute is defined, false otherwise
+ * @return bool true if the attribute is defined, false otherwise
*/
public function hasAttribute($name)
{
@@ -173,7 +173,7 @@ public function removeAttribute($name)
*
* @param string The node name
*
- * @return bool true if the node with the given name exists, false otherwise
+ * @return bool true if the node with the given name exists, false otherwise
*/
public function hasNode($name)
{
diff --git a/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php b/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php
new file mode 100644
index 0000000..3040b76
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php
@@ -0,0 +1,78 @@
+
+ */
+class Twig_Node_CheckSecurity extends Twig_Node
+{
+ protected $usedFilters;
+ protected $usedTags;
+ protected $usedFunctions;
+
+ public function __construct(array $usedFilters, array $usedTags, array $usedFunctions)
+ {
+ $this->usedFilters = $usedFilters;
+ $this->usedTags = $usedTags;
+ $this->usedFunctions = $usedFunctions;
+
+ parent::__construct();
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $tags = $filters = $functions = array();
+ foreach (array('tags', 'filters', 'functions') as $type) {
+ foreach ($this->{'used'.ucfirst($type)} as $name => $node) {
+ if ($node instanceof Twig_Node) {
+ ${$type}[$name] = $node->getLine();
+ } else {
+ ${$type}[$node] = null;
+ }
+ }
+ }
+
+ $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("try {\n")
+ ->indent()
+ ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n")
+ ->indent()
+ ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n")
+ ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n")
+ ->write(!$functions ? "array()\n" : "array('".implode("', '", array_keys($functions))."')\n")
+ ->outdent()
+ ->write(");\n")
+ ->outdent()
+ ->write("} catch (Twig_Sandbox_SecurityError \$e) {\n")
+ ->indent()
+ ->write("\$e->setTemplateFile(\$this->getTemplateName());\n\n")
+ ->write("if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")
+ ->indent()
+ ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")
+ ->outdent()
+ ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")
+ ->indent()
+ ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")
+ ->outdent()
+ ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")
+ ->indent()
+ ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")
+ ->outdent()
+ ->write("}\n\n")
+ ->write("throw \$e;\n")
+ ->outdent()
+ ->write("}\n\n")
+ ;
+ }
+}
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 912b837..d09e06f 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Call.php
@@ -90,6 +90,9 @@ protected function compileArguments(Twig_Compiler $compiler)
protected function getArguments($callable, $arguments)
{
+ $callType = $this->getAttribute('type');
+ $callName = $this->getAttribute('name');
+
$parameters = array();
$named = false;
foreach ($arguments as $name => $node) {
@@ -97,7 +100,7 @@ protected function getArguments($callable, $arguments)
$named = true;
$name = $this->normalizeName($name);
} elseif ($named) {
- throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name')));
+ throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName));
}
$parameters[$name] = $node;
@@ -108,7 +111,7 @@ protected function getArguments($callable, $arguments)
}
if (!$callable) {
- throw new LogicException(sprintf('Named arguments are not supported for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name')));
+ throw new LogicException(sprintf('Named arguments are not supported for %s "%s".', $callType, $callName));
}
// manage named arguments
@@ -138,32 +141,61 @@ protected function getArguments($callable, $arguments)
}
$arguments = array();
+ $names = array();
+ $missingArguments = array();
+ $optionalArguments = array();
$pos = 0;
foreach ($definition as $param) {
- $name = $this->normalizeName($param->name);
+ $names[] = $name = $this->normalizeName($param->name);
if (array_key_exists($name, $parameters)) {
if (array_key_exists($pos, $parameters)) {
- throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
+ throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
+ }
+
+ if (!empty($missingArguments)) {
+ throw new Twig_Error_Syntax(sprintf(
+ 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
+ $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
+ );
}
+ $arguments = array_merge($arguments, $optionalArguments);
$arguments[] = $parameters[$name];
unset($parameters[$name]);
+ $optionalArguments = array();
} elseif (array_key_exists($pos, $parameters)) {
+ $arguments = array_merge($arguments, $optionalArguments);
$arguments[] = $parameters[$pos];
unset($parameters[$pos]);
+ $optionalArguments = array();
++$pos;
} elseif ($param->isDefaultValueAvailable()) {
- $arguments[] = new Twig_Node_Expression_Constant($param->getDefaultValue(), -1);
+ $optionalArguments[] = new Twig_Node_Expression_Constant($param->getDefaultValue(), -1);
} elseif ($param->isOptional()) {
- break;
+ if (empty($parameters)) {
+ break;
+ } else {
+ $missingArguments[] = $name;
+ }
} else {
- throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
+ throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName));
}
}
if (!empty($parameters)) {
- throw new Twig_Error_Syntax(sprintf('Unknown argument%s "%s" for %s "%s".', count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $this->getAttribute('type'), $this->getAttribute('name')));
+ $unknownParameter = null;
+ foreach ($parameters as $parameter) {
+ if ($parameter instanceof Twig_Node) {
+ $unknownParameter = $parameter;
+ break;
+ }
+ }
+
+ throw new Twig_Error_Syntax(sprintf(
+ 'Unknown argument%s "%s" for %s "%s(%s)".',
+ count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names)
+ ), $unknownParameter ? $unknownParameter->getLine() : -1);
}
return $arguments;
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 3b8fae0..4cbdea9 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php
@@ -26,6 +26,8 @@ public function compile(Twig_Compiler $compiler)
{
$name = $this->getAttribute('name');
+ $compiler->addDebugInfo($this);
+
if ($this->getAttribute('is_defined_test')) {
if ($this->isSpecial()) {
$compiler->repr(true);
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php
index c514388..1cf54c3 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php
@@ -18,12 +18,9 @@ public function __construct(Twig_NodeInterface $node, $lineno)
public function compile(Twig_Compiler $compiler)
{
- $compiler->raw('(');
+ $compiler->raw(' ');
$this->operator($compiler);
- $compiler
- ->subcompile($this->getNode('node'))
- ->raw(')')
- ;
+ $compiler->subcompile($this->getNode('node'));
}
abstract public function operator(Twig_Compiler $compiler);
diff --git a/core/vendor/twig/twig/lib/Twig/Node/Module.php b/core/vendor/twig/twig/lib/Twig/Node/Module.php
index 9f66b28..c156e29 100644
--- a/core/vendor/twig/twig/lib/Twig/Node/Module.php
+++ b/core/vendor/twig/twig/lib/Twig/Node/Module.php
@@ -13,6 +13,10 @@
/**
* Represents a module node.
*
+ * Consider this class as being final. If you need to customize the behavior of
+ * the generated class, consider adding nodes to the following nodes: display_start,
+ * display_end, constructor_start, constructor_end, and class_end.
+ *
* @author Fabien Potencier
*/
class Twig_Node_Module extends Twig_Node
@@ -20,7 +24,22 @@ class Twig_Node_Module extends Twig_Node
public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $filename)
{
// embedded templates are set as attributes so that they are only visited once by the visitors
- parent::__construct(array('parent' => $parent, 'body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits), array('filename' => $filename, 'index' => null, 'embedded_templates' => $embeddedTemplates), 1);
+ parent::__construct(array(
+ 'parent' => $parent,
+ 'body' => $body,
+ 'blocks' => $blocks,
+ 'macros' => $macros,
+ 'traits' => $traits,
+ 'display_start' => new Twig_Node(),
+ 'display_end' => new Twig_Node(),
+ 'constructor_start' => new Twig_Node(),
+ 'constructor_end' => new Twig_Node(),
+ 'class_end' => new Twig_Node(),
+ ), array(
+ 'filename' => $filename,
+ 'index' => null,
+ 'embedded_templates' => $embeddedTemplates,
+ ), 1);
}
public function setIndex($index)
@@ -50,17 +69,20 @@ protected function compileTemplate(Twig_Compiler $compiler)
$this->compileClassHeader($compiler);
- if (count($this->getNode('blocks')) || count($this->getNode('traits')) || null === $this->getNode('parent') || $this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
+ if (
+ count($this->getNode('blocks'))
+ || count($this->getNode('traits'))
+ || null === $this->getNode('parent')
+ || $this->getNode('parent') instanceof Twig_Node_Expression_Constant
+ || count($this->getNode('constructor_start'))
+ || count($this->getNode('constructor_end'))
+ ) {
$this->compileConstructor($compiler);
}
$this->compileGetParent($compiler);
- $this->compileDisplayHeader($compiler);
-
- $this->compileDisplayBody($compiler);
-
- $this->compileDisplayFooter($compiler);
+ $this->compileDisplay($compiler);
$compiler->subcompile($this->getNode('blocks'));
@@ -77,22 +99,23 @@ protected function compileTemplate(Twig_Compiler $compiler)
protected function compileGetParent(Twig_Compiler $compiler)
{
- if (null === $this->getNode('parent')) {
+ if (null === $parent = $this->getNode('parent')) {
return;
}
$compiler
->write("protected function doGetParent(array \$context)\n", "{\n")
->indent()
+ ->addDebugInfo($parent)
->write("return ")
;
- if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
- $compiler->subcompile($this->getNode('parent'));
+ if ($parent instanceof Twig_Node_Expression_Constant) {
+ $compiler->subcompile($parent);
} else {
$compiler
->raw("\$this->env->resolveTemplate(")
- ->subcompile($this->getNode('parent'))
+ ->subcompile($parent)
->raw(")")
;
}
@@ -104,20 +127,6 @@ protected function compileGetParent(Twig_Compiler $compiler)
;
}
- protected function compileDisplayBody(Twig_Compiler $compiler)
- {
- $compiler->subcompile($this->getNode('body'));
-
- if (null !== $this->getNode('parent')) {
- if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
- $compiler->write("\$this->parent");
- } else {
- $compiler->write("\$this->getParent(\$context)");
- }
- $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n");
- }
- }
-
protected function compileClassHeader(Twig_Compiler $compiler)
{
$compiler
@@ -136,17 +145,29 @@ protected function compileConstructor(Twig_Compiler $compiler)
$compiler
->write("public function __construct(Twig_Environment \$env)\n", "{\n")
->indent()
+ ->subcompile($this->getNode('constructor_start'))
->write("parent::__construct(\$env);\n\n")
;
// parent
- if (null === $this->getNode('parent')) {
+ if (null === $parent = $this->getNode('parent')) {
$compiler->write("\$this->parent = false;\n\n");
- } elseif ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
+ } elseif ($parent instanceof Twig_Node_Expression_Constant) {
$compiler
+ ->addDebugInfo($parent)
+ ->write("try {\n")
+ ->indent()
->write("\$this->parent = \$this->env->loadTemplate(")
- ->subcompile($this->getNode('parent'))
- ->raw(");\n\n")
+ ->subcompile($parent)
+ ->raw(");\n")
+ ->outdent()
+ ->write("} catch (Twig_Error_Loader \$e) {\n")
+ ->indent()
+ ->write("\$e->setTemplateFile(\$this->getTemplateName());\n")
+ ->write(sprintf("\$e->setTemplateLine(%d);\n\n", $parent->getLine()))
+ ->write("throw \$e;\n")
+ ->outdent()
+ ->write("}\n\n")
;
}
@@ -249,21 +270,32 @@ protected function compileConstructor(Twig_Compiler $compiler)
->outdent()
->write(");\n")
->outdent()
- ->write("}\n\n");
+ ->subcompile($this->getNode('constructor_end'))
+ ->write("}\n\n")
;
}
- protected function compileDisplayHeader(Twig_Compiler $compiler)
+ protected function compileDisplay(Twig_Compiler $compiler)
{
$compiler
->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
->indent()
+ ->subcompile($this->getNode('display_start'))
+ ->subcompile($this->getNode('body'))
;
- }
- protected function compileDisplayFooter(Twig_Compiler $compiler)
- {
+ if (null !== $parent = $this->getNode('parent')) {
+ $compiler->addDebugInfo($parent);
+ if ($parent instanceof Twig_Node_Expression_Constant) {
+ $compiler->write("\$this->parent");
+ } else {
+ $compiler->write("\$this->getParent(\$context)");
+ }
+ $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n");
+ }
+
$compiler
+ ->subcompile($this->getNode('display_end'))
->outdent()
->write("}\n\n")
;
@@ -272,6 +304,7 @@ protected function compileDisplayFooter(Twig_Compiler $compiler)
protected function compileClassFooter(Twig_Compiler $compiler)
{
$compiler
+ ->subcompile($this->getNode('class_end'))
->outdent()
->write("}\n")
;
diff --git a/core/vendor/twig/twig/lib/Twig/Node/SandboxedModule.php b/core/vendor/twig/twig/lib/Twig/Node/SandboxedModule.php
deleted file mode 100644
index 410332c..0000000
--- a/core/vendor/twig/twig/lib/Twig/Node/SandboxedModule.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- */
-class Twig_Node_SandboxedModule extends Twig_Node_Module
-{
- protected $usedFilters;
- protected $usedTags;
- protected $usedFunctions;
-
- public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions)
- {
- parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('embedded_templates'), $node->getAttribute('filename'));
-
- $this->setAttribute('index', $node->getAttribute('index'));
-
- $this->usedFilters = $usedFilters;
- $this->usedTags = $usedTags;
- $this->usedFunctions = $usedFunctions;
- }
-
- protected function compileDisplayBody(Twig_Compiler $compiler)
- {
- $compiler->write("\$this->checkSecurity();\n");
-
- parent::compileDisplayBody($compiler);
- }
-
- protected function compileDisplayFooter(Twig_Compiler $compiler)
- {
- parent::compileDisplayFooter($compiler);
-
- $tags = $filters = $functions = array();
- foreach (array('tags', 'filters', 'functions') as $type) {
- foreach ($this->{'used'.ucfirst($type)} as $name => $node) {
- if ($node instanceof Twig_Node) {
- ${$type}[$name] = $node->getLine();
- } else {
- ${$type}[$node] = null;
- }
- }
- }
-
- $compiler
- ->write("protected function checkSecurity()\n", "{\n")
- ->indent()
- ->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")
- ->indent()
- ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n")
- ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n")
- ->write(!$functions ? "array()\n" : "array('".implode("', '", array_keys($functions))."')\n")
- ->outdent()
- ->write(");\n")
- ->outdent()
- ->write("} catch (Twig_Sandbox_SecurityError \$e) {\n")
- ->indent()
- ->write("\$e->setTemplateFile(\$this->getTemplateName());\n\n")
- ->write("if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")
- ->indent()
- ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")
- ->outdent()
- ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")
- ->indent()
- ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")
- ->outdent()
- ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")
- ->indent()
- ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")
- ->outdent()
- ->write("}\n\n")
- ->write("throw \$e;\n")
- ->outdent()
- ->write("}\n")
- ->outdent()
- ->write("}\n\n")
- ;
- }
-}
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
index 3cc3312..6b4233b 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
@@ -36,7 +36,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface
/**
* Constructor.
*
- * @param int $optimizers The optimizer mode
+ * @param int $optimizers The optimizer mode
*/
public function __construct($optimizers = -1)
{
@@ -205,6 +205,16 @@ protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $
$this->addLoopToAll();
}
+ // include function without the with_context=false parameter
+ elseif ($node instanceof Twig_Node_Expression_Function
+ && 'include' === $node->getAttribute('name')
+ && (!$node->getNode('arguments')->hasNode('with_context')
+ || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value')
+ )
+ ) {
+ $this->addLoopToAll();
+ }
+
// the loop variable is referenced via an attribute
elseif ($node instanceof Twig_Node_Expression_GetAttr
&& (!$node->getNode('attribute') instanceof Twig_Node_Expression_Constant
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php
index e5e3ff6..5467f81 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php
@@ -76,7 +76,7 @@ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
if ($node instanceof Twig_Node_Module) {
$this->inAModule = false;
- return new Twig_Node_SandboxedModule($node, $this->filters, $this->tags, $this->functions);
+ $node->setNode('display_start', new Twig_Node(array(new Twig_Node_CheckSecurity($this->filters, $this->tags, $this->functions), $node->getNode('display_start'))));
}
return $node;
diff --git a/core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php b/core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php
index 608aded..f276163 100644
--- a/core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php
+++ b/core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php
@@ -41,7 +41,7 @@ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
*
* Priority should be between -10 and 10 (0 is the default).
*
- * @return int The priority level
+ * @return int The priority level
*/
public function getPriority();
}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php
new file mode 100644
index 0000000..b82747a
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php
@@ -0,0 +1,68 @@
+
+ */
+class Twig_Profiler_Dumper_Blackfire
+{
+ public function dump(Twig_Profiler_Profile $profile)
+ {
+ $data = array();
+ $this->dumpProfile('main()', $profile, $data);
+ $this->dumpChildren('main()', $profile, $data);
+
+ $start = microtime(true);
+ $str = << $values) {
+ $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n";
+ }
+
+ return $str;
+ }
+
+ private function dumpChildren($parent, Twig_Profiler_Profile $profile, &$data)
+ {
+ foreach ($profile as $p) {
+ if ($p->isTemplate()) {
+ $name = $p->getTemplate();
+ } else {
+ $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName());
+ }
+ $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data);
+ $this->dumpChildren($name, $p, $data);
+ }
+ }
+
+ private function dumpProfile($edge, Twig_Profiler_Profile $profile, &$data)
+ {
+ if (isset($data[$edge])) {
+ $data[$edge]['ct'] += 1;
+ $data[$edge]['wt'] += floor($profile->getDuration() * 1000000);
+ $data[$edge]['mu'] += $profile->getMemoryUsage();
+ $data[$edge]['pmu'] += $profile->getPeakMemoryUsage();
+ } else {
+ $data[$edge] = array(
+ 'ct' => 1,
+ 'wt' => floor($profile->getDuration() * 1000000),
+ 'mu' => $profile->getMemoryUsage(),
+ 'pmu' => $profile->getPeakMemoryUsage(),
+ );
+ }
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php
new file mode 100644
index 0000000..c898520
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php
@@ -0,0 +1,43 @@
+
+ */
+class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text
+{
+ static private $colors = array(
+ 'block' => '#dfd',
+ 'macro' => '#ddf',
+ 'template' => '#ffd',
+ 'big' => '#d44',
+ );
+
+ public function dump(Twig_Profiler_Profile $profile)
+ {
+ return ''.parent::dump($profile).'
';
+ }
+
+ protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix)
+ {
+ return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate());
+ }
+
+ protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
+ {
+ return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName());
+ }
+
+ protected function formatTime(Twig_Profiler_Profile $profile, $percent)
+ {
+ return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent);
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php
new file mode 100644
index 0000000..998e210
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php
@@ -0,0 +1,68 @@
+
+ */
+class Twig_Profiler_Dumper_Text
+{
+ private $root;
+
+ public function dump(Twig_Profiler_Profile $profile)
+ {
+ return $this->dumpProfile($profile);
+ }
+
+ protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix)
+ {
+ return sprintf('%s└ %s', $prefix, $profile->getTemplate());
+ }
+
+ protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
+ {
+ return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
+ }
+
+ protected function formatTime(Twig_Profiler_Profile $profile, $percent)
+ {
+ return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
+ }
+
+ private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false)
+ {
+ if ($profile->isRoot()) {
+ $this->root = $profile->getDuration();
+ $start = $profile->getName();
+ } else {
+ if ($profile->isTemplate()) {
+ $start = $this->formatTemplate($profile, $prefix);
+ } else {
+ $start = $this->formatNonTemplate($profile, $prefix);
+ }
+ $prefix .= $sibling ? '│ ' : ' ';
+ }
+
+ $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0;
+
+ if ($profile->getDuration() * 1000 < 1) {
+ $str = $start."\n";
+ } else {
+ $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent));
+ }
+
+ $nCount = count($profile->getProfiles());
+ foreach ($profile as $i => $p) {
+ $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount);
+ }
+
+ return $str;
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php b/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php
new file mode 100644
index 0000000..11c1114
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php
@@ -0,0 +1,40 @@
+
+ */
+class Twig_Profiler_Node_EnterProfile extends Twig_Node
+{
+ public function __construct($extensionName, $type, $name, $varName)
+ {
+ parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->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'))
+ ->repr($this->getAttribute('type'))
+ ->raw(", ")
+ ->repr($this->getAttribute('name'))
+ ->raw("));\n\n")
+ ;
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/core/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php
new file mode 100644
index 0000000..88074c2
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php
@@ -0,0 +1,34 @@
+
+ */
+class Twig_Profiler_Node_LeaveProfile extends Twig_Node
+{
+ public function __construct($varName)
+ {
+ parent::__construct(array(), array('var_name' => $varName));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->write("\n")
+ ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof'))
+ ;
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
new file mode 100644
index 0000000..58beb0a
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
@@ -0,0 +1,72 @@
+
+ */
+class Twig_Profiler_NodeVisitor_Profiler implements Twig_NodeVisitorInterface
+{
+ private $extensionName;
+
+ public function __construct($extensionName)
+ {
+ $this->extensionName = $extensionName;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
+ {
+ return $node;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
+ {
+ if ($node instanceof Twig_Node_Module) {
+ $varName = $this->getVarName();
+ $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getAttribute('filename'), $varName), $node->getNode('display_start'))));
+ $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end'))));
+ } elseif ($node instanceof Twig_Node_Block) {
+ $varName = $this->getVarName();
+ $node->setNode('body', new Twig_Node_Body(array(
+ new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName),
+ $node->getNode('body'),
+ new Twig_Profiler_Node_LeaveProfile($varName),
+ )));
+ } elseif ($node instanceof Twig_Node_Macro) {
+ $varName = $this->getVarName();
+ $node->setNode('body', new Twig_Node_Body(array(
+ new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName),
+ $node->getNode('body'),
+ new Twig_Profiler_Node_LeaveProfile($varName),
+ )));
+ }
+
+ return $node;
+ }
+
+ private function getVarName()
+ {
+ return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPriority()
+ {
+ return 0;
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php b/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php
new file mode 100644
index 0000000..fe48a4d
--- /dev/null
+++ b/core/vendor/twig/twig/lib/Twig/Profiler/Profile.php
@@ -0,0 +1,150 @@
+
+ */
+class Twig_Profiler_Profile implements IteratorAggregate, Serializable
+{
+ const ROOT = 'ROOT';
+ const BLOCK = 'block';
+ const TEMPLATE = 'template';
+ const MACRO = 'macro';
+
+ private $template;
+ private $name;
+ private $type;
+ private $starts = array();
+ private $ends = array();
+ private $profiles = array();
+
+ public function __construct($template = 'main', $type = Twig_Profiler_Profile::ROOT, $name = 'main')
+ {
+ $this->template = $template;
+ $this->type = $type;
+ $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name;
+ $this->enter();
+ }
+
+ public function getTemplate()
+ {
+ return $this->template;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ public function isRoot()
+ {
+ return self::ROOT === $this->type;
+ }
+
+ public function isTemplate()
+ {
+ return self::TEMPLATE === $this->type;
+ }
+
+ public function isBlock()
+ {
+ return self::BLOCK === $this->type;
+ }
+
+ public function isMacro()
+ {
+ return self::MACRO === $this->type;
+ }
+
+ public function getProfiles()
+ {
+ return $this->profiles;
+ }
+
+ public function addProfile(Twig_Profiler_Profile $profile)
+ {
+ $this->profiles[] = $profile;
+ }
+
+ /**
+ * Returns the duration in microseconds.
+ *
+ * @return int
+ */
+ public function getDuration()
+ {
+ return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0;
+ }
+
+ /**
+ * Returns the memory usage in bytes.
+ *
+ * @return int
+ */
+ public function getMemoryUsage()
+ {
+ return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0;
+ }
+
+ /**
+ * Returns the peak memory usage in bytes.
+ *
+ * @return int
+ */
+ public function getPeakMemoryUsage()
+ {
+ return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0;
+ }
+
+ /**
+ * Starts the profiling.
+ */
+ public function enter()
+ {
+ $this->starts = array(
+ 'wt' => microtime(true),
+ 'mu' => memory_get_usage(),
+ 'pmu' => memory_get_peak_usage(),
+ );
+ }
+
+ /**
+ * Stops the profiling.
+ */
+ public function leave()
+ {
+ $this->ends = array(
+ 'wt' => microtime(true),
+ 'mu' => memory_get_usage(),
+ 'pmu' => memory_get_peak_usage(),
+ );
+ }
+
+ public function getIterator()
+ {
+ return new ArrayIterator($this->profiles);
+ }
+
+ public function serialize()
+ {
+ return serialize(array($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles));
+ }
+
+ public function unserialize($data)
+ {
+ list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data);
+ }
+}
diff --git a/core/vendor/twig/twig/lib/Twig/Template.php b/core/vendor/twig/twig/lib/Twig/Template.php
index 63910da..70d19e7 100644
--- a/core/vendor/twig/twig/lib/Twig/Template.php
+++ b/core/vendor/twig/twig/lib/Twig/Template.php
@@ -20,7 +20,7 @@
protected static $cache = array();
protected $parent;
- protected $parents;
+ protected $parents = array();
protected $env;
protected $blocks;
protected $traits;
@@ -66,15 +66,25 @@ public function getParent(array $context)
return $this->parent;
}
- $parent = $this->doGetParent($context);
- if (false === $parent) {
- return false;
- } elseif ($parent instanceof Twig_Template) {
- $name = $parent->getTemplateName();
- $this->parents[$name] = $parent;
- $parent = $name;
- } elseif (!isset($this->parents[$parent])) {
- $this->parents[$parent] = $this->env->loadTemplate($parent);
+ try {
+ $parent = $this->doGetParent($context);
+
+ if (false === $parent) {
+ return false;
+ }
+
+ if ($parent instanceof Twig_Template) {
+ return $this->parents[$parent->getTemplateName()] = $parent;
+ }
+
+ if (!isset($this->parents[$parent])) {
+ $this->parents[$parent] = $this->env->loadTemplate($parent);
+ }
+ } catch (Twig_Error_Loader $e) {
+ $e->setTemplateFile(null);
+ $e->guess();
+
+ throw $e;
}
return $this->parents[$parent];
@@ -119,10 +129,10 @@ public function displayParentBlock($name, array $context, array $blocks = array(
* This method is for internal use only and should never be called
* directly.
*
- * @param string $name The block name to display
- * @param array $context The context
- * @param array $blocks The current set of blocks
- * @param bool $useBlocks Whether to use the current set of blocks
+ * @param string $name The block name to display
+ * @param array $context The context
+ * @param array $blocks The current set of blocks
+ * @param bool $useBlocks Whether to use the current set of blocks
*/
public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true)
{
@@ -178,10 +188,10 @@ public function renderParentBlock($name, array $context, array $blocks = array()
* This method is for internal use only and should never be called
* directly.
*
- * @param string $name The block name to render
- * @param array $context The context
- * @param array $blocks The current set of blocks
- * @param bool $useBlocks Whether to use the current set of blocks
+ * @param string $name The block name to render
+ * @param array $context The context
+ * @param array $blocks The current set of blocks
+ * @param bool $useBlocks Whether to use the current set of blocks
*
* @return string The rendered block
*/
@@ -208,7 +218,7 @@ public function renderBlock($name, array $context, array $blocks = array(), $use
*
* @param string $name The block name
*
- * @return bool true if the block exists, false otherwise
+ * @return bool true if the block exists, false otherwise
*/
public function hasBlock($name)
{
@@ -314,9 +324,9 @@ protected function displayWithErrorHandling(array $context, array $blocks = arra
* access for versions of PHP before 5.4. This is not a way to override
* the way to get a variable value.
*
- * @param array $context The context
- * @param string $item The variable to return from the context
- * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not
+ * @param array $context The context
+ * @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
*
@@ -338,12 +348,12 @@ protected function displayWithErrorHandling(array $context, array $blocks = arra
/**
* Returns the attribute value for a given array/object.
*
- * @param mixed $object The object or array from where to get the item
- * @param mixed $item The item to get from the array or object
- * @param array $arguments An array of arguments to pass if the item is an object method
- * @param string $type The type of attribute (@see Twig_Template constants)
- * @param bool $isDefinedTest Whether this is only a defined check
- * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
+ * @param mixed $object The object or array from where to get the item
+ * @param mixed $item The item to get from the array or object
+ * @param array $arguments An array of arguments to pass if the item is an object method
+ * @param string $type The type of attribute (@see Twig_Template constants)
+ * @param bool $isDefinedTest Whether this is only a defined check
+ * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
*
* @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
*
@@ -478,12 +488,4 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
return $ret;
}
-
- /**
- * This method is only useful when testing Twig. Do not use it.
- */
- public static function clearCache()
- {
- self::$cache = array();
- }
}
diff --git a/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
index 724f094..b8bceb8 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php
@@ -123,7 +123,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
if (false !== $exception) {
list($class, ) = explode(':', $exception);
- $this->assertThat(NULL, new PHPUnit_Framework_Constraint_Exception($class));
+ $this->assertThat(null, new PHPUnit_Framework_Constraint_Exception($class));
}
$expected = trim($match[3], "\n ");
diff --git a/core/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php b/core/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php
index b15c85f..9eb4461 100644
--- a/core/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php
+++ b/core/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php
@@ -38,13 +38,15 @@ protected function getEnvironment()
return new Twig_Environment();
}
- protected function getVariableGetter($name)
+ protected function getVariableGetter($name, $line = false)
{
+ $line = $line > 0 ? "// line {$line}\n" : '';
+
if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
- return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
+ return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
}
- return sprintf('$this->getContext($context, "%s")', $name);
+ return sprintf('%s$this->getContext($context, "%s")', $line, $name);
}
protected function getAttributeGetter()
diff --git a/core/vendor/twig/twig/lib/Twig/Token.php b/core/vendor/twig/twig/lib/Twig/Token.php
index 599f9f5..15dd4eb 100644
--- a/core/vendor/twig/twig/lib/Twig/Token.php
+++ b/core/vendor/twig/twig/lib/Twig/Token.php
@@ -38,9 +38,9 @@ class Twig_Token
/**
* Constructor.
*
- * @param int $type The type of the token
- * @param string $value The token value
- * @param int $lineno The line position in the source
+ * @param int $type The type of the token
+ * @param string $value The token value
+ * @param int $lineno The line position in the source
*/
public function __construct($type, $value, $lineno)
{
@@ -89,7 +89,7 @@ public function test($type, $values = null)
/**
* Gets the line.
*
- * @return int The source line
+ * @return int The source line
*/
public function getLine()
{
@@ -99,7 +99,7 @@ public function getLine()
/**
* Gets the token type.
*
- * @return int The token type
+ * @return int The token type
*/
public function getType()
{
@@ -119,8 +119,8 @@ public function getValue()
/**
* Returns the constant representation (internal) of a given type.
*
- * @param int $type The type as an integer
- * @param bool $short Whether to return a short representation or not
+ * @param int $type The type as an integer
+ * @param bool $short Whether to return a short representation or not
*
* @return string The string representation
*/
@@ -176,7 +176,7 @@ public static function typeToString($type, $short = false)
/**
* Returns the english representation of a given type.
*
- * @param int $type The type as an integer
+ * @param int $type The type as an integer
*
* @return string The string representation
*/
diff --git a/core/vendor/twig/twig/lib/Twig/TokenStream.php b/core/vendor/twig/twig/lib/Twig/TokenStream.php
index 44440da..7e95a4f 100644
--- a/core/vendor/twig/twig/lib/Twig/TokenStream.php
+++ b/core/vendor/twig/twig/lib/Twig/TokenStream.php
@@ -101,7 +101,7 @@ public function expect($type, $value = null, $message = null)
/**
* Looks at the next token.
*
- * @param int $number
+ * @param int $number
*
* @return Twig_Token
*/
diff --git a/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
index 719a6a7..6a78d2b 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php
@@ -112,7 +112,7 @@ public function getErroredTemplates()
{% block content %}
{{ parent() }}
{% endblock %}",
- 'base' => '{% block content %}{{ foo.bar }}{% endblock %}'
+ 'base' => '{% block content %}{{ foo.bar }}{% endblock %}',
),
'base', 1,
),
@@ -127,7 +127,7 @@ public function getErroredTemplates()
{% block foo %}
{{ foo.bar }}
{% endblock %}",
- 'base' => '{% block content %}{% endblock %}'
+ 'base' => '{% block content %}{% endblock %}',
),
'index', 3,
),
diff --git a/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php
index 8ec6537..983849e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php
@@ -32,7 +32,7 @@ public function getFailingTestsForAssignment()
array('{% set 3 = "foo" %}'),
array('{% set 1 + 2 = "foo" %}'),
array('{% set "bar" = "foo" %}'),
- array('{% set %}{% endset %}')
+ array('{% set %}{% endset %}'),
);
}
@@ -190,7 +190,7 @@ public function getTestsForString()
),
new Twig_Node_Expression_Constant(' baz', 1),
1
- )
+ ),
),
array(
diff --git a/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
index 36cdd33..3eaee59 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
@@ -1,5 +1,14 @@
assertEquals($strategy, Twig_FileExtensionEscapingStrategy::guess($filename));
+ }
+
+ public function getGuessData()
+ {
+ return array(
+ // default
+ array('html', 'foo.html'),
+ array('html', 'foo.html.twig'),
+ array('html', 'foo'),
+ array('html', 'foo.bar.twig'),
+ array('html', 'foo.txt/foo'),
+ array('html', 'foo.txt/foo.js/'),
+
+ // css
+ array('css', 'foo.css'),
+ array('css', 'foo.css.twig'),
+ array('css', 'foo.twig.css'),
+
+ // js
+ array('js', 'foo.js'),
+ array('js', 'foo.js.twig'),
+ array('js', 'foo.txt/foo.js'),
+ array('js', 'foo.txt.twig/foo.js'),
+
+ // txt
+ array(false, 'foo.txt'),
+ array(false, 'foo.txt.twig'),
+ );
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test
new file mode 100644
index 0000000..b091ad3
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/filename.test
@@ -0,0 +1,18 @@
+--TEST--
+"filename" autoescape strategy
+--TEMPLATE--
+{{ br -}}
+{{ include('index.html.twig') -}}
+{{ include('index.txt.twig') -}}
+--TEMPLATE(index.html.twig)--
+{{ br -}}
+--TEMPLATE(index.txt.twig)--
+{{ br -}}
+--DATA--
+return array('br' => '
')
+--CONFIG--
+return array('autoescape' => 'filename')
+--EXPECT--
+<br />
+<br />
+
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test
new file mode 100644
index 0000000..ce49165
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test
@@ -0,0 +1,18 @@
+--TEST--
+Exception for multiline array with undefined variable
+--TEMPLATE--
+{% set foo = {
+ foo: 'foo',
+ bar: 'bar',
+
+
+ foobar: foobar,
+
+
+
+ foo2: foo2,
+} %}
+--DATA--
+return array('foobar' => 'foobar')
+--EXCEPTION--
+Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test
new file mode 100644
index 0000000..e3c040f
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test
@@ -0,0 +1,18 @@
+--TEST--
+Exception for multiline array with undefined variable
+--TEMPLATE--
+{% set foo = {
+ foo: 'foo',
+ bar: 'bar',
+
+
+ foobar: foobar,
+
+
+
+ foo2: foo2,
+} %}
+--DATA--
+return array()
+--EXCEPTION--
+Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test
new file mode 100644
index 0000000..d799a39
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test
@@ -0,0 +1,12 @@
+--TEST--
+Exception for multile function with undefined variable
+--TEMPLATE--
+{{ include('foo',
+ with_context=with_context
+) }}
+--TEMPLATE(foo)--
+Foo
+--DATA--
+return array()
+--EXCEPTION--
+Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test
new file mode 100644
index 0000000..64761fc
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test
@@ -0,0 +1,9 @@
+--TEST--
+Exception for multiline function with unknown argument
+--TEMPLATE--
+{{ include('foo',
+ with_context=True,
+ invalid=False
+) }}
+--EXCEPTION--
+Twig_Error_Syntax: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4.
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test
new file mode 100644
index 0000000..096a5db
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test
@@ -0,0 +1,12 @@
+--TEST--
+Exception for multiline tag with undefined variable
+--TEMPLATE--
+{% include 'foo'
+ with vars
+%}
+--TEMPLATE(foo)--
+Foo
+--DATA--
+return array()
+--EXCEPTION--
+Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test
new file mode 100644
index 0000000..c8e7a09
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test
@@ -0,0 +1,8 @@
+--TEST--
+Exception for an undefined parent
+--TEMPLATE--
+{% extends 'foo.html' %}
+
+{% set foo = "foo" %}
+--EXCEPTION--
+Twig_Error_Loader: Template "foo.html" is not defined in "index.twig" at line 2.
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test
new file mode 100644
index 0000000..1853b1b
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test
@@ -0,0 +1,18 @@
+--TEST--
+Twig manages negative numbers correctly
+--TEMPLATE--
+{{ -1 }}
+{{ - 1 }}
+{{ 5 - 1 }}
+{{ 5-1 }}
+{{ 5 + -1 }}
+{{ 5 + - 1 }}
+--DATA--
+return array()
+--EXPECT--
+-1
+-1
+4
+4
+4
+4
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test
new file mode 100644
index 0000000..ad84a9c
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test
@@ -0,0 +1,22 @@
+--TEST--
+Twig manages negative numbers as default parameters
+--TEMPLATE--
+{% import _self as macros %}
+{{ macros.negative_number1() }}
+{{ macros.negative_number2() }}
+{{ macros.negative_number3() }}
+{{ macros.positive_number1() }}
+{{ macros.positive_number2() }}
+{% macro negative_number1(nb=-1) %}{{ nb }}{% endmacro %}
+{% macro negative_number2(nb = --1) %}{{ nb }}{% endmacro %}
+{% macro negative_number3(nb = - 1) %}{{ nb }}{% endmacro %}
+{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %}
+{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %}
+--DATA--
+return array()
+--EXPECT--
+-1
+1
+-1
+1
+1
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
index fb36a4e..c10fe93 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test
@@ -13,6 +13,8 @@
{{ '1234'[1:2] }}
{{ arr|slice(1, 2)|join('') }}
{{ arr[1:2]|join('') }}
+{{ arr[4:1]|join('') }}
+{{ arr[3:2]|join('') }}
{{ [1, 2, 3, 4]|slice(1)|join('') }}
{{ [1, 2, 3, 4][1:]|join('') }}
@@ -38,6 +40,8 @@
23
23
+4
+
234
234
234
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test
new file mode 100644
index 0000000..1d3e639
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test
@@ -0,0 +1,22 @@
+--TEST--
+"extends" tag
+--TEMPLATE--
+{% set foo = 1 %}
+{{ include('parent.twig') }}
+{{ include('parent.twig') }}
+{% set foo = 2 %}
+{{ include('parent.twig') }}
+--TEMPLATE(parent.twig)--
+{% extends foo~'_parent.twig' %}{% block content %}{{ parent() }} parent{% endblock %}
+--TEMPLATE(1_parent.twig)--
+{% block content %}1{% endblock %}
+--TEMPLATE(2_parent.twig)--
+{% block content %}2{% endblock %}
+--DATA--
+return array()
+--EXPECT--
+1 parent
+
+1 parent
+
+2 parent
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 45c72fd..d212f5d 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
@@ -18,7 +18,7 @@
{% if 'c' not in bar %}
TRUE
{% endif %}
-{% if '' not in bar %}
+{% if '' in bar %}
TRUE
{% endif %}
{% if '' in '' %}
@@ -33,8 +33,47 @@
{% if '0' in '0' %}
TRUE
{% endif %}
+
+{{ false in [0, 1] ? 'TRUE' : 'FALSE' }}
+{{ true in [0, 1] ? 'TRUE' : 'FALSE' }}
+{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }}
+{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }}
+{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }}
+
+{{ '' in 'foo' ? 'TRUE' : 'FALSE' }}
+{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }}
+{{ false in 'foo' ? 'TRUE' : 'FALSE' }}
+{{ false in '100' ? 'TRUE' : 'FALSE' }}
+{{ true in '100' ? 'TRUE' : 'FALSE' }}
+
+{{ [] in [true, false] ? 'TRUE' : 'FALSE' }}
+{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }}
+{{ [] in [true, []] ? 'TRUE' : 'FALSE' }}
+
+{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }}
+{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }}
+{{ [] in 'Array' ? 'TRUE' : 'FALSE' }}
+{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }}
+
+{{ ''~resource in resource ? 'TRUE' : 'FALSE' }}
+{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }}
+{{ 'Array' in [] ? 'TRUE' : 'FALSE' }}
+{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }}
+
+{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }}
+{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }}
+{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }}
+
+{{ 5 in 125 ? 'TRUE' : 'FALSE' }}
+{{ 5 in '125' ? 'TRUE' : 'FALSE' }}
+{{ '5' in 125 ? 'TRUE' : 'FALSE' }}
+{{ '5' in '125' ? 'TRUE' : 'FALSE' }}
+
+{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }}
+{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }}
+{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }}
--DATA--
-return array('bar' => 'bar', 'foo' => array('bar' => 'bar'))
+return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => fopen(dirname(__FILE__), 'r'))
--EXPECT--
TRUE
TRUE
@@ -46,3 +85,42 @@
TRUE
TRUE
TRUE
+
+TRUE
+TRUE
+TRUE
+TRUE
+TRUE
+
+TRUE
+FALSE
+FALSE
+FALSE
+FALSE
+
+TRUE
+FALSE
+TRUE
+
+FALSE
+FALSE
+FALSE
+FALSE
+
+FALSE
+FALSE
+FALSE
+FALSE
+
+FALSE
+FALSE
+FALSE
+
+FALSE
+TRUE
+FALSE
+TRUE
+
+FALSE
+TRUE
+FALSE
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 13849b3..a9d6119 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php
@@ -60,6 +60,7 @@ public function testPaths()
$loader->addPath($basePath.'/named_ter', 'named');
$loader->addPath($basePath.'/normal_ter');
$loader->prependPath($basePath.'/normal_final');
+ $loader->prependPath($basePath.'/named/../named_quater', 'named');
$loader->prependPath($basePath.'/named_final', 'named');
$this->assertEquals(array(
@@ -70,11 +71,16 @@ public function testPaths()
), $loader->getPaths());
$this->assertEquals(array(
$basePath.'/named_final',
+ $basePath.'/named/../named_quater',
$basePath.'/named',
$basePath.'/named_bis',
$basePath.'/named_ter',
), $loader->getPaths('named'));
+ $this->assertEquals(
+ $basePath.'/named_quater/named_absolute.html',
+ $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'));
$this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html b/core/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html
new file mode 100644
index 0000000..b1fb5f5
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html
@@ -0,0 +1 @@
+named path (quater)
diff --git a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
index 7de268c..9bc6079 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
@@ -13,20 +13,20 @@ class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase
{
public function testGetProperties()
{
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
+ }
+
$twig = new Twig_Environment(new Twig_Loader_String(), array(
'debug' => true,
'cache' => false,
- 'autoescape' => false
+ 'autoescape' => false,
));
$d1 = new DateTime();
$d2 = new DateTime();
$output = $twig->render('{{ d1.date }}{{ d2.date }}', compact('d1', 'd2'));
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
- }
-
// If it fails, PHP will crash.
$this->assertEquals($output, $d1->date.$d2->date);
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php
index dc7ddc5..25d1602 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_AutoEscapeTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_AutoEscape::__construct
- */
public function testConstructor()
{
$body = new Twig_Node(array(new Twig_Node_Text('foo', 1)));
@@ -23,15 +20,6 @@ public function testConstructor()
$this->assertTrue($node->getAttribute('value'));
}
- /**
- * @covers Twig_Node_AutoEscape::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$body = new Twig_Node(array(new Twig_Node_Text('foo', 1)));
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php
index 96d0e10..84dac9b 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_BlockReferenceTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_BlockReference::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_BlockReference('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_BlockReference::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
return array(
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php
index 024049d..e7246dc 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_BlockTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Block::__construct
- */
public function testConstructor()
{
$body = new Twig_Node_Text('foo', 1);
@@ -23,15 +20,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Block::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$body = new Twig_Node_Text('foo', 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php
index a406e22..aa33d1a 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_DoTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Do::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant('foo', 1);
@@ -22,15 +19,6 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('expr'));
}
- /**
- * @covers Twig_Node_Do::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php
index c6a9044..4f83ab1 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_ArrayTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Array::__construct
- */
public function testConstructor()
{
$elements = array(new Twig_Node_Expression_Constant('foo', 1), $foo = new Twig_Node_Expression_Constant('bar', 1));
@@ -22,15 +19,6 @@ public function testConstructor()
$this->assertEquals($foo, $node->getNode(1));
}
- /**
- * @covers Twig_Node_Expression_Array::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$elements = array(
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php
index b156dcc..bf365de 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_AssignNameTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_AssignName::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_Expression_AssignName('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Expression_AssignName::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$node = new Twig_Node_Expression_AssignName('foo', 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php
index a0f49cb..02310a1 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_AddTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Add::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Add::compile
- * @covers Twig_Node_Expression_Binary_Add::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php
index 50e551a..2df3c8e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_AndTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_And::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_And::compile
- * @covers Twig_Node_Expression_Binary_And::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php
index 140329f..759e482 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_ConcatTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Concat::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Concat::compile
- * @covers Twig_Node_Expression_Binary_Concat::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php
index 0c1a3c7..0e54b10 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_DivTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Div::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Div::compile
- * @covers Twig_Node_Expression_Binary_Div::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php
index ead1fde..602888f 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_FloorDivTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_FloorDiv::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_FloorDiv::compile
- * @covers Twig_Node_Expression_Binary_FloorDiv::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php
index 4fe1a1f..4c663c7 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_ModTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Mod::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Mod::compile
- * @covers Twig_Node_Expression_Binary_Mod::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php
index 12bb35c..e92c95e 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_MulTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Mul::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Mul::compile
- * @covers Twig_Node_Expression_Binary_Mul::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php
index 9534c41..ec37c83 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_OrTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Or::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Or::compile
- * @covers Twig_Node_Expression_Binary_Or::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php
index 9074893..061cb27 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Binary_SubTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Binary_Sub::__construct
- */
public function testConstructor()
{
$left = new Twig_Node_Expression_Constant(1, 1);
@@ -24,16 +21,6 @@ public function testConstructor()
$this->assertEquals($right, $node->getNode('right'));
}
- /**
- * @covers Twig_Node_Expression_Binary_Sub::compile
- * @covers Twig_Node_Expression_Binary_Sub::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$left = new Twig_Node_Expression_Constant(1, 1);
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 c54ea1e..9cd9715 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
@@ -39,7 +39,7 @@ public function testGetArgumentsWhenArgumentIsDefinedTwice()
/**
* @expectedException Twig_Error_Syntax
- * @expectedExceptionMessage Unknown argument "unknown" for function "date".
+ * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)".
*/
public function testGetArgumentsWithWrongNamedArgumentName()
{
@@ -49,13 +49,38 @@ public function testGetArgumentsWithWrongNamedArgumentName()
/**
* @expectedException Twig_Error_Syntax
- * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date".
+ * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)".
*/
public function testGetArgumentsWithWrongNamedArgumentNames()
{
$node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date'));
$node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => ''));
}
+
+ /**
+ * @expectedException Twig_Error_Syntax
+ * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length".
+ */
+ public function testResolveArgumentsWithMissingValueForOptionalArgument()
+ {
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('Skip under HHVM as the behavior is not the same as plain PHP (which is an edge case anyway)');
+ }
+
+ $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare'));
+ $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true));
+ }
+
+ public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction()
+ {
+ $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')));
+ }
+
+ public function customFunction($arg1, $arg2 = 'default', $arg3 = array())
+ {
+ }
}
class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php
index 9906d51..a3e8bad 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_ConditionalTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Conditional::__construct
- */
public function testConstructor()
{
$expr1 = new Twig_Node_Expression_Constant(1, 1);
@@ -26,15 +23,6 @@ public function testConstructor()
$this->assertEquals($expr3, $node->getNode('expr3'));
}
- /**
- * @covers Twig_Node_Expression_Conditional::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php
index d0dec53..2ff9318 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_ConstantTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Constant::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_Expression_Constant('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('value'));
}
- /**
- * @covers Twig_Node_Expression_Constant::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
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 8089b9c..2b85141 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
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Filter::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant('foo', 1);
@@ -26,15 +23,6 @@ public function testConstructor()
$this->assertEquals($args, $node->getNode('arguments'));
}
- /**
- * @covers Twig_Node_Expression_Filter::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
@@ -86,7 +74,7 @@ public function getTests()
/**
* @expectedException Twig_Error_Syntax
- * @expectedExceptionMessage Unknown argument "foobar" for filter "date".
+ * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1.
*/
public function testCompileWithWrongNamedArgumentName()
{
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 2693b2e..4d4a721 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
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_FunctionTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Function::__construct
- */
public function testConstructor()
{
$name = 'function';
@@ -24,15 +21,6 @@ public function testConstructor()
$this->assertEquals($args, $node->getNode('arguments'));
}
- /**
- * @covers Twig_Node_Expression_Function::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$environment = new Twig_Environment();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
index 76cf5c6..2764478 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_GetAttrTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_GetAttr::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Name('foo', 1);
@@ -29,15 +26,6 @@ public function testConstructor()
$this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type'));
}
- /**
- * @covers Twig_Node_Expression_GetAttr::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
@@ -46,16 +34,16 @@ public function getTests()
$attr = new Twig_Node_Expression_Constant('bar', 1);
$args = new Twig_Node_Expression_Array(array(), 1);
$node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ANY_CALL, 1);
- $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo')));
+ $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1)));
$node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1);
- $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo')));
+ $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1)));
$args = new Twig_Node_Expression_Array(array(), 1);
$args->addElement(new Twig_Node_Expression_Name('foo', 1));
$args->addElement(new Twig_Node_Expression_Constant('bar', 1));
$node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1);
- $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo'), $this->getVariableGetter('foo')));
+ $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo')));
return $tests;
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php
index 76d109b..d013aff 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_NameTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Name::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_Expression_Name('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Expression_Name::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$node = new Twig_Node_Expression_Name('foo', 1);
@@ -40,10 +28,10 @@ public function getTests()
$env1 = new Twig_Environment(null, array('strict_variables' => false));
return array(
- version_compare(PHP_VERSION, '5.4.0') >= 0 ? array($node, '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))', $env) : array($node, '$this->getContext($context, "foo")', $env),
- array($node, $this->getVariableGetter('foo'), $env1),
- array($self, '$this'),
- array($context, '$context'),
+ array($node, "// line 1\n".(version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env),
+ array($node, $this->getVariableGetter('foo', 1), $env1),
+ array($self, "// line 1\n\$this"),
+ array($context, "// line 1\n\$context"),
);
}
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php
index 4d40419..ab2bbe0 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_ParentTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Parent::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_Expression_Parent('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Expression_Parent::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = 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 0664150..2f54a5a 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
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Test::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant('foo', 1);
@@ -26,15 +23,6 @@ public function testConstructor()
$this->assertEquals($name, $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Expression_Test::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php
index d55ab33..b633371 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Unary_NegTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Unary_Neg::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant(1, 1);
@@ -22,23 +19,14 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('node'));
}
- /**
- * @covers Twig_Node_Expression_Unary_Neg::compile
- * @covers Twig_Node_Expression_Unary_Neg::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$node = new Twig_Node_Expression_Constant(1, 1);
$node = new Twig_Node_Expression_Unary_Neg($node, 1);
return array(
- array($node, '(-1)'),
+ array($node, '-1'),
+ array(new Twig_Node_Expression_Unary_Neg($node, 1), '- -1'),
);
}
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php
index 625c252..d7c6f85 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Unary_NotTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Unary_Not::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant(1, 1);
@@ -22,23 +19,13 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('node'));
}
- /**
- * @covers Twig_Node_Expression_Unary_Not::compile
- * @covers Twig_Node_Expression_Unary_Not::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$node = new Twig_Node_Expression_Constant(1, 1);
$node = new Twig_Node_Expression_Unary_Not($node, 1);
return array(
- array($node, '(!1)'),
+ array($node, '!1'),
);
}
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php
index 047a097..057250f 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_Expression_Unary_PosTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Expression_Unary_Pos::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant(1, 1);
@@ -22,23 +19,13 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('node'));
}
- /**
- * @covers Twig_Node_Expression_Unary_Pos::compile
- * @covers Twig_Node_Expression_Unary_Pos::operator
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$node = new Twig_Node_Expression_Constant(1, 1);
$node = new Twig_Node_Expression_Unary_Pos($node, 1);
return array(
- array($node, '(+1)'),
+ array($node, '+1'),
);
}
}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php
index 09862a7..b289592 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_For::__construct
- */
public function testConstructor()
{
$keyTarget = new Twig_Node_Expression_AssignName('key', 1);
@@ -39,15 +36,6 @@ public function testConstructor()
$this->assertEquals($else, $node->getNode('else'));
}
- /**
- * @covers Twig_Node_For::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php
index 2d96f6f..e47dd65 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_IfTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_If::__construct
- */
public function testConstructor()
{
$t = new Twig_Node(array(
@@ -31,15 +28,6 @@ public function testConstructor()
$this->assertEquals($else, $node->getNode('else'));
}
- /**
- * @covers Twig_Node_If::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php
index db36581..0c340a9 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_ImportTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Import::__construct
- */
public function testConstructor()
{
$macro = new Twig_Node_Expression_Constant('foo.twig', 1);
@@ -24,15 +21,6 @@ public function testConstructor()
$this->assertEquals($var, $node->getNode('var'));
}
- /**
- * @covers Twig_Node_Import::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
index 9afecef..03f10d4 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_IncludeTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Include::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant('foo.twig', 1);
@@ -29,15 +26,6 @@ public function testConstructor()
$this->assertTrue($node->getAttribute('only'));
}
- /**
- * @covers Twig_Node_Include::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = 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 2a77ac7..52ee8b7 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Macro::__construct
- */
public function testConstructor()
{
$body = new Twig_Node_Text('foo', 1);
@@ -25,15 +22,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('name'));
}
- /**
- * @covers Twig_Node_Macro::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$body = new Twig_Node_Text('foo', 1);
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 b8996ed..b15a475 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Module::__construct
- */
public function testConstructor()
{
$body = new Twig_Node_Text('foo', 1);
@@ -31,22 +28,6 @@ public function testConstructor()
$this->assertEquals($filename, $node->getAttribute('filename'));
}
- /**
- * @covers Twig_Node_Module::compile
- * @covers Twig_Node_Module::compileTemplate
- * @covers Twig_Node_Module::compileMacros
- * @covers Twig_Node_Module::compileClassHeader
- * @covers Twig_Node_Module::compileDisplayHeader
- * @covers Twig_Node_Module::compileDisplayBody
- * @covers Twig_Node_Module::compileDisplayFooter
- * @covers Twig_Node_Module::compileClassFooter
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$twig = new Twig_Environment(new Twig_Loader_String());
@@ -96,7 +77,7 @@ public function getDebugInfo()
EOF
, $twig);
- $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 1);
+ $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 2);
$body = new Twig_Node(array($import));
$extends = new Twig_Node_Expression_Constant('layout.twig', 1);
@@ -112,7 +93,15 @@ public function __construct(Twig_Environment \$env)
{
parent::__construct(\$env);
- \$this->parent = \$this->env->loadTemplate("layout.twig");
+ // line 1
+ try {
+ \$this->parent = \$this->env->loadTemplate("layout.twig");
+ } catch (Twig_Error_Loader \$e) {
+ \$e->setTemplateFile(\$this->getTemplateName());
+ \$e->setTemplateLine(1);
+
+ throw \$e;
+ }
\$this->blocks = array(
);
@@ -125,8 +114,9 @@ protected function doGetParent(array \$context)
protected function doDisplay(array \$context, array \$blocks = array())
{
- // line 1
+ // line 2
\$context["macro"] = \$this->env->loadTemplate("foo.twig");
+ // line 1
\$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks));
}
@@ -142,18 +132,19 @@ public function isTraitable()
public function getDebugInfo()
{
- return array ( 24 => 1,);
+ return array ( 34 => 1, 32 => 2, 11 => 1,);
}
}
EOF
, $twig);
- $body = new Twig_Node();
+ $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, 1),
- new Twig_Node_Expression_Constant('foo', 1),
- new Twig_Node_Expression_Constant('foo', 1),
- 0
+ new Twig_Node_Expression_Constant(true, 2),
+ new Twig_Node_Expression_Constant('foo', 2),
+ new Twig_Node_Expression_Constant('foo', 2),
+ 2
);
$node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename);
@@ -165,11 +156,15 @@ class __TwigTemplate_a2bfbf7dd6ab85666684fe9297f69363a3fc2046d90f22a317d380c1863
{
protected function doGetParent(array \$context)
{
+ // line 2
return \$this->env->resolveTemplate(((true) ? ("foo") : ("foo")));
}
protected function doDisplay(array \$context, array \$blocks = array())
{
+ // line 4
+ \$context["foo"] = "foo";
+ // line 2
\$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks));
}
@@ -185,7 +180,7 @@ public function isTraitable()
public function getDebugInfo()
{
- return array ();
+ return array ( 17 => 2, 15 => 4, 9 => 2,);
}
}
EOF
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php
index 6fe43a4..4e0990f 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_PrintTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Print::__construct
- */
public function testConstructor()
{
$expr = new Twig_Node_Expression_Constant('foo', 1);
@@ -22,15 +19,6 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('expr'));
}
- /**
- * @covers Twig_Node_Print::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php
index db9dbf9..46ecf97 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_SandboxTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Sandbox::__construct
- */
public function testConstructor()
{
$body = new Twig_Node_Text('foo', 1);
@@ -22,15 +19,6 @@ public function testConstructor()
$this->assertEquals($body, $node->getNode('body'));
}
- /**
- * @covers Twig_Node_Sandbox::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php
deleted file mode 100644
index bb9ffb7..0000000
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php
+++ /dev/null
@@ -1,209 +0,0 @@
-assertEquals($body, $node->getNode('body'));
- $this->assertEquals($blocks, $node->getNode('blocks'));
- $this->assertEquals($macros, $node->getNode('macros'));
- $this->assertEquals($parent, $node->getNode('parent'));
- $this->assertEquals($filename, $node->getAttribute('filename'));
- }
-
- /**
- * @covers Twig_Node_SandboxedModule::compile
- * @covers Twig_Node_SandboxedModule::compileDisplayBody
- * @covers Twig_Node_SandboxedModule::compileDisplayFooter
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
- public function getTests()
- {
- $twig = new Twig_Environment(new Twig_Loader_String());
-
- $tests = array();
-
- $body = new Twig_Node_Text('foo', 1);
- $extends = null;
- $blocks = new Twig_Node();
- $macros = new Twig_Node();
- $traits = new Twig_Node();
- $filename = 'foo.twig';
-
- $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename);
- $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle'));
-
- $tests[] = array($node, <<parent = false;
-
- \$this->blocks = array(
- );
- }
-
- protected function doDisplay(array \$context, array \$blocks = array())
- {
- \$this->checkSecurity();
- // line 1
- echo "foo";
- }
-
- protected function checkSecurity()
- {
- \$tags = array();
- \$filters = array();
- \$functions = array();
-
- try {
- \$this->env->getExtension('sandbox')->checkSecurity(
- array('upper'),
- array('for'),
- array('cycle')
- );
- } catch (Twig_Sandbox_SecurityError \$e) {
- \$e->setTemplateFile(\$this->getTemplateName());
-
- if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {
- \$e->setTemplateLine(\$tags[\$e->getTagName()]);
- } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {
- \$e->setTemplateLine(\$filters[\$e->getFilterName()]);
- } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {
- \$e->setTemplateLine(\$functions[\$e->getFunctionName()]);
- }
-
- throw \$e;
- }
- }
-
- public function getTemplateName()
- {
- return "foo.twig";
- }
-
- public function getDebugInfo()
- {
- return array ( 20 => 1,);
- }
-}
-EOF
- , $twig);
-
- $body = new Twig_Node();
- $extends = new Twig_Node_Expression_Constant('layout.twig', 1);
- $blocks = new Twig_Node();
- $macros = new Twig_Node();
- $traits = new Twig_Node();
- $filename = 'foo.twig';
-
- $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename);
- $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle'));
-
- $tests[] = array($node, <<parent = \$this->env->loadTemplate("layout.twig");
-
- \$this->blocks = array(
- );
- }
-
- protected function doGetParent(array \$context)
- {
- return "layout.twig";
- }
-
- protected function doDisplay(array \$context, array \$blocks = array())
- {
- \$this->checkSecurity();
- \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks));
- }
-
- protected function checkSecurity()
- {
- \$tags = array();
- \$filters = array();
- \$functions = array();
-
- try {
- \$this->env->getExtension('sandbox')->checkSecurity(
- array('upper'),
- array('for'),
- array('cycle')
- );
- } catch (Twig_Sandbox_SecurityError \$e) {
- \$e->setTemplateFile(\$this->getTemplateName());
-
- if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {
- \$e->setTemplateLine(\$tags[\$e->getTagName()]);
- } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {
- \$e->setTemplateLine(\$filters[\$e->getFilterName()]);
- } elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {
- \$e->setTemplateLine(\$functions[\$e->getFunctionName()]);
- }
-
- throw \$e;
- }
- }
-
- public function getTemplateName()
- {
- return "foo.twig";
- }
-
- public function isTraitable()
- {
- return false;
- }
-
- public function getDebugInfo()
- {
- return array ();
- }
-}
-EOF
- , $twig);
-
- return $tests;
- }
-}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php
index 058e02b..05e1854 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_SandboxedPrintTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_SandboxedPrint::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_SandboxedPrint($expr = new Twig_Node_Expression_Constant('foo', 1), 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals($expr, $node->getNode('expr'));
}
- /**
- * @covers Twig_Node_SandboxedPrint::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php
index 893cd4d..62ad280 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_SetTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Set::__construct
- */
public function testConstructor()
{
$names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1);
@@ -25,15 +22,6 @@ public function testConstructor()
$this->assertFalse($node->getAttribute('capture'));
}
- /**
- * @covers Twig_Node_Set::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php
index 6735dc3..222ca09 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_SpacelessTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Spaceless::__construct
- */
public function testConstructor()
{
$body = new Twig_Node(array(new Twig_Node_Text('', 1)));
@@ -22,15 +19,6 @@ public function testConstructor()
$this->assertEquals($body, $node->getNode('body'));
}
- /**
- * @covers Twig_Node_Spaceless::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$body = new Twig_Node(array(new Twig_Node_Text('', 1)));
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php
index 6f85576..ceaf67f 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php
@@ -11,9 +11,6 @@
class Twig_Tests_Node_TextTest extends Twig_Test_NodeTestCase
{
- /**
- * @covers Twig_Node_Text::__construct
- */
public function testConstructor()
{
$node = new Twig_Node_Text('foo', 1);
@@ -21,15 +18,6 @@ public function testConstructor()
$this->assertEquals('foo', $node->getAttribute('data'));
}
- /**
- * @covers Twig_Node_Text::compile
- * @dataProvider getTests
- */
- public function testCompile($node, $source, $environment = null)
- {
- parent::testCompile($node, $source, $environment);
- }
-
public function getTests()
{
$tests = array();
diff --git a/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php
index d35740d..72c777c 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php
@@ -89,6 +89,16 @@ public function getTestsForForOptimizer()
array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)),
array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)),
+
+ array('{% for i in foo %}{{ include("foo") }}{% endfor %}', array('i' => true)),
+
+ array('{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', array('i' => false)),
+
+ array('{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', array('i' => true)),
+
+ array('{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', array('i' => false)),
+
+ array('{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', array('i' => true)),
);
}
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
new file mode 100644
index 0000000..9020d3f
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php
@@ -0,0 +1,44 @@
+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);
+ $a = range(1, 1000);
+ $embedded->leave();
+ $profile->leave();
+
+ usleep(5000);
+ $index->leave();
+
+ return $profile;
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php
new file mode 100644
index 0000000..1a1b9d2
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php
@@ -0,0 +1,32 @@
+assertStringMatchesFormat(<<index.twig//1 %d %d %d
+index.twig==>embedded.twig::block(body)//1 %d %d 0
+index.twig==>embedded.twig//2 %d %d %d
+embedded.twig==>included.twig//2 %d %d %d
+index.twig==>index.twig::macro(foo)//1 %d %d %d
+EOF
+ , $dumper->dump($this->getProfile()));
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php
new file mode 100644
index 0000000..1593a03
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php
@@ -0,0 +1,30 @@
+assertStringMatchesFormat(<<main
+└ index.twig %d.%dms/%d%
+ └ embedded.twig::block(body)
+ └ embedded.twig
+ │ └ included.twig
+ └ index.twig::macro(foo)
+ └ embedded.twig
+ └ included.twig
+
+EOF
+ , $dumper->dump($this->getProfile()));
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php
new file mode 100644
index 0000000..2fac9a7
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php
@@ -0,0 +1,30 @@
+assertStringMatchesFormat(<<dump($this->getProfile()));
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/core/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php
new file mode 100644
index 0000000..43f5bc4
--- /dev/null
+++ b/core/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php
@@ -0,0 +1,99 @@
+assertEquals('template', $profile->getTemplate());
+ $this->assertEquals('type', $profile->getType());
+ $this->assertEquals('name', $profile->getName());
+ }
+
+ public function testIsRoot()
+ {
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT);
+ $this->assertTrue($profile->isRoot());
+
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE);
+ $this->assertFalse($profile->isRoot());
+ }
+
+ public function testIsTemplate()
+ {
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE);
+ $this->assertTrue($profile->isTemplate());
+
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT);
+ $this->assertFalse($profile->isTemplate());
+ }
+
+ public function testIsBlock()
+ {
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::BLOCK);
+ $this->assertTrue($profile->isBlock());
+
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT);
+ $this->assertFalse($profile->isBlock());
+ }
+
+ public function testIsMacro()
+ {
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::MACRO);
+ $this->assertTrue($profile->isMacro());
+
+ $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT);
+ $this->assertFalse($profile->isMacro());
+ }
+
+ public function testGetAddProfile()
+ {
+ $profile = new Twig_Profiler_Profile();
+ $profile->addProfile($a = new Twig_Profiler_Profile());
+ $profile->addProfile($b = new Twig_Profiler_Profile());
+
+ $this->assertSame(array($a, $b), $profile->getProfiles());
+ $this->assertSame(array($a, $b), iterator_to_array($profile));
+ }
+
+ public function testGetDuration()
+ {
+ $profile = new Twig_Profiler_Profile();
+ $profile->leave();
+
+ $this->assertTrue($profile->getDuration() > 0);
+ }
+
+ public function testSerialize()
+ {
+ $profile = new Twig_Profiler_Profile('template', 'type', 'name');
+ $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1');
+ $profile->addProfile($profile1);
+ $profile->leave();
+ $profile1->leave();
+
+ $profile2 = unserialize(serialize($profile));
+ $profiles = $profile->getProfiles();
+ $this->assertCount(1, $profiles);
+ $profile3 = $profiles[0];
+
+ $this->assertEquals($profile->getTemplate(), $profile2->getTemplate());
+ $this->assertEquals($profile->getType(), $profile2->getType());
+ $this->assertEquals($profile->getName(), $profile2->getName());
+ $this->assertEquals($profile->getDuration(), $profile2->getDuration());
+
+ $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate());
+ $this->assertEquals($profile1->getType(), $profile3->getType());
+ $this->assertEquals($profile1->getName(), $profile3->getName());
+ }
+}
diff --git a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
index e2f84ee..9010f28 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php
@@ -310,7 +310,7 @@ public function getGetAttributeTests()
foreach ($basicTests as $test) {
// properties cannot be numbers
if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) {
- continue;
+ continue;
}
if ('+4' === $test[2] && $methodObject === $testObject[0]) {
@@ -347,7 +347,7 @@ public function getGetAttributeTests()
}
}
- $methodAndPropObject = new Twig_TemplateMethodAndPropObject;
+ $methodAndPropObject = new Twig_TemplateMethodAndPropObject();
// additional method tests
$tests = array_merge($tests, array(
@@ -396,7 +396,7 @@ public function __construct(Twig_Environment $env, $useExtGetAttribute = false)
{
parent::__construct($env);
$this->useExtGetAttribute = $useExtGetAttribute;
- Twig_Template::clearCache();
+ self::$cache = array();
}
public function getZero()
diff --git a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
index d581315..b28d3cd 100644
--- a/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
+++ b/core/vendor/twig/twig/test/Twig/Tests/escapingTest.php
@@ -6,7 +6,6 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-
class Twig_Test_EscapingTest extends PHPUnit_Framework_TestCase
{
/**
@@ -17,7 +16,7 @@ class Twig_Test_EscapingTest extends PHPUnit_Framework_TestCase
'"' => '"',
'<' => '<',
'>' => '>',
- '&' => '&'
+ '&' => '&',
);
protected $htmlAttrSpecialChars = array(
@@ -227,7 +226,7 @@ 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)
@@ -256,7 +255,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) {
@@ -279,7 +278,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) {
@@ -302,7 +301,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) {