From cd01a0cad558268fac41143e7d1137c26eeb0d7d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 27 Oct 2016 07:06:52 +0200 Subject: php-pecl-pdflib: switch the spec --- php-symfony-upstream.patch | 565 +++++++++++++++++++++++++++++++++++++++++++++ php-symfony.spec | 13 +- 2 files changed, 575 insertions(+), 3 deletions(-) create mode 100644 php-symfony-upstream.patch diff --git a/php-symfony-upstream.patch b/php-symfony-upstream.patch new file mode 100644 index 0000000..7ee4018 --- /dev/null +++ b/php-symfony-upstream.patch @@ -0,0 +1,565 @@ +From f0849d833118e69b0d630047594b046f0d4a34bc Mon Sep 17 00:00:00 2001 +From: Fabien Potencier +Date: Sat, 15 Oct 2016 12:33:44 -0700 +Subject: [PATCH] [TwigBridge] removed deprecations added in Twig 1.27 + +--- + composer.json | 2 +- + src/Symfony/Bridge/Twig/Command/LintCommand.php | 2 +- + .../Twig/Tests/Extension/RoutingExtensionTest.php | 2 +- + .../Tests/Extension/TranslationExtensionTest.php | 2 +- + .../Twig/Tests/NodeVisitor/TwigNodeProvider.php | 2 +- + .../Tests/TokenParser/FormThemeTokenParserTest.php | 2 +- + .../Twig/TokenParser/TransChoiceTokenParser.php | 2 +- + .../Bridge/Twig/TokenParser/TransTokenParser.php | 4 ++-- + .../Bridge/Twig/Translation/TwigExtractor.php | 6 +++--- + src/Symfony/Bridge/Twig/composer.json | 2 +- + src/Symfony/Bundle/SecurityBundle/composer.json | 2 +- + .../DependencyInjection/Configuration.php | 2 +- + .../DependencyInjection/TwigExtensionTest.php | 2 +- + .../TokenParser/LegacyRenderTokenParserTest.php | 2 +- + src/Symfony/Bundle/TwigBundle/TwigEngine.php | 10 ++++----- + src/Symfony/Bundle/TwigBundle/composer.json | 2 +- + .../HttpKernel/DataCollector/DumpDataCollector.php | 25 ++++++++++++---------- + 17 files changed, 37 insertions(+), 34 deletions(-) + +diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php +index df603f9..4ed6324 100644 +--- a/src/Symfony/Bridge/Twig/Command/LintCommand.php ++++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php +@@ -146,7 +146,7 @@ private function validate(\Twig_Environment $twig, $template, $file) + try { + $temporaryLoader = new \Twig_Loader_Array(array((string) $file => $template)); + $twig->setLoader($temporaryLoader); +- $nodeTree = $twig->parse($twig->tokenize($template, (string) $file)); ++ $nodeTree = $twig->parse($twig->tokenize(new \Twig_Source($template, (string) $file))); + $twig->compile($nodeTree); + $twig->setLoader($realLoader); + } catch (\Twig_Error $e) { +diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php +index 1c1ac64..87b6052 100644 +--- a/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php ++++ b/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php +@@ -23,7 +23,7 @@ public function testEscaping($template, $mustBeEscaped) + $twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0)); + $twig->addExtension(new RoutingExtension($this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface'))); + +- $nodes = $twig->parse($twig->tokenize($template)); ++ $nodes = $twig->parse($twig->tokenize(new \Twig_Source($template))); + + $this->assertSame($mustBeEscaped, $nodes->getNode('body')->getNode(0)->getNode('expr') instanceof \Twig_Node_Expression_Filter); + } +diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +index a02edc7..0235c4d 100644 +--- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php ++++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +@@ -36,7 +36,7 @@ public function testTrans($template, $expected, array $variables = array()) + $twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false)); + $twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector()))); + +- echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSource('index'), 'index')))."\n\n"; ++ echo $twig->compile($twig->parse($twig->tokenize(new \Twig_Source($twig->getLoader()->getSource('index'), 'index'))))."\n\n"; + $this->assertEquals($expected, $this->getTemplate($template)->render($variables)); + } + +diff --git a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php +index 0e401f6..a90b556 100644 +--- a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php ++++ b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php +@@ -25,7 +25,7 @@ public static function getModule($content) + new \Twig_Node_Expression_Array(array(), 0), + new \Twig_Node_Expression_Array(array(), 0), + null, +- null ++ new \Twig_Source('') + ); + } + +diff --git a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php +index 2986cd1..aa99132 100644 +--- a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php ++++ b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php +@@ -23,7 +23,7 @@ public function testCompile($source, $expected) + { + $env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $env->addTokenParser(new FormThemeTokenParser()); +- $stream = $env->tokenize($source); ++ $stream = $env->tokenize(new \Twig_Source($source)); + $parser = new \Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); +diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +index 7ea1a2c..e9e65ad 100644 +--- a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php ++++ b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token) + $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true); + + if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { +- throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getLine(), $stream->getFilename()); ++ throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); +diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +index 06472d0..1493cf8 100644 +--- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php ++++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +@@ -55,7 +55,7 @@ public function parse(\Twig_Token $token) + $stream->next(); + $locale = $this->parser->getExpressionParser()->parseExpression(); + } elseif (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { +- throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getFilename()); ++ throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext()->getName()); + } + } + +@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token) + $body = $this->parser->subparse(array($this, 'decideTransFork'), true); + + if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { +- throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getLine(), $stream->getFilename()); ++ throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); +diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +index 2a9450c..69ec1d9 100644 +--- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php ++++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +@@ -62,9 +62,9 @@ public function extract($resource, MessageCatalogue $catalogue) + $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); + } catch (\Twig_Error $e) { + if ($file instanceof SplFileInfo) { +- $e->setTemplateFile($file->getRelativePathname()); ++ $e->setTemplateName($file->getRelativePathname()); + } elseif ($file instanceof \SplFileInfo) { +- $e->setTemplateFile($file->getRealPath()); ++ $e->setTemplateName($file->getRealPath()); + } + + throw $e; +@@ -85,7 +85,7 @@ protected function extractTemplate($template, MessageCatalogue $catalogue) + $visitor = $this->twig->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslationNodeVisitor(); + $visitor->enable(); + +- $this->twig->parse($this->twig->tokenize($template)); ++ $this->twig->parse($this->twig->tokenize(new \Twig_Source($template))); + + foreach ($visitor->getMessages() as $message) { + $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain); +diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +index 52c70f3..008f9b7 100644 +--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php ++++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +@@ -167,7 +167,7 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode) + $rootNode + ->fixXmlConfig('path') + ->children() +- ->variableNode('autoescape')->defaultValue('filename')->end() ++ ->variableNode('autoescape')->defaultValue('name')->end() + ->scalarNode('autoescape_service')->defaultNull()->end() + ->scalarNode('autoescape_service_method')->defaultNull()->end() + ->scalarNode('base_template_class')->example('Twig_Template')->cannotBeEmpty()->end() +diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +index cd39680..fcfa38a 100644 +--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php ++++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +@@ -147,7 +147,7 @@ public function testLoadDefaultTemplateEscapingGuesserConfiguration($format) + $this->compileContainer($container); + + $options = $container->getDefinition('twig')->getArgument(1); +- $this->assertEquals('filename', $options['autoescape']); ++ $this->assertEquals('name', $options['autoescape']); + } + + public function testGlobalsWithDifferentTypesAndValues() +diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php +index e3d0a72..b1f81ec 100644 +--- a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php ++++ b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php +@@ -27,7 +27,7 @@ public function testCompile($source, $expected) + { + $env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $env->addTokenParser(new RenderTokenParser()); +- $stream = $env->tokenize($source); ++ $stream = $env->tokenize(new \Twig_Source($source)); + $parser = new \Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); +diff --git a/src/Symfony/Bundle/TwigBundle/TwigEngine.php b/src/Symfony/Bundle/TwigBundle/TwigEngine.php +index 3092fe9..0d01648 100644 +--- a/src/Symfony/Bundle/TwigBundle/TwigEngine.php ++++ b/src/Symfony/Bundle/TwigBundle/TwigEngine.php +@@ -54,13 +54,13 @@ public function setDefaultEscapingStrategy($strategy) + + /** + * @deprecated since version 2.7, to be removed in 3.0. +- * Use the 'filename' strategy instead. ++ * Use the 'name' strategy instead. + */ +- public function guessDefaultEscapingStrategy($filename) ++ public function guessDefaultEscapingStrategy($name) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Twig_FileExtensionEscapingStrategy::guess method instead.', E_USER_DEPRECATED); + +- return \Twig_FileExtensionEscapingStrategy::guess($filename); ++ return \Twig_FileExtensionEscapingStrategy::guess($name); + } + + /** +@@ -73,8 +73,8 @@ public function render($name, array $parameters = array()) + } catch (\Twig_Error $e) { + if ($name instanceof TemplateReference) { + try { +- // try to get the real file name of the template where the error occurred +- $e->setTemplateFile(sprintf('%s', $this->locator->locate($this->parser->parse($e->getTemplateFile())))); ++ // try to get the real name of the template where the error occurred ++ $e->setTemplateName(sprintf('%s', $this->locator->locate($this->parser->parse($e->getTemplateName())))); + } catch (\Exception $e2) { + } + } +diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +index 985db4b..3a445f4 100644 +--- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php ++++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +@@ -97,21 +97,24 @@ public function dump(Data $data) + + break; + } elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof \Twig_Template) { +- $info = $trace[$i]['object']; +- $name = $info->getTemplateName(); +- $src = method_exists($info, 'getSource') ? $info->getSource() : $info->getEnvironment()->getLoader()->getSource($name); +- $info = $info->getDebugInfo(); ++ $template = $trace[$i]['object']; ++ $name = $template->getTemplateName(); ++ $file = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getPath() : false; ++ $src = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : false); ++ $info = $template->getDebugInfo(); + if (null !== $src && isset($info[$trace[$i - 1]['line']])) { +- $file = false; + $line = $info[$trace[$i - 1]['line']]; +- $src = explode("\n", $src); +- $fileExcerpt = array(); + +- for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) { +- $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; +- } ++ if ($src) { ++ $src = explode("\n", $src); ++ $fileExcerpt = array(); ++ ++ for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) { ++ $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; ++ } + +- $fileExcerpt = '
    '.implode("\n", $fileExcerpt).'
'; ++ $fileExcerpt = '
    '.implode("\n", $fileExcerpt).'
'; ++ } + } + break; + } +From bb791d076444e016f7da768212233357eeac49de Mon Sep 17 00:00:00 2001 +From: Fabien Potencier +Date: Wed, 19 Oct 2016 15:17:26 -0700 +Subject: [PATCH] [TwigBridge] Use non-deprecated Twig_Node::getTemplateLine() + +--- + src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php | 2 +- + src/Symfony/Bridge/Twig/Node/TransNode.php | 6 +++--- + .../Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php | 8 ++++---- + src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php | 2 +- + src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php | 2 +- + 5 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php +index 8c42bcd..9cb9648 100644 +--- a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php ++++ b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php +@@ -37,7 +37,7 @@ public function compile(\Twig_Compiler $compiler) + // the variables in the third argument + $label = $arguments[1]; + $variables = isset($arguments[2]) ? $arguments[2] : null; +- $lineno = $label->getLine(); ++ $lineno = $label->getTemplateLine(); + + if ($label instanceof \Twig_Node_Expression_Constant) { + // If the label argument is given as a constant, we can either +diff --git a/src/Symfony/Bridge/Twig/Node/TransNode.php b/src/Symfony/Bridge/Twig/Node/TransNode.php +index 114b38c..7b2f9c0 100644 +--- a/src/Symfony/Bridge/Twig/Node/TransNode.php ++++ b/src/Symfony/Bridge/Twig/Node/TransNode.php +@@ -109,18 +109,18 @@ protected function compileString(\Twig_Node $body, \Twig_Node_Expression_Array $ + preg_match_all('/(?getLine()); ++ $key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getTemplateLine()); + if (!$vars->hasElement($key)) { + if ('count' === $var && $this->hasNode('count')) { + $vars->addElement($this->getNode('count'), $key); + } else { +- $varExpr = new \Twig_Node_Expression_Name($var, $body->getLine()); ++ $varExpr = new \Twig_Node_Expression_Name($var, $body->getTemplateLine()); + $varExpr->setAttribute('ignore_strict_check', $ignoreStrictCheck); + $vars->addElement($varExpr, $key); + } + } + } + +- return array(new \Twig_Node_Expression_Constant(str_replace('%%', '%', trim($msg)), $body->getLine()), $vars); ++ return array(new \Twig_Node_Expression_Constant(str_replace('%%', '%', trim($msg)), $body->getTemplateLine()), $vars); + } + } +diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +index 3e85035..b226d91 100644 +--- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php ++++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +@@ -50,10 +50,10 @@ protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env) + return $node; + } else { + $var = $env->getParser()->getVarName(); +- $name = new \Twig_Node_Expression_AssignName($var, $node->getLine()); +- $this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getLine())); ++ $name = new \Twig_Node_Expression_AssignName($var, $node->getTemplateLine()); ++ $this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getTemplateLine())); + +- return new \Twig_Node_Set(false, new \Twig_Node(array($name)), new \Twig_Node(array($node->getNode('expr'))), $node->getLine()); ++ return new \Twig_Node_Set(false, new \Twig_Node(array($name)), new \Twig_Node(array($node->getNode('expr'))), $node->getTemplateLine()); + } + } + +@@ -71,7 +71,7 @@ protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env) + } else { + if (!$arguments->hasNode($ind)) { + if (!$arguments->hasNode($ind - 1)) { +- $arguments->setNode($ind - 1, new \Twig_Node_Expression_Array(array(), $node->getLine())); ++ $arguments->setNode($ind - 1, new \Twig_Node_Expression_Array(array(), $node->getTemplateLine())); + } + + $arguments->setNode($ind, $this->scope->get('domain')); +diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +index e9e65ad..fa61a2f 100644 +--- a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php ++++ b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token) + $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true); + + if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { +- throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName()); ++ throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); +diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +index 1493cf8..4c8e7d3 100644 +--- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php ++++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token) + $body = $this->parser->subparse(array($this, 'decideTransFork'), true); + + if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) { +- throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName()); ++ throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); +From b9a4586b24d671a43160cebd58f51bcc278af139 Mon Sep 17 00:00:00 2001 +From: Fabien Potencier +Date: Fri, 21 Oct 2016 18:08:29 -0700 +Subject: [PATCH] [TwigBridge] fixed Twig_Source required argument + +--- + src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php | 2 +- + src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php | 2 +- + src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php | 2 +- + src/Symfony/Bridge/Twig/Translation/TwigExtractor.php | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php +index 87b6052..9733cd7 100644 +--- a/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php ++++ b/src/Symfony/Bridge/Twig/Tests/Extension/RoutingExtensionTest.php +@@ -23,7 +23,7 @@ public function testEscaping($template, $mustBeEscaped) + $twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0)); + $twig->addExtension(new RoutingExtension($this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface'))); + +- $nodes = $twig->parse($twig->tokenize(new \Twig_Source($template))); ++ $nodes = $twig->parse($twig->tokenize(new \Twig_Source($template, ''))); + + $this->assertSame($mustBeEscaped, $nodes->getNode('body')->getNode(0)->getNode('expr') instanceof \Twig_Node_Expression_Filter); + } +diff --git a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php +index a90b556..502cad3 100644 +--- a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php ++++ b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php +@@ -25,7 +25,7 @@ public static function getModule($content) + new \Twig_Node_Expression_Array(array(), 0), + new \Twig_Node_Expression_Array(array(), 0), + null, +- new \Twig_Source('') ++ new \Twig_Source('', '') + ); + } + +diff --git a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php +index aa99132..6b6a92a 100644 +--- a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php ++++ b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php +@@ -23,7 +23,7 @@ public function testCompile($source, $expected) + { + $env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $env->addTokenParser(new FormThemeTokenParser()); +- $stream = $env->tokenize(new \Twig_Source($source)); ++ $stream = $env->tokenize(new \Twig_Source($source, '')); + $parser = new \Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); +diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +index 69ec1d9..917687a 100644 +--- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php ++++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +@@ -85,7 +85,7 @@ protected function extractTemplate($template, MessageCatalogue $catalogue) + $visitor = $this->twig->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslationNodeVisitor(); + $visitor->enable(); + +- $this->twig->parse($this->twig->tokenize(new \Twig_Source($template))); ++ $this->twig->parse($this->twig->tokenize(new \Twig_Source($template, ''))); + + foreach ($visitor->getMessages() as $message) { + $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain); +From 7b56cc08767bfaa2b1a53f211fd657a8a8328c0f Mon Sep 17 00:00:00 2001 +From: Fabien Potencier +Date: Sun, 23 Oct 2016 22:48:00 -0700 +Subject: [PATCH] removed usage of Twig_Compiler::addIndentation + +--- + src/Symfony/Bridge/Twig/Node/DumpNode.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Symfony/Bridge/Twig/Node/DumpNode.php b/src/Symfony/Bridge/Twig/Node/DumpNode.php +index a7c1529..a66781e 100644 +--- a/src/Symfony/Bridge/Twig/Node/DumpNode.php ++++ b/src/Symfony/Bridge/Twig/Node/DumpNode.php +@@ -65,7 +65,7 @@ public function compile(\Twig_Compiler $compiler) + ->write('\Symfony\Component\VarDumper\VarDumper::dump(array('."\n") + ->indent(); + foreach ($values as $node) { +- $compiler->addIndentation(); ++ $compiler->write(''); + if ($node->hasAttribute('name')) { + $compiler + ->string($node->getAttribute('name')) +From 317d46f249893dbb5b0f7b7f4acf2243d3da9127 Mon Sep 17 00:00:00 2001 +From: Fabien Potencier +Date: Fri, 21 Oct 2016 18:11:17 -0700 +Subject: [PATCH] [TwigBundle] fixed usage of getSource in tests + +--- + .../TwigBundle/Tests/Loader/FilesystemLoaderTest.php | 6 +++--- + .../TokenParser/LegacyRenderTokenParserTest.php | 2 +- + .../WebProfilerBundle/Profiler/TemplateManager.php | 6 +++++- + .../Tests/Profiler/TemplateManagerTest.php | 20 +++++++------------- + 4 files changed, 16 insertions(+), 18 deletions(-) + +diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php +index 269e029..9804c08 100644 +--- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php ++++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php +@@ -17,7 +17,7 @@ + + class FilesystemLoaderTest extends TestCase + { +- public function testGetSource() ++ public function testGetSourceContext() + { + $parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface'); + $locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); +@@ -30,10 +30,10 @@ public function testGetSource() + $loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views', 'namespace'); + + // Twig-style +- $this->assertEquals("This is a layout\n", $loader->getSource('@namespace/layout.html.twig')); ++ $this->assertEquals("This is a layout\n", $loader->getSourceContext('@namespace/layout.html.twig')->getCode()); + + // Symfony-style +- $this->assertEquals("This is a layout\n", $loader->getSource('TwigBundle::layout.html.twig')); ++ $this->assertEquals("This is a layout\n", $loader->getSourceContext('TwigBundle::layout.html.twig')->getCode()); + } + + public function testExists() +diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php +index b1f81ec..6a5806c 100644 +--- a/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php ++++ b/src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php +@@ -27,7 +27,7 @@ public function testCompile($source, $expected) + { + $env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $env->addTokenParser(new RenderTokenParser()); +- $stream = $env->tokenize(new \Twig_Source($source)); ++ $stream = $env->tokenize(new \Twig_Source($source, '')); + $parser = new \Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); +diff --git a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php +index 5d0fd27..415034a 100644 +--- a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php ++++ b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php +@@ -126,7 +126,11 @@ protected function templateExists($template) + } + + try { +- $loader->getSource($template); ++ if ($loader instanceof \Twig_SourceContextLoaderInterface) { ++ $loader->getSourceContext($template); ++ } else { ++ $loader->getSource($template); ++ } + + return true; + } catch (\Twig_Error_Loader $e) { +diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +index 29238a2..c9b199e 100644 +--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php ++++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +@@ -32,11 +32,6 @@ class TemplateManagerTest extends TestCase + protected $profiler; + + /** +- * @var \PHPUnit_Framework_MockObject_MockObject +- */ +- protected $profile; +- +- /** + * @var \Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager + */ + protected $templateManager; +@@ -129,11 +124,7 @@ public function profileHasCollectorCallback($panel) + + protected function mockProfile() + { +- $this->profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') +- ->disableOriginalConstructor() +- ->getMock(); +- +- return $this->profile; ++ return $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile')->disableOriginalConstructor()->getMock(); + } + + protected function mockTwigEnvironment() +@@ -144,9 +135,12 @@ protected function mockTwigEnvironment() + ->method('loadTemplate') + ->will($this->returnValue('loadedTemplate')); + +- $this->twigEnvironment->expects($this->any()) +- ->method('getLoader') +- ->will($this->returnValue($this->getMock('\Twig_LoaderInterface'))); ++ if (interface_exists('\Twig_SourceContextLoaderInterface')) { ++ $loader = $this->getMock('\Twig_SourceContextLoaderInterface'); ++ } else { ++ $loader = $this->getMock('\Twig_LoaderInterface'); ++ } ++ $this->twigEnvironment->expects($this->any())->method('getLoader')->will($this->returnValue($loader)); + + return $this->twigEnvironment; + } diff --git a/php-symfony.spec b/php-symfony.spec index 5fcf31f..d44c336 100644 --- a/php-symfony.spec +++ b/php-symfony.spec @@ -86,8 +86,8 @@ # instead of php-symfony-security-acl3 %global symfony_security_acl_min_ver 2.7 %global symfony_security_acl_max_ver 3.0 -# "twig/twig": "~1.26|~2.0" -%global twig_min_ver 1.26 +# "twig/twig": "~1.27|~2.0" +%global twig_min_ver 1.27 %global twig_max_ver 3.0 %if 0%{?fedora} < 21 && 0%{?rhel} < 7 @@ -106,7 +106,7 @@ Name: php-%{composer_project} Version: %{github_version} -Release: 3%{?dist} +Release: 4%{?dist} Summary: PHP framework for web projects Group: Development/Libraries @@ -114,6 +114,8 @@ License: MIT URL: http://symfony.com Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_short}.tar.gz +Patch0: %{name}-upstream.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests @@ -1753,6 +1755,8 @@ The YAML Component loads and dumps YAML files. %prep %setup -qn %{github_name}-%{github_commit} +%patch0 -p1 + : Remove unnecessary files find src -name '.git*' -delete @@ -2686,6 +2690,9 @@ exit $RET # ############################################################################## %changelog +* Wed Oct 26 2016 Remi Collet - 2.8.12-4 +- add upstream patch for Twig 1.27 + * Tue Oct 25 2016 Remi Collet - 2.8.12-3 - fix autoloader -- cgit