maj
This commit is contained in:
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
* 1.35.4 (2018-07-13)
|
||||
|
||||
* ensured that syntax errors are triggered with the right line
|
||||
* added the Symfony ctype polyfill as a dependency
|
||||
* "js" filter now produces valid JSON
|
||||
|
||||
* 1.35.3 (2018-03-20)
|
||||
|
||||
* fixed block names unicity
|
||||
|
||||
Vendored
+1
-1
@@ -12,4 +12,4 @@ More Information
|
||||
|
||||
Read the `documentation`_ for more information.
|
||||
|
||||
.. _documentation: http://twig.sensiolabs.org/documentation
|
||||
.. _documentation: https://twig.symfony.com/documentation
|
||||
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
class Twig_Environment
|
||||
{
|
||||
const VERSION = '1.35.3';
|
||||
const VERSION_ID = 13503;
|
||||
const VERSION = '1.35.4';
|
||||
const VERSION_ID = 13504;
|
||||
const MAJOR_VERSION = 1;
|
||||
const MINOR_VERSION = 35;
|
||||
const RELEASE_VERSION = 3;
|
||||
const RELEASE_VERSION = 4;
|
||||
const EXTRA_VERSION = '';
|
||||
|
||||
protected $charset;
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
*
|
||||
* This parser implements a "Precedence climbing" algorithm.
|
||||
*
|
||||
* @see http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
|
||||
* @see http://en.wikipedia.org/wiki/Operator-precedence_parser
|
||||
* @see https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
|
||||
* @see https://en.wikipedia.org/wiki/Operator-precedence_parser
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
|
||||
+22
-8
@@ -467,7 +467,7 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu
|
||||
*
|
||||
* @param string $str String to replace in
|
||||
* @param array|Traversable $from Replace values
|
||||
* @param string|null $to Replace to, deprecated (@see http://php.net/manual/en/function.strtr.php)
|
||||
* @param string|null $to Replace to, deprecated (@see https://secure.php.net/manual/en/function.strtr.php)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -1000,7 +1000,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
|
||||
|
||||
switch ($strategy) {
|
||||
case 'html':
|
||||
// see http://php.net/htmlspecialchars
|
||||
// see https://secure.php.net/htmlspecialchars
|
||||
|
||||
// Using a static variable to avoid initializing the array
|
||||
// each time the function is called. Moving the declaration on the
|
||||
@@ -1040,7 +1040,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
|
||||
|
||||
case 'js':
|
||||
// escape all non-alphanumeric characters
|
||||
// into their \xHH or \uHHHH representations
|
||||
// into their \x or \uHHHH representations
|
||||
if ('UTF-8' !== $charset) {
|
||||
$string = twig_convert_encoding($string, 'UTF-8', $charset);
|
||||
}
|
||||
@@ -1152,9 +1152,23 @@ function _twig_escape_js_callback($matches)
|
||||
{
|
||||
$char = $matches[0];
|
||||
|
||||
// \xHH
|
||||
if (!isset($char[1])) {
|
||||
return '\\x'.strtoupper(substr('00'.bin2hex($char), -2));
|
||||
/*
|
||||
* A few characters have short escape sequences in JSON and JavaScript.
|
||||
* Escape sequences supported only by JavaScript, not JSON, are ommitted.
|
||||
* \" is also supported but omitted, because the resulting string is not HTML safe.
|
||||
*/
|
||||
static $shortMap = array(
|
||||
'\\' => '\\\\',
|
||||
'/' => '\\/',
|
||||
"\x08" => '\b',
|
||||
"\x0C" => '\f',
|
||||
"\x0A" => '\n',
|
||||
"\x0D" => '\r',
|
||||
"\x09" => '\t',
|
||||
);
|
||||
|
||||
if (isset($shortMap[$char])) {
|
||||
return $shortMap[$char];
|
||||
}
|
||||
|
||||
// \uHHHH
|
||||
@@ -1191,8 +1205,8 @@ function _twig_escape_css_callback($matches)
|
||||
/**
|
||||
* This function is adapted from code coming from Zend Framework.
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com)
|
||||
* @license https://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
function _twig_escape_html_attr_callback($matches)
|
||||
{
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
||||
|
||||
public function isFresh($name, $time)
|
||||
{
|
||||
return filemtime($this->findTemplate($name)) <= $time;
|
||||
return filemtime($this->findTemplate($name)) < $time;
|
||||
}
|
||||
|
||||
protected function findTemplate($name)
|
||||
|
||||
+6
-6
@@ -111,7 +111,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
||||
$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".', $callType, $callName));
|
||||
throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine());
|
||||
}
|
||||
|
||||
$parameters[$name] = $node;
|
||||
@@ -143,14 +143,14 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
||||
|
||||
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, $callType, $callName));
|
||||
throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine());
|
||||
}
|
||||
|
||||
if (count($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))
|
||||
);
|
||||
$name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments)
|
||||
), $this->getTemplateLine());
|
||||
}
|
||||
|
||||
$arguments = array_merge($arguments, $optionalArguments);
|
||||
@@ -172,7 +172,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
||||
$missingArguments[] = $name;
|
||||
}
|
||||
} else {
|
||||
throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName));
|
||||
throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
||||
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->getTemplateLine() : -1);
|
||||
), $unknownParameter ? $unknownParameter->getTemplateLine() : $this->getTemplateLine());
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
|
||||
+6
-1
@@ -32,7 +32,12 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression
|
||||
if ($this->isSpecial()) {
|
||||
$compiler->repr(true);
|
||||
} else {
|
||||
$compiler->raw('array_key_exists(')->repr($name)->raw(', $context)');
|
||||
$compiler
|
||||
->raw('(isset($context[')
|
||||
->string($name)
|
||||
->raw(']) || array_key_exists(')
|
||||
->string($name)
|
||||
->raw(', $context))');
|
||||
}
|
||||
} elseif ($this->isSpecial()) {
|
||||
$compiler->raw($this->specialVars[$name]);
|
||||
|
||||
+4
-2
@@ -70,8 +70,10 @@ class Twig_NodeTraverser
|
||||
$node = $visitor->enterNode($node, $this->env);
|
||||
|
||||
foreach ($node as $k => $n) {
|
||||
if (false !== $n = $this->traverseForVisitor($visitor, $n)) {
|
||||
$node->setNode($k, $n);
|
||||
if (false !== $m = $this->traverseForVisitor($visitor, $n)) {
|
||||
if ($m !== $n) {
|
||||
$node->setNode($k, $m);
|
||||
}
|
||||
} else {
|
||||
$node->removeNode($k);
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ abstract class Twig_Test_IntegrationTestCase extends TestCase
|
||||
protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs)
|
||||
{
|
||||
if (!$outputs) {
|
||||
$this->markTestSkipped('no legacy tests to run');
|
||||
$this->markTestSkipped('no tests to run');
|
||||
}
|
||||
|
||||
if ($condition) {
|
||||
|
||||
Vendored
+1
-1
@@ -62,7 +62,7 @@ class Twig_Token
|
||||
* * type and value (or array of possible values)
|
||||
* * just value (or array of possible values) (NAME_TYPE is used as type)
|
||||
*
|
||||
* @param array|int $type The type to test
|
||||
* @param array|string|int $type The type to test
|
||||
* @param array|string|null $values The token value
|
||||
*
|
||||
* @return bool
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
* {% endsandbox %}
|
||||
* </pre>
|
||||
*
|
||||
* @see http://www.twig-project.org/doc/api.html#sandbox-extension for details
|
||||
* @see https://twig.symfony.com/doc/api.html#sandbox-extension for details
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
* {% block content %}{% endblock %}
|
||||
* </pre>
|
||||
*
|
||||
* @see http://www.twig-project.org/doc/templates.html#horizontal-reuse for details.
|
||||
* @see https://twig.symfony.com/doc/templates.html#horizontal-reuse for details.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user