From 84f5de902d0dedfa94f70a1e65124f2bbdd6400c Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 28 May 2017 19:55:48 -0400 Subject: [PATCH 1/7] mix attr options between type-guess options and user options --- src/Symfony/Component/Form/FormFactory.php | 8 +++++++- src/Symfony/Component/Form/Tests/FormFactoryTest.php | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php index ca228ba31db79..34e3666dbd563 100644 --- a/src/Symfony/Component/Form/FormFactory.php +++ b/src/Symfony/Component/Form/FormFactory.php @@ -126,7 +126,13 @@ public function createBuilderForProperty($class, $property, $data = null, array // user options may override guessed options if ($typeGuess) { - $options = array_merge($typeGuess->getOptions(), $options); + $attrs = array(); + $typeGuessOptions = $typeGuess->getOptions(); + if (isset($typeGuessOptions['attr']) && isset($options['attr'])) { + $attrs = array('attr' => array_merge($typeGuessOptions['attr'], $options['attr'])); + } + + $options = array_merge($typeGuessOptions, $options, $attrs); } return $this->createNamedBuilder($property, $type, $data, $options); diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 4185a4a0025d2..2fcb33bc3ecdb 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -450,7 +450,7 @@ public function testOptionsCanBeOverridden() ->with('Application\Author', 'firstName') ->will($this->returnValue(new TypeGuess( 'text', - array('attr' => array('maxlength' => 10)), + array('attr' => array('class' => 'foo', 'maxlength' => 10)), Guess::MEDIUM_CONFIDENCE ))); @@ -458,7 +458,7 @@ public function testOptionsCanBeOverridden() $factory->expects($this->once()) ->method('createNamedBuilder') - ->with('firstName', 'text', null, array('attr' => array('maxlength' => 11))) + ->with('firstName', 'text', null, array('attr' => array('class' => 'foo', 'maxlength' => 11))) ->will($this->returnValue('builderInstance')); $this->builder = $factory->createBuilderForProperty( From 6dbdb1b750509264dd8061231f2491cb9ad7cd9a Mon Sep 17 00:00:00 2001 From: Oleg Voronkovich Date: Tue, 30 May 2017 20:42:15 +0300 Subject: [PATCH 2/7] [DependencyInjection] Use more clear message when unused environment variables detected --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 2 +- .../DependencyInjection/Exception/EnvParameterException.php | 4 ++-- .../DependencyInjection/Tests/Dumper/PhpDumperTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 4431418d85848..dd514962ea47c 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -166,7 +166,7 @@ public function dump(array $options = array()) } } if ($unusedEnvs) { - throw new EnvParameterException($unusedEnvs); + throw new EnvParameterException($unusedEnvs, null, 'Environment variables "%s" are never used. Please, check your container\'s configuration.'); } return $code; diff --git a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php index 44dbab45b6284..3839a4633be40 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php @@ -18,8 +18,8 @@ */ class EnvParameterException extends InvalidArgumentException { - public function __construct(array $usedEnvs, \Exception $previous = null) + public function __construct(array $envs, \Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') { - parent::__construct(sprintf('Incompatible use of dynamic environment variables "%s" found in parameters.', implode('", "', $usedEnvs)), 0, $previous); + parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 2ad701aa6d327..ee81219ef01d0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -302,7 +302,7 @@ public function testEnvParameter() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException - * @expectedExceptionMessage Incompatible use of dynamic environment variables "FOO" found in parameters. + * @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration. */ public function testUnusedEnvParameter() { From 405f64bb0143516475d087d0ae23c7f2fcd9c76f Mon Sep 17 00:00:00 2001 From: Martin Kirilov Date: Mon, 5 Jun 2017 03:15:00 +0300 Subject: [PATCH 3/7] [Cache] MemcachedAdapter not working with TagAwareAdapter It seems that when MemcachedAdapter is used with TagAwareAdapter, it fails to fetch items, even though I thoroughly tested fetching items with the exact same keys under the same namespace. Turns out the issue lies in `const TAGS_PREFIX = "\0tags\0";` for unknown to me reasons. Hardcoding that to '__tags__' in my project did the trick and I've been using it for a couple of days now and it seems fine. The reason I had to completely copy/paste this file in my local project is self:: instead of static:: usage. I am not sure whether that is a mistake or is done on purpose, but in order to have this work for me I need to be able to override that constant. Going with static:: seems like a good solution to me, then I can set whatever prefix I need for the tags. --- src/Symfony/Component/Cache/Adapter/AbstractAdapter.php | 3 +++ src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 4a788963ea74b..b5f6a61b56b03 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -426,6 +426,9 @@ private function generateItems($items, &$keys) try { foreach ($items as $id => $value) { + if (!isset($keys[$id])) { + $id = key($keys); + } $key = $keys[$id]; unset($keys[$id]); yield $key => $f($key, $value, true); diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index b8c4a08021b70..03ed203bec9cc 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -261,7 +261,7 @@ private function generateItems($items, array $tagKeys) foreach ($items as $key => $item) { if (!$tagKeys) { - yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; + yield $key => isset($invalidKeys[static::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; continue; } if (!isset($tagKeys[$key])) { @@ -287,7 +287,7 @@ private function generateItems($items, array $tagKeys) $itemTags = $tagVersions = $tagKeys = null; foreach ($bufferedItems as $key => $item) { - yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; + yield $key => isset($invalidKeys[static::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; } $bufferedItems = null; } From 25df7a19a8a7c3cd072bb5db058a42b1c7cc2c0d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 5 Jun 2017 11:41:08 -0700 Subject: [PATCH 4/7] bumped Symfony version to 3.3.2 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index b9a95ac99dbe2..85c7b2720184b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.1'; - const VERSION_ID = 30301; + const VERSION = '3.3.2-DEV'; + const VERSION_ID = 30302; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; - const RELEASE_VERSION = 1; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 2; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From a1cdc2d46e894d123c527bf204f18d4675163335 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Mon, 5 Jun 2017 22:05:32 +0200 Subject: [PATCH 5/7] [TwigBridge] Fix namespaced classes --- .../NodeVisitor/TranslationDefaultDomainNodeVisitor.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index c69ca843e83ea..b3c89d18eb2bd 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -14,6 +14,7 @@ use Symfony\Bridge\Twig\Node\TransNode; use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; use Twig\Environment; +use Twig\Node\BlockNode; use Twig\Node\Expression\ArrayExpression; use Twig\Node\Expression\AssignNameExpression; use Twig\Node\Expression\ConstantExpression; @@ -21,6 +22,7 @@ use Twig\Node\Expression\NameExpression; use Twig\Node\ModuleNode; use Twig\Node\Node; +use Twig\Node\SetNode; use Twig\NodeVisitor\AbstractNodeVisitor; /** @@ -48,7 +50,7 @@ public function __construct() */ protected function doEnterNode(Node $node, Environment $env) { - if ($node instanceof Node_Block || $node instanceof ModuleNode) { + if ($node instanceof BlockNode || $node instanceof ModuleNode) { $this->scope = $this->scope->enter(); } @@ -62,7 +64,7 @@ protected function doEnterNode(Node $node, Environment $env) $name = new AssignNameExpression($var, $node->getTemplateLine()); $this->scope->set('domain', new NameExpression($var, $node->getTemplateLine())); - return new Node_Set(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine()); + return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine()); } } @@ -104,7 +106,7 @@ protected function doLeaveNode(Node $node, Environment $env) return false; } - if ($node instanceof Node_Block || $node instanceof ModuleNode) { + if ($node instanceof BlockNode || $node instanceof ModuleNode) { $this->scope = $this->scope->leave(); } From c1a645596536d5d2476be3070440319a9c37a163 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 5 Jun 2017 20:59:50 -0700 Subject: [PATCH 6/7] updated CHANGELOG for 3.3.2 --- CHANGELOG-3.3.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index 8a6626da32d0f..6c3cb3540ff0c 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -7,6 +7,13 @@ in 3.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1 +* 3.3.2 (2017-06-06) + + * bug #23073 [TwigBridge] Fix namespaced classes (ogizanagi) + * bug #23063 [Cache] Fix extensibility of TagAwareAdapter::TAGS_PREFIX (wucdbm) + * bug #22936 [Form] Mix attr option between guessed options and user options (yceruto) + * bug #22976 [DependencyInjection] Use more clear message when unused environment variables detected (voronkovich) + * 3.3.1 (2017-06-05) * bug #23067 [HttpFoundation][FrameworkBundle] Revert "trusted proxies" BC break (nicolas-grekas) From adf3a020e00f7e10b6c42808277efbeb972c7c22 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 5 Jun 2017 20:59:58 -0700 Subject: [PATCH 7/7] updated VERSION for 3.3.2 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 85c7b2720184b..0cab79884c08c 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.2-DEV'; + const VERSION = '3.3.2'; const VERSION_ID = 30302; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 2; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018';