From de4f8ac21d8d4d573fecca1748d84bb08b1eb079 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 28 Oct 2017 17:03:09 +0200 Subject: [PATCH 01/85] Added instructions to upgrade Symfony applications to 4.x --- UPGRADE-4.0.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index b1bfc214837a4..5daf146ed929e 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -1,6 +1,40 @@ UPGRADE FROM 3.x to 4.0 ======================= +Symfony Framework +----------------- + +The first step to upgrade a Symfony 3.x application to 4.x is to update the +file and directory structure of your application: + +| Symfony 3.x | Symfony 4.x +| ----------------------------------- | -------------------------------- +| `app/config/` | `config/` +| `app/config/*.yml` | `config/*.yaml` and `config/packages/*.yaml` +| `app/config/parameters.yml.dist` | `config/services.yaml` and `.env.dist` +| `app/config/parameters.yml` | `config/services.yaml` and `.env` +| `app/Resources//views/` | `templates/bundles//` +| `app/Resources/` | `src/Resources/` +| `app/Resources/assets/` | `assets/` +| `app/Resources/translations/` | `translations/` +| `app/Resources/views/` | `templates/` +| `src/AppBundle/` | `src/` +| `var/logs/` | `var/log/` +| `web/` | `public/` +| `web/app.php` | `public/index.php` +| `web/app_dev.php` | `public/index.php` + +Then, upgrade the contents of your console script and your front controller: + +* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/3.3/bin/console +* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php + +Lastly, read the following article to add Symfony Flex to your application and +upgrade the configuration files: https://symfony.com/doc/current/setup/flex.html + +If you use Symfony components instead of the whole framework, you can find below +the upgrading instructions for each individual bundle and component. + ClassLoader ----------- From aca0ddd9d6911312db325ae294809fc4e8ea1ad3 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Sun, 19 Nov 2017 15:02:29 +1000 Subject: [PATCH 02/85] Add suggestions --- src/Symfony/Bridge/Monolog/composer.json | 3 ++- .../Bundle/WebServerBundle/Command/ServerLogCommand.php | 6 ++++++ src/Symfony/Bundle/WebServerBundle/composer.json | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 23240155d267f..51e0a7c8032ab 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -31,7 +31,8 @@ "suggest": { "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", - "symfony/event-dispatcher": "Needed when using log messages in console commands." + "symfony/event-dispatcher": "Needed when using log messages in console commands.", + "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." }, "autoload": { "psr-4": { "Symfony\\Bridge\\Monolog\\": "" }, diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php index eed32c5a2055f..5cef9e36d00b7 100644 --- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php +++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebServerBundle\Command; +use Monolog\Formatter\FormatterInterface; use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; use Symfony\Bridge\Monolog\Handler\ConsoleHandler; use Symfony\Component\Console\Command\Command; @@ -35,6 +36,11 @@ public function isEnabled() return false; } + // based on a symfony/symfony package, it crashes due a missing FormatterInterface from monolog/monolog + if (!class_exists(FormatterInterface::class)) { + return false; + } + return parent::isEnabled(); } diff --git a/src/Symfony/Bundle/WebServerBundle/composer.json b/src/Symfony/Bundle/WebServerBundle/composer.json index d1c64e970fcca..c48607bca475b 100644 --- a/src/Symfony/Bundle/WebServerBundle/composer.json +++ b/src/Symfony/Bundle/WebServerBundle/composer.json @@ -30,6 +30,10 @@ "conflict": { "symfony/dependency-injection": "<3.3" }, + "suggest": { + "symfony/monolog-bridge": "For using the log server.", + "symfony/expression-language": "For using the filter option of the log server." + }, "minimum-stability": "dev", "extra": { "branch-alias": { From c5af7fd9386826687cc5a9cdf4e642cb27e53c0f Mon Sep 17 00:00:00 2001 From: Julien Falque Date: Thu, 30 Nov 2017 23:00:30 +0100 Subject: [PATCH 03/85] Fix hidden currency element with Bootstrap 3 theme --- .../views/Form/bootstrap_3_layout.html.twig | 23 +++++++++++-------- .../Tests/AbstractBootstrap3LayoutTest.php | 19 +++++++++++++++ .../Extension/Core/Type/MoneyTypeTest.php | 10 +++++++- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 2efc0c4d4a213..5e963890d8171 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -20,16 +20,21 @@ {%- endblock %} {% block money_widget -%} -
- {% set append = money_pattern starts with '{{' %} - {% if not append %} - {{ money_pattern|replace({ '{{ widget }}':''}) }} - {% endif %} + {% set prepend = not (money_pattern starts with '{{') %} + {% set append = not (money_pattern ends with '}}') %} + {% if prepend or append %} +
+ {% if prepend %} + {{ money_pattern|replace({ '{{ widget }}':''}) }} + {% endif %} + {{- block('form_widget_simple') -}} + {% if append %} + {{ money_pattern|replace({ '{{ widget }}':''}) }} + {% endif %} +
+ {% else %} {{- block('form_widget_simple') -}} - {% if append %} - {{ money_pattern|replace({ '{{ widget }}':''}) }} - {% endif %} -
+ {% endif %} {%- endblock money_widget %} {% block percent_widget -%} diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php index 5e5c8be680e7e..8d9b11d39a401 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php @@ -1899,6 +1899,25 @@ public function testMoney() ); } + public function testMoneyWithoutCurrency() + { + $form = $this->factory->createNamed('name', 'money', 1234.56, array( + 'currency' => false, + )); + + $this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')), +'/input + [@id="my&id"] + [@type="text"] + [@name="name"] + [@class="my&class form-control"] + [@value="1234.56"] + [not(preceding-sibling::*)] + [not(following-sibling::*)] +' + ); + } + public function testNumber() { $form = $this->factory->createNamed('name', 'number', 1234.56); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php index 4f97d75f972bc..8d788144ea9b8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php @@ -43,7 +43,7 @@ public function testMoneyPatternWorksForYen() $view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => 'JPY')) ->createView(); - $this->assertTrue((bool) strstr($view->vars['money_pattern'], '¥')); + $this->assertSame('¥ {{ widget }}', $view->vars['money_pattern']); } // https://github.com/symfony/symfony/issues/5458 @@ -62,4 +62,12 @@ public function testSubmitNull($expected = null, $norm = null, $view = null) { parent::testSubmitNull($expected, $norm, ''); } + + public function testMoneyPatternWithoutCurrency() + { + $view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => false)) + ->createView(); + + $this->assertSame('{{ widget }}', $view->vars['money_pattern']); + } } From 4ff9d99f23fa4b8061983a93d1937d8ad05aa682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 4 Dec 2017 17:28:00 +0100 Subject: [PATCH 04/85] [Serializer] Unset attributes when creating child context --- .../Serializer/Normalizer/AbstractNormalizer.php | 2 ++ .../Tests/Normalizer/ObjectNormalizerTest.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index c1e621fe90baf..c8b9bdac7d196 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -402,6 +402,8 @@ protected function createChildContext(array $parentContext, $attribute) { if (isset($parentContext[self::ATTRIBUTES][$attribute])) { $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute]; + } else { + unset($parentContext[self::ATTRIBUTES]); } return $parentContext; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 9407fdf52d7b0..b8a628f0f863c 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -673,6 +673,16 @@ public function testAttributesContextNormalize() ), $serializer->normalize($objectDummy, null, $context) ); + + $context = array('attributes' => array('foo', 'baz', 'object')); + $this->assertEquals( + array( + 'foo' => 'foo', + 'baz' => true, + 'object' => array('foo' => 'innerFoo', 'bar' => 'innerBar'), + ), + $serializer->normalize($objectDummy, null, $context) + ); } public function testAttributesContextDenormalize() From 3d5380b6c4cae396f79724fd9f5f505981ba51a3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 12:39:56 -0800 Subject: [PATCH 05/85] updated CHANGELOG for 2.7.39 --- CHANGELOG-2.7.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index 7ac65a77371f6..916ce96ddb47b 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,20 @@ in 2.7 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/v2.7.0...v2.7.1 +* 2.7.39 (2017-12-04) + + * bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos) + * bug #25236 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto) + * bug #25258 [link] Prevent warnings when running link with 2.7 (dunglas) + * bug #24750 [Validator] ExpressionValidator should use OBJECT_TO_STRING (Simperfit) + * bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze) + * bug #25152 [Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType (issei-m) + * bug #24987 [Console] Fix global console flag when used in chain (Simperfit) + * bug #25043 [Yaml] added ability for substitute aliases when mapping is on single line (Michał Strzelecki, xabbuh) + * bug #25102 [Form] Fixed ContextErrorException in FileType (chihiro-adachi) + * bug #25130 [DI] Fix handling of inlined definitions by ContainerBuilder (nicolas-grekas) + * bug #24956 Fix ambiguous pattern (weltling) + * 2.7.38 (2017-11-16) * security #24995 Validate redirect targets using the session cookie domain (nicolas-grekas) From 963d72c5f013812ad0fd57a47eb8510d9e0c2fd4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 12:40:02 -0800 Subject: [PATCH 06/85] update CONTRIBUTORS for 2.7.39 --- CONTRIBUTORS.md | 51 +++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0f3e9c22adf2d..30d8ae3f828ed 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -14,8 +14,8 @@ Symfony is the result of the work of many people who made the code better - Victor Berchet (victor) - Johannes S (johannes) - Jakub Zalas (jakubzalas) - - Kris Wallsmith (kriswallsmith) - Kévin Dunglas (dunglas) + - Kris Wallsmith (kriswallsmith) - Ryan Weaver (weaverryan) - Javier Eguiluz (javier.eguiluz) - Maxime Steinhausser (ogizanagi) @@ -29,8 +29,8 @@ Symfony is the result of the work of many people who made the code better - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - - Martin Hasoň (hason) - Roland Franssen (ro0) + - Martin Hasoň (hason) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) @@ -52,24 +52,24 @@ Symfony is the result of the work of many people who made the code better - Peter Rehm (rpet) - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) + - Yonel Ceruto (yonelceruto) - Miha Vrhovnik - Matthias Pigulla (mpdude) - Diego Saint Esteben (dii3g0) - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - - Yonel Ceruto (yonelceruto) - - Dany Maillard (maidmaid) - Kevin Bond (kbond) + - Dany Maillard (maidmaid) + - Pierre du Plessis (pierredup) - Florin Patan (florinpatan) - Jérémy DERUSSÉ (jderusse) - - Pierre du Plessis (pierredup) - Gábor Egyed (1ed) - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) + - Alexander M. Turek (derrabus) - Eric Clemmons (ericclemmons) - Jáchym Toušek (enumag) - Charles Sarrazin (csarrazi) - - Alexander M. Turek (derrabus) - Konstantin Myakshin (koc) - Christian Raue - Arnout Boks (aboks) @@ -79,6 +79,7 @@ Symfony is the result of the work of many people who made the code better - Titouan Galopin (tgalopin) - Douglas Greenshields (shieldo) - Tobias Nyholm (tobias) + - Issei Murasawa (issei_m) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) @@ -91,13 +92,14 @@ Symfony is the result of the work of many people who made the code better - John Wards (johnwards) - Dariusz Ruminski - Fran Moreno (franmomu) - - Issei Murasawa (issei_m) - Antoine Hérault (herzult) - Paráda József (paradajozsef) - Arnaud Le Blanc (arnaud-lb) - Maxime STEINHAUSSER - Michal Piotrowski (eventhorizon) + - Samuel ROZE (sroze) - Tim Nagel (merk) + - Amrouche Hamza (simperfit) - Brice BERNARD (brikou) - Baptiste Clavié (talus) - Vladimir Reznichenko (kalessil) @@ -126,6 +128,7 @@ Symfony is the result of the work of many people who made the code better - Sebastiaan Stok (sstok) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) + - Grégoire Paris (greg0ire) - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) - Tigran Azatyan (tigranazatyan) @@ -135,7 +138,6 @@ Symfony is the result of the work of many people who made the code better - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) - - Grégoire Paris (greg0ire) - Andréia Bohner (andreia) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) @@ -149,6 +151,7 @@ Symfony is the result of the work of many people who made the code better - Vyacheslav Pavlov - Richard van Laak (rvanlaak) - Javier Spagnoletti (phansys) + - Julien Falque (julienfalque) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Rouven Weßling (realityking) @@ -160,7 +163,6 @@ Symfony is the result of the work of many people who made the code better - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Dawid Nowak - - Julien Falque (julienfalque) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba @@ -171,8 +173,6 @@ Symfony is the result of the work of many people who made the code better - Warnar Boekkooi (boekkooi) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - - Amrouche Hamza - - Samuel ROZE (sroze) - Daniel Espendiller - Possum - Dorian Villet (gnutix) @@ -190,6 +190,7 @@ Symfony is the result of the work of many people who made the code better - Stepan Anchugov (kix) - bronze1man - sun (sun) + - Valentin Udaltsov (vudaltsov) - Larry Garfield (crell) - Martin Schuhfuß (usefulthink) - apetitpa @@ -248,7 +249,6 @@ Symfony is the result of the work of many people who made the code better - Pierre-Yves LEBECQ (pylebecq) - Jordan Samouh (jordansamouh) - Jakub Kucharovic (jkucharovic) - - Valentin Udaltsov (vudaltsov) - Uwe Jäger (uwej711) - Eugene Leonovich (rybakit) - Filippo Tessarotto @@ -261,6 +261,7 @@ Symfony is the result of the work of many people who made the code better - Nikolay Labinskiy (e-moe) - Leo Feyer - Chekote + - gadelat (gadelat) - Thomas Adam - Albert Casademont (acasademont) - Jhonny Lidfors (jhonne) @@ -299,8 +300,8 @@ Symfony is the result of the work of many people who made the code better - Thomas Tourlourat (armetiz) - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) + - Jerzy Zawadzki (jzawadzki) - Ismael Ambrosi (iambrosi) - - gadelat (gadelat) - Baptiste Lafontaine - Aurelijus Valeiša (aurelijus) - Victor Bocharsky (bocharsky_bw) @@ -345,6 +346,7 @@ Symfony is the result of the work of many people who made the code better - Yaroslav Kiliba - Terje Bråten - Robbert Klarenbeek (robbertkl) + - Edi Modrić (emodric) - Thomas Calvet (fancyweb) - Niels Keurentjes (curry684) - JhonnyL @@ -364,7 +366,6 @@ Symfony is the result of the work of many people who made the code better - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) - Vyacheslav Salakhutdinov (megazoll) - - Jerzy Zawadzki (jzawadzki) - Hassan Amouhzi - Tamas Szijarto - Pavel Volokitin (pvolok) @@ -375,6 +376,7 @@ Symfony is the result of the work of many people who made the code better - Tobias Naumann (tna) - Daniel Beyer - Shein Alexey + - Alex Rock Ancelet (pierstoval) - Romain Gautier (mykiwi) - Joe Lencioni - Daniel Tschinder @@ -434,7 +436,6 @@ Symfony is the result of the work of many people who made the code better - cedric lombardot (cedriclombardot) - Jonas Flodén (flojon) - Thomas Perez (scullwm) - - Edi Modrić (emodric) - Marcin Sikoń (marphi) - Dominik Zogg (dominik.zogg) - Marek Pietrzak @@ -446,6 +447,7 @@ Symfony is the result of the work of many people who made the code better - Rob Bast - Zander Baldwin - Adam Harvey + - Anton Bakai - Maxime Veber (nek-) - Alex Bakhturin - Yanick Witschi (toflar) @@ -495,7 +497,6 @@ Symfony is the result of the work of many people who made the code better - Arjen van der Meijden - Michele Locati - Dariusz Ruminski - - Alex Rock Ancelet (pierstoval) - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - Almog Baku (almogbaku) @@ -619,7 +620,6 @@ Symfony is the result of the work of many people who made the code better - Catalin Dan - Stephan Vock - Benjamin Zikarsky (bzikarsky) - - Anton Bakai - Simon Schick (simonsimcity) - redstar504 - Tristan Roussel @@ -711,8 +711,10 @@ Symfony is the result of the work of many people who made the code better - Nikita Nefedov (nikita2206) - cgonzalez - Ben + - Mathieu Lechat - Vincent Composieux (eko) - Jayson Xu (superjavason) + - Christopher Hertel (chertel) - Hubert Lenoir (hubert_lenoir) - Jaik Dean (jaikdean) - fago @@ -733,6 +735,7 @@ Symfony is the result of the work of many people who made the code better - Pierre Vanliefland (pvanliefland) - Sofiane HADDAG (sofhad) - frost-nzcr4 + - Bozhidar Hristov - Abhoryo - Fabian Vogler (fabian) - Korvin Szanto @@ -763,6 +766,7 @@ Symfony is the result of the work of many people who made the code better - Fabien LUCAS (flucas2) - Jörn Lang (j.lang) - Omar Yepez (oyepez003) + - Gawain Lynch (gawain) - mwsaz - Jelle Kapitein - Benoît Bourgeois @@ -925,6 +929,7 @@ Symfony is the result of the work of many people who made the code better - Christian - Denis Golubovskiy (bukashk0zzz) - Sergii Smertin (nfx) + - Michał Strzelecki - hugofonseca (fonsecas72) - Martynas Narbutas - Bailey Parker @@ -1002,6 +1007,7 @@ Symfony is the result of the work of many people who made the code better - Brooks Boyd - Roger Webb - Dmitriy Simushev + - pkowalczyk - Max Voloshin (maxvoloshin) - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) @@ -1127,6 +1133,7 @@ Symfony is the result of the work of many people who made the code better - Max Summe - WedgeSama - Felds Liscia + - Chihiro Adachi (chihiro-adachi) - Sullivan SENECHAL - Tadcka - Beth Binkovitz @@ -1283,6 +1290,7 @@ Symfony is the result of the work of many people who made the code better - nuncanada - flack - František Bereň + - Jeremiah VALERIE - Mike Francis - Christoph Nissle (derstoffel) - Ionel Scutelnicu (ionelscutelnicu) @@ -1305,6 +1313,7 @@ Symfony is the result of the work of many people who made the code better - Andrew Zhilin (zhil) - Oleksii Zhurbytskyi - Andy Stanberry + - Felix Marezki - Luiz “Felds” Liscia - Thomas Rothe - nietonfir @@ -1352,7 +1361,6 @@ Symfony is the result of the work of many people who made the code better - Nicole Cordes - Martin Kirilov - Bram Van der Sype (brammm) - - Christopher Hertel (chertel) - Guile (guile) - Julien Moulin (lizjulien) - Mauro Foti (skler) @@ -1386,7 +1394,6 @@ Symfony is the result of the work of many people who made the code better - Bertalan Attila - Yannick Bensacq (cibou) - Freek Van der Herten (freekmurze) - - Gawain Lynch (gawain) - Luca Genuzio (genuzio) - Hans Nilsson (hansnilsson) - Andrew Marcinkevičius (ifdattic) @@ -1444,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better - David Windell - Gabriel Birke - skafandri + - Derek Bonner - Alan Chen - Maerlyn - Even André Fiskvik @@ -1487,6 +1495,7 @@ Symfony is the result of the work of many people who made the code better - Ian Jenkins (jenkoian) - Jorge Martin (jorgemartind) - Joeri Verdeyen (jverdeyen) + - Dmitrii Poddubnyi (karser) - Kevin Verschaeve (keversc) - Kevin Herrera (kherge) - Luis Ramón López López (lrlopez) @@ -1500,6 +1509,7 @@ Symfony is the result of the work of many people who made the code better - Jimmy Leger (redpanda) - Marcin Szepczynski (szepczynski) - Cyrille Jouineau (tuxosaurus) + - Vladimir Chernyshev (volch) - Yorkie Chadwick (yorkie76) - GuillaumeVerdon - Ondrej Mirtes @@ -1582,9 +1592,11 @@ Symfony is the result of the work of many people who made the code better - Michael Schneider - Cédric Bertolini - n-aleha + - Anatol Belski - Şəhriyar İmanov - Kaipi Yann - Sam Williams + - Guillaume Aveline - Adrian Philipp - James Michael DuPont - Kasperki @@ -1744,6 +1756,7 @@ Symfony is the result of the work of many people who made the code better - Schuyler Jager (sjager) - Pascal Luna (skalpa) - Volker (skydiablo) + - Serkan Yildiz (srknyldz) - Julien Sanchez (sumbobyboys) - Guillermo Gisinger (t3chn0r) - Markus Tacker (tacker) From c7f09523e4739bc76ee06e7af2fce42749158a5a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 12:40:11 -0800 Subject: [PATCH 07/85] updated VERSION for 2.7.39 --- 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 466e01b172ecb..47c3fd69c73f1 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.39-DEV'; + const VERSION = '2.7.39'; const VERSION_ID = 20739; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 39; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 2c3344b8b72f0202d671c0abeccb73669f1539a8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 13:53:49 -0800 Subject: [PATCH 08/85] bumped Symfony version to 2.7.40 --- 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 47c3fd69c73f1..5ff8305d34786 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.39'; - const VERSION_ID = 20739; + const VERSION = '2.7.40-DEV'; + const VERSION_ID = 20740; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 39; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 40; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 67eb592d0e664bc72706f351a1b5b1dddbc54b49 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 14:02:09 -0800 Subject: [PATCH 09/85] updated CHANGELOG for 2.8.32 --- CHANGELOG-2.8.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 626c310af437f..2e8fc7e47079d 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,21 @@ in 2.8 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/v2.8.0...v2.8.1 +* 2.8.32 (2017-12-04) + + * bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos) + * bug #25236 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto) + * bug #25258 [link] Prevent warnings when running link with 2.7 (dunglas) + * bug #24750 [Validator] ExpressionValidator should use OBJECT_TO_STRING (Simperfit) + * bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze) + * bug #25152 [Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType (issei-m) + * bug #24987 [Console] Fix global console flag when used in chain (Simperfit) + * bug #25043 [Yaml] added ability for substitute aliases when mapping is on single line (Michał Strzelecki, xabbuh) + * bug #25102 [Form] Fixed ContextErrorException in FileType (chihiro-adachi) + * bug #25130 [DI] Fix handling of inlined definitions by ContainerBuilder (nicolas-grekas) + * bug #25072 [Bridge/PhpUnit] Remove trailing "\n" from ClockMock::microtime(false) (joky) + * bug #24956 Fix ambiguous pattern (weltling) + * 2.8.31 (2017-11-16) * security #24995 Validate redirect targets using the session cookie domain (nicolas-grekas) From 525b5ff9765acd73fe01fb2558b64cc31c57e313 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 14:02:14 -0800 Subject: [PATCH 10/85] updated VERSION for 2.8.32 --- 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 0bfec287a98b3..6ec30910cba15 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.32-DEV'; + const VERSION = '2.8.32'; const VERSION_ID = 20832; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 32; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From e8b5aa1cd13e39ce617b28cbc21aae6df27706e9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 14:24:43 -0800 Subject: [PATCH 11/85] bumped Symfony version to 2.8.33 --- 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 6ec30910cba15..67ae1cb8d698b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.32'; - const VERSION_ID = 20832; + const VERSION = '2.8.33-DEV'; + const VERSION_ID = 20833; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 32; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 33; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From b1a1a8fb5c121087d5d1268021386641e97d7559 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 14:26:15 -0800 Subject: [PATCH 12/85] updated CHANGELOG for 3.3.14 --- CHANGELOG-3.3.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index 310284444011e..eeb42846f5f5e 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -7,6 +7,41 @@ 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.14 (2017-12-04) + + * bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox) + * bug #25308 [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash (Simperfit) + * bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos) + * bug #25305 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto) + * bug #25236 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto) + * bug #25312 [DI] Fix deep-inlining of non-shared refs (nicolas-grekas) + * bug #25309 [Yaml] parse newlines in quoted multiline strings (xabbuh) + * bug #25241 [Yaml] do not eagerly filter comment lines (xabbuh) + * bug #25258 [link] Prevent warnings when running link with 2.7 (dunglas) + * bug #24750 [Validator] ExpressionValidator should use OBJECT_TO_STRING (Simperfit) + * bug #25232 [WebProfilerBundle] [TwigBundle] Fix Profiler breaking XHTML pages (tistre) + * bug #25209 [VarDumper] Dont use empty(), it chokes on eg GMP objects (nicolas-grekas) + * bug #25200 [HttpKernel] Arrays with scalar values passed to ESI fragment renderer throw deprecation notice (Simperfit) + * bug #25217 [Dotenv] Changed preg_match flags from null to 0 (deekthesqueak) + * bug #25203 [DI] Fix infinite loop in InlineServiceDefinitionsPass (nicolas-grekas) + * bug #25185 [Serializer] Do not cache attributes if `attributes` in context (sroze) + * bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze) + * bug #25179 [FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed (ogizanagi) + * bug #25163 [DI] Fix tracking of env vars in exceptions (nicolas-grekas) + * bug #25152 [Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType (issei-m) + * bug #24987 [Console] Fix global console flag when used in chain (Simperfit) + * bug #25146 [DI] Dont resolve envs in service ids (nicolas-grekas) + * bug #25113 [Routing] Fix "config-file-relative" annotation loader resources (nicolas-grekas, sroze) + * bug #25109 Make debug:container search command case-insensitive (jzawadzki) + * bug #25043 [Yaml] added ability for substitute aliases when mapping is on single line (Michał Strzelecki, xabbuh) + * bug #25102 [Form] Fixed ContextErrorException in FileType (chihiro-adachi) + * bug #25130 [DI] Fix handling of inlined definitions by ContainerBuilder (nicolas-grekas) + * bug #25094 [FrameworkBundle][DX] Display a nice error message if an enabled component is missing (derrabus) + * bug #25097 [Bridge\PhpUnit] Turn "preserveGlobalState" to false by default, revert "Blacklist" removal (nicolas-grekas) + * bug #25072 [Bridge/PhpUnit] Remove trailing "\n" from ClockMock::microtime(false) (joky) + * bug #25032 [Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit (nicolas-grekas) + * bug #24956 Fix ambiguous pattern (weltling) + * 3.3.13 (2017-11-16) * security #24995 Validate redirect targets using the session cookie domain (nicolas-grekas) From 4965ef5311c284aa4b5a23094239f976b836a99a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 14:26:28 -0800 Subject: [PATCH 13/85] updated VERSION for 3.3.14 --- 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 711f410e0d654..d904460cf4f42 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.14-DEV'; + const VERSION = '3.3.14'; const VERSION_ID = 30314; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 14; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From b78360262268060d74b095e387d8bbcb7694c449 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 15:02:34 -0800 Subject: [PATCH 14/85] bumped Symfony version to 3.3.15 --- 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 d904460cf4f42..42d176612e64e 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.14'; - const VERSION_ID = 30314; + const VERSION = '3.3.15-DEV'; + const VERSION_ID = 30315; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; - const RELEASE_VERSION = 14; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 15; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From 22a6a7e4c5858d3d34267af740f08438451b194b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Dec 2017 16:17:08 -0800 Subject: [PATCH 15/85] bumped Symfony version to 3.4.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 743140dab0ed3..39fe4228b3cb2 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.1'; - const VERSION_ID = 30401; + const VERSION = '3.4.2-DEV'; + const VERSION_ID = 30402; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 1; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 2; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 3b910a9fadc0c63991b03b51b6ac39e72603fde0 Mon Sep 17 00:00:00 2001 From: Roman Orlov Date: Tue, 5 Dec 2017 17:56:53 +1000 Subject: [PATCH 16/85] [Serializer] improved CsvEncoder::decode performance by caching duplicate count calls --- src/Symfony/Component/Serializer/Encoder/CsvEncoder.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php b/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php index df0207ccf30fb..cce2c14af1f55 100644 --- a/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php @@ -115,6 +115,7 @@ public function decode($data, $format, array $context = array()) $headers = null; $nbHeaders = 0; + $headerCount = array(); $result = array(); list($delimiter, $enclosure, $escapeChar, $keySeparator) = $this->getCsvOptions($context); @@ -126,7 +127,9 @@ public function decode($data, $format, array $context = array()) $nbHeaders = $nbCols; foreach ($cols as $col) { - $headers[] = explode($keySeparator, $col); + $header = explode($keySeparator, $col); + $headers[] = $header; + $headerCount[] = count($header); } continue; @@ -134,7 +137,7 @@ public function decode($data, $format, array $context = array()) $item = array(); for ($i = 0; ($i < $nbCols) && ($i < $nbHeaders); ++$i) { - $depth = count($headers[$i]); + $depth = $headerCount[$i]; $arr = &$item; for ($j = 0; $j < $depth; ++$j) { // Handle nested arrays From 956287be72f10d785716f8e9ed45d1bf796e1cb2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Dec 2017 06:42:45 +0100 Subject: [PATCH 17/85] do not evaluate PHP constant names PHP constant identifiers must be strings anyway. Thus, we only need to parse quoted strings, but do not have to evaluate the data types. --- src/Symfony/Component/Yaml/Inline.php | 3 ++- src/Symfony/Component/Yaml/Tests/InlineTest.php | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 0ef43f786b01a..c8ded6d21ca52 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -707,7 +707,8 @@ private static function evaluateScalar($scalar, $flags, $references = array()) return; case 0 === strpos($scalar, '!php/const'): if (self::$constantSupport) { - if (defined($const = self::parseScalar(substr($scalar, 11)))) { + $i = 0; + if (defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) { return constant($const); } diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 815c694b37abb..48fd70a3a182e 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -58,6 +58,7 @@ public function getTestsForParsePhpConstants() array('!php/const PHP_INT_MAX', PHP_INT_MAX), array('[!php/const PHP_INT_MAX]', array(PHP_INT_MAX)), array('{ foo: !php/const PHP_INT_MAX }', array('foo' => PHP_INT_MAX)), + array('!php/const NULL', null), ); } @@ -82,10 +83,22 @@ public function testParsePhpConstantThrowsExceptionOnInvalidType() /** * @group legacy * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 1. + * @dataProvider getTestsForParseLegacyPhpConstants */ - public function testDeprecatedConstantTag() + public function testDeprecatedConstantTag($yaml, $expectedValue) { - Inline::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT); + $this->assertSame($expectedValue, Inline::parse($yaml, Yaml::PARSE_CONSTANT)); + } + + public function getTestsForParseLegacyPhpConstants() + { + return array( + array('!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT), + array('!php/const:PHP_INT_MAX', PHP_INT_MAX), + array('[!php/const:PHP_INT_MAX]', array(PHP_INT_MAX)), + array('{ foo: !php/const:PHP_INT_MAX }', array('foo' => PHP_INT_MAX)), + array('!php/const:NULL', null), + ); } /** From a7d44895e0bf0624e0bcf48e0e35182edd5c149a Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 5 Dec 2017 23:53:48 +1000 Subject: [PATCH 18/85] Fix php doc in Table class --- src/Symfony/Component/Console/Helper/Table.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 11bed884c2aca..e91ff83ea56da 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -188,6 +188,7 @@ public function setRow($column, array $row) * Renders table to output. * * Example: + * * +---------------+-----------------------+------------------+ * | ISBN | Title | Author | * +---------------+-----------------------+------------------+ @@ -195,6 +196,7 @@ public function setRow($column, array $row) * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ + * */ public function render() { @@ -226,7 +228,7 @@ public function render() /** * Renders horizontal header separator. * - * Example: +-----+-----------+-------+ + * Example: +-----+-----------+-------+ */ private function renderRowSeparator() { @@ -257,7 +259,7 @@ private function renderColumnSeparator() /** * Renders table row. * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * * @param array $row * @param string $cellFormat From a7ac100c45f53950660bf6323356a9f13f1e9469 Mon Sep 17 00:00:00 2001 From: Brian Freytag Date: Tue, 5 Dec 2017 10:17:41 -0500 Subject: [PATCH 19/85] Remove LOCK_EX That Breaks Cache Usage on NFS This removes the exclusive lock that was introduced in #24960. NFS File Systems do not support exclusive locking, and generates a lot of errors every time you try to do anything with che cache. --- src/Symfony/Component/HttpKernel/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 39fe4228b3cb2..286b30bc386e2 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -423,7 +423,7 @@ public function setClassCache(array $classes) */ public function setAnnotatedClassCache(array $annotatedClasses) { - file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf('warmupDir ?: $this->getCacheDir()).'/annotations.map', sprintf(' Date: Tue, 5 Dec 2017 16:52:04 +0000 Subject: [PATCH 20/85] Throw a sensible exception when controller has been removed --- .../ContainerControllerResolver.php | 36 ++++++++--- .../ContainerControllerResolverTest.php | 59 ++++++++++++++++++- 2 files changed, 84 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php index 75355084d2608..186583d7be966 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php @@ -63,19 +63,28 @@ protected function createController($controller) return parent::createController($controller); } + $method = null; if (1 == substr_count($controller, ':')) { // controller in the "service:method" notation - list($service, $method) = explode(':', $controller, 2); + list($controller, $method) = explode(':', $controller, 2); + } + + if (!$this->container->has($controller)) { + $this->throwExceptionIfControllerWasRemoved($controller); + + throw new \LogicException(sprintf('Controller not found: service "%s" does not exist.', $controller)); + } - return array($this->container->get($service), $method); + $service = $this->container->get($controller); + if (null !== $method) { + return array($service, $method); } - if ($this->container->has($controller) && method_exists($service = $this->container->get($controller), '__invoke')) { - // invokable controller in the "service" notation - return $service; + if (!method_exists($service, '__invoke')) { + throw new \LogicException(sprintf('Controller "%s" cannot be called without a method name. Did you forget an "__invoke" method?', $controller)); } - throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller)); + return $service; } /** @@ -94,10 +103,19 @@ protected function instantiateController($class) } catch (\TypeError $e) { } - if ($this->container instanceof Container && isset($this->container->getRemovedIds()[$class])) { - throw new \LogicException(sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $class), 0, $e); - } + $this->throwExceptionIfControllerWasRemoved($class, $e); throw $e; } + + /** + * @param string $controller + * @param \Exception|\Throwable|null $previous + */ + private function throwExceptionIfControllerWasRemoved($controller, $previous = null) + { + if ($this->container instanceof Container && isset($this->container->getRemovedIds()[$controller])) { + throw new \LogicException(sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous); + } + } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php index 83217aef558fc..0019123b6819c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php @@ -23,6 +23,10 @@ class ContainerControllerResolverTest extends ControllerResolverTest public function testGetControllerService() { $container = $this->createMockContainer(); + $container->expects($this->once()) + ->method('has') + ->with('foo') + ->will($this->returnValue(true)); $container->expects($this->once()) ->method('get') ->with('foo') @@ -175,6 +179,57 @@ public function testNonInstantiableControllerWithCorrespondingService() $this->assertSame(array($service, 'action'), $controller); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage Controller "app.my_controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"? + */ + public function testExceptionWhenUsingRemovedControllerService() + { + $container = $this->getMockBuilder(Container::class)->getMock(); + $container->expects($this->at(0)) + ->method('has') + ->with('app.my_controller') + ->will($this->returnValue(false)) + ; + + $container->expects($this->atLeastOnce()) + ->method('getRemovedIds') + ->with() + ->will($this->returnValue(array('app.my_controller' => true))) + ; + + $resolver = $this->createControllerResolver(null, $container); + + $request = Request::create('/'); + $request->attributes->set('_controller', 'app.my_controller'); + $resolver->getController($request); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage Controller "app.my_controller" cannot be called without a method name. Did you forget an "__invoke" method? + */ + public function testExceptionWhenUsingControllerWithoutAnInvokeMethod() + { + $container = $this->getMockBuilder(Container::class)->getMock(); + $container->expects($this->once()) + ->method('has') + ->with('app.my_controller') + ->will($this->returnValue(true)) + ; + $container->expects($this->once()) + ->method('get') + ->with('app.my_controller') + ->will($this->returnValue(new ImpossibleConstructController('toto', 'controller'))) + ; + + $resolver = $this->createControllerResolver(null, $container); + + $request = Request::create('/'); + $request->attributes->set('_controller', 'app.my_controller'); + $resolver->getController($request); + } + /** * @dataProvider getUndefinedControllers */ @@ -197,9 +252,9 @@ public function testGetControllerOnNonUndefinedFunction($controller, $exceptionN public function getUndefinedControllers() { return array( - array('foo', \LogicException::class, '/Unable to parse the controller name "foo"\./'), + array('foo', \LogicException::class, '/Controller not found: service "foo" does not exist\./'), array('oof::bar', \InvalidArgumentException::class, '/Class "oof" does not exist\./'), - array('stdClass', \LogicException::class, '/Unable to parse the controller name "stdClass"\./'), + array('stdClass', \LogicException::class, '/Controller not found: service "stdClass" does not exist\./'), array( 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar', \InvalidArgumentException::class, From 730b156f356cfb9c0d46a092822b476b8e5f74a7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 Dec 2017 13:03:49 +0100 Subject: [PATCH 21/85] [DI] Fix non-string class handling in PhpDumper --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 0f5e33afb6da9..2ed5c72a1a0f5 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -413,7 +413,7 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora if ($this->inlineRequires && !$this->isHotPath($definition)) { $lineage = $calls = $behavior = array(); foreach ($inlinedDefinitions as $def) { - if (!$def->isDeprecated() && $class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass()) { + if (!$def->isDeprecated() && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } $arguments = array($def->getArguments(), $def->getFactory(), $def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); @@ -425,7 +425,7 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior[$id] && $this->container->has($id) && $this->isTrivialInstance($def = $this->container->findDefinition($id)) - && $class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass() + && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass()) ) { $this->collectLineage($class, $lineage); } @@ -1226,7 +1226,7 @@ private function addInlineRequires() $inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition)); foreach ($inlinedDefinitions as $def) { - if ($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass()) { + if (is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } } From 28f00866b1b61657f6bd5ffca15f83fafa24806b Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Wed, 6 Dec 2017 12:34:05 +0000 Subject: [PATCH 22/85] Ensure that inlined services with parameterized class name can be dumped --- .../Tests/Dumper/PhpDumperTest.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 7455dd6cde681..d9b3c5c864d25 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; +use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; @@ -822,6 +823,31 @@ public function testDumpHandlesLiteralClassWithRootNamespace() $this->assertInstanceOf('stdClass', $container->get('foo')); } + public function testDumpHandlesObjectClassNames() + { + $container = new ContainerBuilder(new ParameterBag(array( + 'class' => 'stdClass', + ))); + + $container->setDefinition('foo', new Definition(new Parameter('class'))); + $container->setDefinition('bar', new Definition('stdClass', array( + new Reference('foo'), + )))->setPublic(true); + + $container->setParameter('inline_requires', true); + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array( + 'class' => 'Symfony_DI_PhpDumper_Test_Object_Class_Name', + 'inline_class_loader_parameter' => 'inline_requires', + ))); + + $container = new \Symfony_DI_PhpDumper_Test_Object_Class_Name(); + + $this->assertInstanceOf('stdClass', $container->get('bar')); + } + /** * @group legacy * @expectedDeprecation The "private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead. From 950fd9916bf8351dc52984acf3063a4bd93a9e75 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 Dec 2017 16:28:34 +0100 Subject: [PATCH 23/85] [HttpKernel] Disable inlining on PHP 5 --- src/Symfony/Component/HttpKernel/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 39fe4228b3cb2..b88cc6af1aa4a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -839,7 +839,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container 'file' => $cache->getPath(), 'as_files' => true, 'debug' => $this->debug, - 'inline_class_loader_parameter' => !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null, + 'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null, )); $rootCode = array_pop($content); From 22f35239a46f5a4cf659bd0e5f373281fa7f29f7 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Wed, 6 Dec 2017 16:27:14 +0000 Subject: [PATCH 24/85] Prevent a loop in aliases within the `findDefinition` method --- .../DependencyInjection/ContainerBuilder.php | 7 +++++++ .../Tests/ContainerBuilderTest.php | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c3aee4e6fd35a..f58adfc7d07e3 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -993,8 +993,15 @@ public function findDefinition($id) { $id = $this->normalizeId($id); + $seen = array(); while (isset($this->aliasDefinitions[$id])) { $id = (string) $this->aliasDefinitions[$id]; + + if (isset($seen[$id])) { + throw new ServiceCircularReferenceException($id, array_keys($seen)); + } + + $seen[$id] = true; } return $this->getDefinition($id); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 8b905746b2e43..fd24d80d1bf1d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1044,6 +1044,22 @@ public function testInlinedDefinitions() $this->assertNotSame($bar->foo, $barUser->foo); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass". + */ + public function testThrowsCircularExceptionForCircularAliases() + { + $builder = new ContainerBuilder(); + + $builder->setAliases(array( + 'app.test_class' => new Alias('App\\TestClass'), + 'App\\TestClass' => new Alias('app.test_class'), + )); + + $builder->findDefinition('App\\TestClass'); + } + public function testInitializePropertiesBeforeMethodCalls() { $container = new ContainerBuilder(); From 78abc8964848bfe6f640885d2942c42e3187534a Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Tue, 5 Dec 2017 07:03:41 +0100 Subject: [PATCH 25/85] [ExpressionLanguage] throw an SyntaxError instead of letting a undefined index notice --- .../ExpressionLanguage/Tests/ExpressionLanguageTest.php | 9 +++++++++ src/Symfony/Component/ExpressionLanguage/TokenStream.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 50a0eb5e95aae..ff8aab2cdec34 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -84,6 +84,15 @@ public function testShortCircuitOperatorsCompile($expression, array $names, $exp $this->assertSame($expected, $result); } + /** + * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError + * @expectedExceptionMessage Unexpected end of expression around position 6 for expression `node.`. + */ + public function testParseThrowsInsteadOfNotice() + { + (new ExpressionLanguage())->parse('node.', array('node')); + } + public function shortCircuitProviderEvaluate() { $object = $this->getMockBuilder('stdClass')->setMethods(array('foo'))->getMock(); diff --git a/src/Symfony/Component/ExpressionLanguage/TokenStream.php b/src/Symfony/Component/ExpressionLanguage/TokenStream.php index 9426bfeb7e287..9096b183ff378 100644 --- a/src/Symfony/Component/ExpressionLanguage/TokenStream.php +++ b/src/Symfony/Component/ExpressionLanguage/TokenStream.php @@ -50,12 +50,12 @@ public function __toString() */ public function next() { + ++$this->position; + if (!isset($this->tokens[$this->position])) { throw new SyntaxError('Unexpected end of expression', $this->current->cursor, $this->expression); } - ++$this->position; - $this->current = $this->tokens[$this->position]; } From ef2ca5652a8d8f7c2e7fd5b6ff9b23736dcfc702 Mon Sep 17 00:00:00 2001 From: Selvi ARIK Date: Thu, 7 Dec 2017 14:36:34 +0100 Subject: [PATCH 26/85] doc : Namespace prefix must end with a "\" --- UPGRADE-3.4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 77d0a143f84d3..b6b1fb9b55bb9 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -281,7 +281,7 @@ HttpKernel # ... # explicit commands registration - AppBundle\Command: + AppBundle\Command\: resource: '../../src/AppBundle/Command/*' tags: ['console.command'] ``` From 093eb3d40df02787e500746940f22bd222d136b6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 7 Dec 2017 17:10:25 +0100 Subject: [PATCH 27/85] register system cache clearer only if it's used --- .../DependencyInjection/Compiler/CachePoolPass.php | 4 ++++ src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php index 51b383bc3810b..ae8415cb4efbd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php @@ -112,6 +112,10 @@ public function process(ContainerBuilder $container) $clearer->setArgument(0, $pools); } $clearer->addTag('cache.pool.clearer'); + + if ('cache.system_clearer' === $id) { + $clearer->addTag('kernel.cache_clearer'); + } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 9466d992c0fa4..f388501ba4d32 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -104,9 +104,7 @@ - - - + From f1a7b075a6098e891b91511e4584ad43e274a7c0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 7 Dec 2017 18:06:18 +0100 Subject: [PATCH 28/85] [DI] Fix circular-aliases message --- .../Component/DependencyInjection/ContainerBuilder.php | 8 ++++++-- .../DependencyInjection/Tests/ContainerBuilderTest.php | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index f58adfc7d07e3..e67d924f23cb4 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -998,10 +998,14 @@ public function findDefinition($id) $id = (string) $this->aliasDefinitions[$id]; if (isset($seen[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($seen)); + $seen = array_values($seen); + $seen = array_slice($seen, array_search($id, $seen)); + $seen[] = $id; + + throw new ServiceCircularReferenceException($id, $seen); } - $seen[$id] = true; + $seen[$id] = $id; } return $this->getDefinition($id); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index fd24d80d1bf1d..f4583b1338922 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1046,18 +1046,19 @@ public function testInlinedDefinitions() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException - * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass". + * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass -> app.test_class". */ public function testThrowsCircularExceptionForCircularAliases() { $builder = new ContainerBuilder(); $builder->setAliases(array( + 'foo' => new Alias('app.test_class'), 'app.test_class' => new Alias('App\\TestClass'), 'App\\TestClass' => new Alias('app.test_class'), )); - $builder->findDefinition('App\\TestClass'); + $builder->findDefinition('foo'); } public function testInitializePropertiesBeforeMethodCalls() From f87380c22a6371103440cff77da5cd83b7a07212 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 7 Dec 2017 18:32:09 +0100 Subject: [PATCH 29/85] [DI] Force root-namespace for function calls in the dumper container --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 10 +++++----- .../Tests/Fixtures/php/services12.php | 2 +- .../Tests/Fixtures/php/services26.php | 2 +- .../Tests/Fixtures/php/services9.php | 4 ++-- .../Tests/Fixtures/php/services9_as_files.txt | 4 ++-- .../Tests/Fixtures/php/services_array_params.php | 2 +- .../Tests/Fixtures/php/services_inline_requires.php | 2 +- .../Tests/Fixtures/php/services_legacy_privates.php | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 0f5e33afb6da9..e0e6be7613b68 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -695,7 +695,7 @@ private function addServiceConfigurator(Definition $definition, $variableName = return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + return sprintf(" \\call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } return sprintf(" %s(\$%s);\n", $callable, $variableName); @@ -895,7 +895,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation, return $return.sprintf("(%s)->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : ''); } - return $return.sprintf("call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); + return $return.sprintf("\\call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); } return $return.sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : ''); @@ -948,11 +948,11 @@ public function __construct() EOF; if (null !== $this->targetDirRegex) { - $dir = $this->asFiles ? '$this->targetDirs[0] = dirname(__DIR__)' : '__DIR__'; + $dir = $this->asFiles ? '$this->targetDirs[0] = \\dirname(__DIR__)' : '__DIR__'; $code .= <<targetDirMaxMatches}; ++\$i) { - \$this->targetDirs[\$i] = \$dir = dirname(\$dir); + \$this->targetDirs[\$i] = \$dir = \\dirname(\$dir); } EOF; @@ -1722,7 +1722,7 @@ private function dumpValue($value, $interpolate = true) } if ($factory[0] instanceof Definition) { - return sprintf("call_user_func(array(%s, '%s')%s)", $this->dumpValue($factory[0]), $factory[1], count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); + return sprintf("\\call_user_func(array(%s, '%s')%s)", $this->dumpValue($factory[0]), $factory[1], count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); } if ($factory[0] instanceof Reference) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index c5c434ec7d7c1..48750c480f0ec 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -23,7 +23,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->parameters = $this->getDefaultParameters(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index 257a145c6f5ff..5c8773c380349 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -23,7 +23,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->parameters = $this->getDefaultParameters(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 467733f467d6c..4220c146aacbf 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -223,9 +223,9 @@ protected function getFooService() */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance')); + $this->services['foo.baz'] = $instance = \call_user_func(array($this->getParameter('baz_class'), 'getInstance')); - call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance); + \call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance); return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index 59ace1ddf3a38..0ee660df4dbf5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -281,9 +281,9 @@ class ProjectServiceContainer extends Container public function __construct() { - $dir = $this->targetDirs[0] = dirname(__DIR__); + $dir = $this->targetDirs[0] = \dirname(__DIR__); for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->parameters = $this->getDefaultParameters(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index 65e6b61e34e57..659aef172f810 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -23,7 +23,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->parameters = $this->getDefaultParameters(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index 3b45218bd9b9a..2012c952c9971 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -23,7 +23,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->parameters = $this->getDefaultParameters(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php index 03947c425df79..1a9c87286d6e9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_legacy_privates.php @@ -23,7 +23,7 @@ public function __construct() { $dir = __DIR__; for ($i = 1; $i <= 5; ++$i) { - $this->targetDirs[$i] = $dir = dirname($dir); + $this->targetDirs[$i] = $dir = \dirname($dir); } $this->services = array(); $this->methodMap = array( From 520cc97e189b48dc2451f148039130c561eb70b8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 7 Dec 2017 19:55:09 +0100 Subject: [PATCH 30/85] [HttpKernel] remove noisy frame in controller stack traces --- src/Symfony/Component/HttpKernel/HttpKernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php index f1114bf632c00..f971e248f92c8 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -134,7 +134,7 @@ private function handleRaw(Request $request, $type = self::MASTER_REQUEST) $arguments = $this->resolver->getArguments($request, $controller); // call controller - $response = call_user_func_array($controller, $arguments); + $response = \call_user_func_array($controller, $arguments); // view if (!$response instanceof Response) { From 2249f43c023ddb5069a0f81e11d5fad3cc346c9b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 7 Dec 2017 20:30:27 +0100 Subject: [PATCH 31/85] [ExpressionLanguage] Fix parse error on 5.3 --- .../ExpressionLanguage/Tests/ExpressionLanguageTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index ff8aab2cdec34..ec5f0f1d752bc 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -90,7 +90,8 @@ public function testShortCircuitOperatorsCompile($expression, array $names, $exp */ public function testParseThrowsInsteadOfNotice() { - (new ExpressionLanguage())->parse('node.', array('node')); + $expressionLanguage = new ExpressionLanguage(); + $expressionLanguage->parse('node.', array('node')); } public function shortCircuitProviderEvaluate() From b201c22d441868c0f7028a9045d8999d4d165e21 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Dec 2017 11:00:13 +0100 Subject: [PATCH 32/85] fix some edge cases with indented blocks Now that comment-like lines are no longer ignored when subparsers are created, we need to ignore them in some functions (e.g. when detecting the indentation depth of the next block). --- src/Symfony/Component/Yaml/Parser.php | 56 +++++++++++++---- .../Component/Yaml/Tests/ParserTest.php | 62 +++++++++++++++++++ 2 files changed, 107 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index a6e39007dfe0f..773837c995588 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -537,7 +537,27 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) } if (null === $indentation) { - $newIndent = $this->getCurrentLineIndentation(); + $newIndent = null; + $movements = 0; + + do { + $EOF = false; + + // comment-like lines do not influence the indentation depth + if ($this->isCurrentLineComment()) { + $EOF = !$this->moveToNextLine(); + + if (!$EOF) { + ++$movements; + } + } else { + $newIndent = $this->getCurrentLineIndentation(); + } + } while (!$EOF && null === $newIndent); + + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); @@ -551,6 +571,8 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) $data = array(); if ($this->getCurrentLineIndentation() >= $newIndent) { $data[] = substr($this->currentLine, $newIndent); + } elseif ($this->isCurrentLineComment()) { + $data[] = $this->currentLine; } else { $this->moveToPreviousLine(); @@ -866,11 +888,15 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) private function isNextLineIndented() { $currentIndentation = $this->getCurrentLineIndentation(); - $EOF = !$this->moveToNextLine(); + $movements = 0; - while (!$EOF && $this->isCurrentLineEmpty()) { + do { $EOF = !$this->moveToNextLine(); - } + + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); if ($EOF) { return false; @@ -878,7 +904,9 @@ private function isNextLineIndented() $ret = $this->getCurrentLineIndentation() > $currentIndentation; - $this->moveToPreviousLine(); + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } return $ret; } @@ -967,19 +995,25 @@ private function cleanup($value) private function isNextLineUnIndentedCollection() { $currentIndentation = $this->getCurrentLineIndentation(); - $notEOF = $this->moveToNextLine(); + $movements = 0; - while ($notEOF && $this->isCurrentLineEmpty()) { - $notEOF = $this->moveToNextLine(); - } + do { + $EOF = !$this->moveToNextLine(); + + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); - if (false === $notEOF) { + if ($EOF) { return false; } $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); - $this->moveToPreviousLine(); + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } return $ret; } diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 1d35ecc1bd819..73a482b9399c7 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -2013,6 +2013,68 @@ public function testEvalRefException() EOE; $this->parser->parse($yaml); } + + /** + * @dataProvider indentedMappingData + */ + public function testParseIndentedMappings($yaml, $expected) + { + $this->assertSame($expected, $this->parser->parse($yaml)); + } + + public function indentedMappingData() + { + $tests = array(); + + $yaml = << array( + array( + 'bar' => 'foobar', + 'baz' => 'foobaz', + ), + ), + ); + $tests['comment line is first line in indented block'] = array($yaml, $expected); + + $yaml = << array( + array( + 'bar' => array( + 'baz' => array(1, 2, 3), + ), + ), + ), + ); + $tests['mapping value on new line starting with a comment line'] = array($yaml, $expected); + + $yaml = << array( + array( + 'bar' => 'foobar', + ), + ), + ); + $tests['mapping in sequence starting on a new line'] = array($yaml, $expected); + + return $tests; + } } class B From 138cd09948ff09a1cb436cb02e6f3409413ac234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antal=20=C3=81ron?= Date: Thu, 7 Dec 2017 17:59:09 +0100 Subject: [PATCH 33/85] [VarDumper] Fixed file links leave blank pages when ide is configured --- .../Component/VarDumper/Dumper/HtmlDumper.php | 3 ++- .../VarDumper/Tests/Caster/StubCasterTest.php | 27 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index a268ecf3e5561..b8f1b099f3ff4 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -828,7 +828,8 @@ protected function style($style, $value, $attr = array()) $attr['href'] = $href; } if (isset($attr['href'])) { - $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $v); + $target = isset($attr['file']) ? '' : ' target="_blank"'; + $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $target, $v); } if (isset($attr['lang'])) { $v = sprintf('%s', esc($attr['lang']), $v); diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php index 525542c5fed9c..36603c51cc012 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php @@ -100,7 +100,28 @@ public function testLinkStub() $expectedDump = <<<'EODUMP' array:1 [ - 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest" + 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest" +] + +EODUMP; + + $this->assertStringMatchesFormat($expectedDump, $dump); + } + + public function testLinkStubWithNoFileLink() + { + $var = array(new LinkStub('example.com', 0, 'http://example.com')); + + $cloner = new VarCloner(); + $dumper = new HtmlDumper(); + $dumper->setDumpHeader(''); + $dumper->setDumpBoundaries('', ''); + $dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l')); + $dump = $dumper->dump($cloner->cloneVar($var), true); + + $expectedDump = <<<'EODUMP' +array:1 [ + 0 => "example.com" ] EODUMP; @@ -120,7 +141,7 @@ public function testClassStub() $expectedDump = <<<'EODUMP' array:1 [ - 0 => "hello" + 0 => "hello" ] EODUMP; @@ -161,7 +182,7 @@ public function testClassStubWithNotExistingMethod() $expectedDump = <<<'EODUMP' array:1 [ - 0 => "hello" + 0 => "hello" ] EODUMP; From 30e227392ab65e516e5038addffebd1c8f6f1ba5 Mon Sep 17 00:00:00 2001 From: Titouan Galopin Date: Fri, 8 Dec 2017 11:23:50 +0100 Subject: [PATCH 34/85] Remove some unused variables, properties and methods --- .../FrameworkBundle/Templating/Helper/AssetsHelper.php | 2 +- src/Symfony/Component/CssSelector/Parser/TokenStream.php | 9 +-------- .../Compiler/AnalyzeServiceReferencesPass.php | 3 +-- .../Compiler/InlineServiceDefinitionsPass.php | 3 +-- .../EventDispatcher/ContainerAwareEventDispatcher.php | 2 +- .../Component/Form/Extension/Core/Type/TimezoneType.php | 7 ------- .../HttpKernel/DataCollector/ConfigDataCollector.php | 3 +-- src/Symfony/Component/HttpKernel/HttpCache/Store.php | 2 +- .../Tests/DataCollector/ConfigDataCollectorTest.php | 1 - src/Symfony/Component/Process/Pipes/AbstractPipes.php | 2 +- src/Symfony/Component/Process/Pipes/UnixPipes.php | 2 +- .../Validator/Context/LegacyExecutionContext.php | 4 ---- 12 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php index 172417924c921..f3d960f9c6715 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php @@ -43,7 +43,7 @@ public function __construct(Packages $packages) public function getUrl($path, $packageName = null, $version = null) { // BC layer to be removed in 3.0 - if (3 === $count = func_num_args()) { + if (3 === func_num_args()) { @trigger_error('Forcing a version for an asset was deprecated in 2.7 and will be removed in 3.0.', E_USER_DEPRECATED); $args = func_get_args(); diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index ac87d313c9e80..54f7af3eb25ab 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -29,11 +29,6 @@ class TokenStream */ private $tokens = array(); - /** - * @var bool - */ - private $frozen = false; - /** * @var Token[] */ @@ -47,7 +42,7 @@ class TokenStream /** * @var Token|null */ - private $peeked = null; + private $peeked; /** * @var bool @@ -73,8 +68,6 @@ public function push(Token $token) */ public function freeze() { - $this->frozen = true; - return $this; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index 12e27298a682f..cafa3d4ed6e29 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -30,7 +30,6 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface private $container; private $currentId; private $currentDefinition; - private $repeatedPass; private $onlyConstructorArguments; /** @@ -46,7 +45,7 @@ public function __construct($onlyConstructorArguments = false) */ public function setRepeatedPass(RepeatedPass $repeatedPass) { - $this->repeatedPass = $repeatedPass; + // no-op for BC } /** diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 5d7fa1ba6319e..78f0ebb41f68c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -23,7 +23,6 @@ */ class InlineServiceDefinitionsPass implements RepeatablePassInterface { - private $repeatedPass; private $graph; private $compiler; private $formatter; @@ -34,7 +33,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface */ public function setRepeatedPass(RepeatedPass $repeatedPass) { - $this->repeatedPass = $repeatedPass; + // no-op for BC } /** diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 03670bb44c419..197fafd5939dc 100644 --- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -67,7 +67,7 @@ public function removeListener($eventName, $listener) if (isset($this->listenerIds[$eventName])) { foreach ($this->listenerIds[$eventName] as $i => $args) { - list($serviceId, $method, $priority) = $args; + list($serviceId, $method) = $args; $key = $serviceId.'.'.$method; if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { unset($this->listeners[$eventName][$key]); diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php index 13c27f9da8c7f..0592ef4d26f25 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php @@ -23,13 +23,6 @@ class TimezoneType extends AbstractType */ private static $timezones; - /** - * Stores the available timezone choices. - * - * @var array - */ - private static $flippedTimezones; - /** * {@inheritdoc} */ diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index c1c085cbed9d8..318c6522b42a1 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -27,7 +27,6 @@ class ConfigDataCollector extends DataCollector private $kernel; private $name; private $version; - private $cacheVersionInfo = true; /** * @param string $name The name of the application using the web profiler @@ -123,7 +122,7 @@ public function getSymfonyState() public function setCacheVersionInfo($cacheVersionInfo) { - $this->cacheVersionInfo = $cacheVersionInfo; + // no-op for BC } /** diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 8eeb93192cc8f..fa0d4a86712b6 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -151,7 +151,7 @@ public function lookup(Request $request) return; } - list($req, $headers) = $match; + $headers = $match[1]; if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { return $this->restoreResponse($headers, $body); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index b6dfb70c1b622..6d9f65d0ac6e8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -24,7 +24,6 @@ public function testCollect() { $kernel = new KernelForTest('test', true); $c = new ConfigDataCollector(); - $c->setCacheVersionInfo(false); $c->setKernel($kernel); $c->collect(new Request(), new Response()); diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index d46a861388c9c..9a23d93c98688 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -94,7 +94,7 @@ protected function write() $w = array($this->pipes[0]); // let's have a look if something changed in streams - if (false === $n = @stream_select($r, $w, $e, 0, 0)) { + if (false === @stream_select($r, $w, $e, 0, 0)) { return; } diff --git a/src/Symfony/Component/Process/Pipes/UnixPipes.php b/src/Symfony/Component/Process/Pipes/UnixPipes.php index b5b88358a40c6..65f32ecf2735a 100644 --- a/src/Symfony/Component/Process/Pipes/UnixPipes.php +++ b/src/Symfony/Component/Process/Pipes/UnixPipes.php @@ -99,7 +99,7 @@ public function readAndWrite($blocking, $close = false) unset($r[0]); // let's have a look if something changed in streams - if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + if (($r || $w) && false === @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { // if a system call has been interrupted, forget about it, let's try again // otherwise, an error occurred, let's reset pipes if (!$this->hasSystemCallBeenInterrupted()) { diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php index 3d5181f09a6a0..318a0a4a685c4 100644 --- a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php @@ -26,8 +26,6 @@ */ class LegacyExecutionContext extends ExecutionContext { - private $metadataFactory; - /** * Creates a new context. * @@ -44,7 +42,5 @@ public function __construct(ValidatorInterface $validator, $root, MetadataFactor $translator, $translationDomain ); - - $this->metadataFactory = $metadataFactory; } } From 97fdf31e09414be11461c50f0499f8ff7f736789 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 8 Dec 2017 07:36:22 -0500 Subject: [PATCH 35/85] Fix debug:form definition --- .../Component/Form/DependencyInjection/FormPass.php | 3 +-- .../Form/Tests/DependencyInjection/FormPassTest.php | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Form/DependencyInjection/FormPass.php b/src/Symfony/Component/Form/DependencyInjection/FormPass.php index bed74532d1571..df297da277f93 100644 --- a/src/Symfony/Component/Form/DependencyInjection/FormPass.php +++ b/src/Symfony/Component/Form/DependencyInjection/FormPass.php @@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Form\Command\DebugCommand; /** * Adds all services with the tags "form.type", "form.type_extension" and @@ -36,7 +35,7 @@ class FormPass implements CompilerPassInterface private $formTypeGuesserTag; private $formDebugCommandService; - public function __construct($formExtensionService = 'form.extension', $formTypeTag = 'form.type', $formTypeExtensionTag = 'form.type_extension', $formTypeGuesserTag = 'form.type_guesser', $formDebugCommandService = DebugCommand::class) + public function __construct($formExtensionService = 'form.extension', $formTypeTag = 'form.type', $formTypeExtensionTag = 'form.type_extension', $formTypeGuesserTag = 'form.type_guesser', $formDebugCommandService = 'console.command.form_debug') { $this->formExtensionService = $formExtensionService; $this->formTypeTag = $formTypeTag; diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php index f045e3f9f5d50..59e2262efc418 100644 --- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php +++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php @@ -14,7 +14,6 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\Form\Command\DebugCommand; use Symfony\Component\Form\DependencyInjection\FormPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -43,7 +42,7 @@ public function testDoNothingIfDebugCommandNotLoaded() $container->compile(); - $this->assertFalse($container->hasDefinition(DebugCommand::class)); + $this->assertFalse($container->hasDefinition('console.command.form_debug')); } public function testAddTaggedTypes() @@ -72,13 +71,13 @@ public function testAddTaggedTypesToDebugCommand() $container = $this->createContainerBuilder(); $container->setDefinition('form.extension', $this->createExtensionDefinition()); - $container->setDefinition(DebugCommand::class, $this->createDebugCommandDefinition()); + $container->setDefinition('console.command.form_debug', $this->createDebugCommandDefinition()); $container->register('my.type1', __CLASS__.'_Type1')->addTag('form.type')->setPublic(true); $container->register('my.type2', __CLASS__.'_Type2')->addTag('form.type')->setPublic(true); $container->compile(); - $cmdDefinition = $container->getDefinition(DebugCommand::class); + $cmdDefinition = $container->getDefinition('console.command.form_debug'); $this->assertEquals( array( From 8bc2fbb934fc1dff897acfc206aaf10835cbfb68 Mon Sep 17 00:00:00 2001 From: Titouan Galopin Date: Fri, 8 Dec 2017 14:17:14 +0100 Subject: [PATCH 36/85] Remove some unused variables and properties --- .../RegisterEventListenersAndSubscribersPass.php | 2 +- src/Symfony/Component/Dotenv/Dotenv.php | 2 +- .../DataTransformer/DateIntervalToStringTransformer.php | 7 ++----- .../RemoveEmptyControllerArgumentLocatorsPass.php | 2 +- src/Symfony/Component/Serializer/Encoder/JsonDecode.php | 3 +-- src/Symfony/Component/Serializer/Encoder/JsonEncode.php | 3 +-- .../Validator/Test/ConstraintValidatorTestCase.php | 3 +-- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index f918d0d211c94..e7015fd1e4119 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -112,7 +112,7 @@ private function groupByConnection(array $services, $isListener = false) } $instance['event'] = array($instance['event']); - if ($lazy = !empty($instance['lazy'])) { + if (!empty($instance['lazy'])) { $this->container->getDefinition($id)->setPublic(true); } } diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index dde92f46af5b6..3ae735c7db78b 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -112,7 +112,7 @@ public function parse($data, $path = '.env') $this->end = strlen($this->data); $this->state = self::STATE_VARNAME; $this->values = array(); - $name = $value = ''; + $name = ''; $this->skipEmptyLines(); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php index dffe146623772..4624e585e7e0d 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -23,20 +23,17 @@ class DateIntervalToStringTransformer implements DataTransformerInterface { private $format; - private $parseSigned; /** * Transforms a \DateInterval instance to a string. * * @see \DateInterval::format() for supported formats * - * @param string $format The date format - * @param bool $parseSigned Whether to parse as a signed interval + * @param string $format The date format */ - public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS', $parseSigned = false) + public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS') { $this->format = $format; - $this->parseSigned = $parseSigned; } /** diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 440b0d0025e65..ab50cec3531bf 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -50,7 +50,7 @@ public function process(ContainerBuilder $container) $action = substr(strrchr($controller, ':'), 1); $id = substr($controller, 0, -1 - strlen($action)); $controllerDef = $container->getDefinition($id); - foreach ($controllerDef->getMethodCalls() as list($method, $args)) { + foreach ($controllerDef->getMethodCalls() as list($method)) { if (0 === strcasecmp($action, $method)) { $reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id); break; diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index 213caab9fea80..455d1378c369e 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -24,7 +24,6 @@ class JsonDecode implements DecoderInterface private $associative; private $recursionDepth; - private $lastError = JSON_ERROR_NONE; /** * Constructs a new JsonDecode instance. @@ -75,7 +74,7 @@ public function decode($data, $format, array $context = array()) $decodedData = json_decode($data, $associative, $recursionDepth, $options); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { + if (JSON_ERROR_NONE !== json_last_error()) { throw new UnexpectedValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 620193f206e6b..6ed558f7dc18d 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -21,7 +21,6 @@ class JsonEncode implements EncoderInterface { private $options; - private $lastError = JSON_ERROR_NONE; public function __construct($bitmask = 0) { @@ -39,7 +38,7 @@ public function encode($data, $format, array $context = array()) $encodedJson = json_encode($data, $context['json_encode_options']); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { + if (JSON_ERROR_NONE !== json_last_error()) { throw new UnexpectedValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index c2932f81e8b1f..8e3b2a9f791b9 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -227,7 +227,6 @@ class ConstraintViolationAssertion private $parameters = array(); private $invalidValue = 'InvalidValue'; private $propertyPath = 'property.path'; - private $translationDomain; private $plural; private $code; private $constraint; @@ -264,7 +263,7 @@ public function setParameters(array $parameters) public function setTranslationDomain($translationDomain) { - $this->translationDomain = $translationDomain; + // no-op for BC return $this; } From a4db20fbfde6b546db36bfa655c228eb5b9efdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Schl=C3=A4pfer?= Date: Fri, 8 Dec 2017 14:05:42 +0100 Subject: [PATCH 37/85] [HttpFoundation] don't prefix cookies with "Set-Cookie:" See symfony/symfony#25393 --- .../Handler/AbstractSessionHandler.php | 2 +- .../Fixtures/with_cookie_and_session.expected | 24 +++++++++++++++++++ .../Fixtures/with_cookie_and_session.php | 13 ++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected create mode 100644 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index 7c6c476aac453..6ae1355816fdb 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -156,7 +156,7 @@ public function destroy($sessionId) if ($sessionCookieFound) { header_remove('Set-Cookie'); foreach ($otherCookies as $h) { - header('Set-Cookie:'.$h, false); + header($h, false); } } else { setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected new file mode 100644 index 0000000000000..5de2d9e3904ed --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected @@ -0,0 +1,24 @@ +open +validateId +read +doRead: abc|i:123; +read +updateTimestamp +close +open +validateId +read +doRead: abc|i:123; +read + +write +destroy +doDestroy +close +Array +( + [0] => Content-Type: text/plain; charset=utf-8 + [1] => Cache-Control: max-age=10800, private, must-revalidate + [2] => Set-Cookie: abc=def +) +shutdown diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php new file mode 100644 index 0000000000000..ec5119323b757 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php @@ -0,0 +1,13 @@ + Date: Fri, 8 Dec 2017 16:04:33 +0100 Subject: [PATCH 38/85] [appveyor] disable memory limit on composer up --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a1ba60ac1b02d..6cee17f6feedf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,7 @@ install: - copy /Y .composer\* %APPDATA%\Composer\ - php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev) - - php composer.phar update --no-progress --no-suggest --ansi + - php -dmemory_limit=-1 composer.phar update --no-progress --no-suggest --ansi - php phpunit install test_script: From ec92d9b12e21663035b16d6d5f406a1fd2414cc0 Mon Sep 17 00:00:00 2001 From: Titouan Galopin Date: Fri, 8 Dec 2017 15:48:07 +0100 Subject: [PATCH 39/85] Remove some unused variables and properties --- .../FrameworkBundle/Command/ContainerDebugCommand.php | 2 +- src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php | 2 +- src/Symfony/Component/Lock/Store/MemcachedStore.php | 6 ------ src/Symfony/Component/Yaml/Parser.php | 2 -- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index b86df408fd2c3..ccc6b38d92e65 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -246,7 +246,7 @@ public function filterToServiceTypes($serviceId) } try { - $r = new \ReflectionClass($serviceId); + new \ReflectionClass($serviceId); return true; } catch (\ReflectionException $e) { diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 9dd6068351c08..72bbc143cedff 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -32,7 +32,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R private $setCacheItemTags; private $getTagsByKey; private $invalidateTags; - private $tagsPool; + private $tags; public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null) { diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index beaad69962084..8e9db10cd036f 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -24,12 +24,6 @@ */ class MemcachedStore implements StoreInterface { - private static $defaultClientOptions = array( - 'persistent_id' => null, - 'username' => null, - 'password' => null, - ); - private $memcached; private $initialTtl; /** @var bool */ diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index ddab3990fd4bf..ed8121c8107dc 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -362,8 +362,6 @@ private function doParse($value, $flags) @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED); } } else { - // remember the parsed line number here in case we need it to provide some contexts in error messages below - $realCurrentLineNbKey = $this->getRealCurrentLineNb(); $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); if ('<<' === $key) { $this->refs[$refMatches['ref']] = $value; From 41e69782dcb71d4a92ef86705b94eb8048a9c704 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 8 Dec 2017 16:50:58 +0100 Subject: [PATCH 40/85] fix cs --- src/Symfony/Component/HttpFoundation/Request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index e8412b50ef185..63b917a759868 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1862,7 +1862,7 @@ protected function prepareBaseUrl() // Does the baseUrl have anything in common with the request_uri? $requestUri = $this->getRequestUri(); - if ($requestUri !== '' && $requestUri[0] !== '/') { + if ('' !== $requestUri && '/' !== $requestUri[0]) { $requestUri = '/'.$requestUri; } @@ -1940,7 +1940,7 @@ protected function preparePathInfo() if (false !== $pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } - if ($requestUri !== '' && $requestUri[0] !== '/') { + if ('' !== $requestUri && '/' !== $requestUri[0]) { $requestUri = '/'.$requestUri; } From 50644d0d589caf524540e3a1e2fab9dd81fee2c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 8 Dec 2017 17:10:40 +0100 Subject: [PATCH 41/85] [Cache] fix doctrine deprecation --- src/Symfony/Component/Cache/Traits/PdoTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php index 20d1eee1bd1b6..8e1fb4fa48772 100644 --- a/src/Symfony/Component/Cache/Traits/PdoTrait.php +++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php @@ -99,7 +99,7 @@ public function createTable() $table->addColumn($this->idCol, $types[$this->driver], array('length' => 255)); $table->addColumn($this->dataCol, 'blob', array('length' => 16777215)); $table->addColumn($this->lifetimeCol, 'integer', array('unsigned' => true, 'notnull' => false)); - $table->addColumn($this->timeCol, 'integer', array('unsigned' => true, 'foo' => 'bar')); + $table->addColumn($this->timeCol, 'integer', array('unsigned' => true)); $table->setPrimaryKey(array($this->idCol)); foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { From 27dc9a6c7c894a0460321ee0f6183f5544f5410d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 9 Dec 2017 10:48:11 +0100 Subject: [PATCH 42/85] [Debug] Fix catching fatal errors in case of nested error handlers --- src/Symfony/Component/Debug/ErrorHandler.php | 42 +++++++++++++------ .../Debug/Tests/phpt/exception_rethrown.phpt | 36 ++++++++++++++++ .../phpt/fatal_with_nested_handlers.phpt | 40 ++++++++++++++++++ 3 files changed, 106 insertions(+), 12 deletions(-) create mode 100644 src/Symfony/Component/Debug/Tests/phpt/exception_rethrown.phpt create mode 100644 src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 7624d1213f711..8d25904bad7c9 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -485,6 +485,7 @@ public function handleException($exception, array $error = null) $exception = new FatalThrowableError($exception); } $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; + $handlerException = null; if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { $e = array( @@ -529,18 +530,20 @@ public function handleException($exception, array $error = null) } } } - if (empty($this->exceptionHandler)) { - throw $exception; // Give back $exception to the native handler - } try { - call_user_func($this->exceptionHandler, $exception); + if (null !== $this->exceptionHandler) { + return \call_user_func($this->exceptionHandler, $exception); + } + $handlerException = $handlerException ?: $exception; } catch (\Exception $handlerException) { } catch (\Throwable $handlerException) { } - if (isset($handlerException)) { - $this->exceptionHandler = null; - $this->handleException($handlerException); + $this->exceptionHandler = null; + if ($exception === $handlerException) { + self::$reservedMemory = null; // Disable the fatal error handler + throw $exception; // Give back $exception to the native handler } + $this->handleException($handlerException); } /** @@ -556,15 +559,30 @@ public static function handleFatalError(array $error = null) return; } - self::$reservedMemory = null; + $handler = self::$reservedMemory = null; + $handlers = array(); - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); + while (!is_array($handler) || !$handler[0] instanceof self) { + $handler = set_exception_handler('var_dump'); + restore_exception_handler(); - if (!$handler instanceof self) { + if (!$handler) { + break; + } + restore_exception_handler(); + array_unshift($handlers, $handler); + } + foreach ($handlers as $h) { + set_exception_handler($h); + } + if (!$handler) { return; } + if ($handler !== $h) { + $handler[0]->setExceptionHandler($h); + } + $handler = $handler[0]; + $handlers = array(); if ($exit = null === $error) { $error = error_get_last(); diff --git a/src/Symfony/Component/Debug/Tests/phpt/exception_rethrown.phpt b/src/Symfony/Component/Debug/Tests/phpt/exception_rethrown.phpt new file mode 100644 index 0000000000000..877e208f406a7 --- /dev/null +++ b/src/Symfony/Component/Debug/Tests/phpt/exception_rethrown.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test rethrowing in custom exception handler +--FILE-- +setDefaultLogger(new TestLogger()); +ini_set('display_errors', 1); + +throw new \Exception('foo'); + +?> +--EXPECTF-- +Uncaught Exception: foo +123 +Fatal error: Uncaught %s:25 +Stack trace: +%a diff --git a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt new file mode 100644 index 0000000000000..2a9bcf9b0a88e --- /dev/null +++ b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- +setExceptionHandler('print_r'); + +if (true) { + class Broken implements \Serializable {}; +} + +?> +--EXPECTF-- +array(1) { + [0]=> + string(37) "Error and exception handlers do match" +} +object(Symfony\Component\Debug\Exception\FatalErrorException)#4 (8) { + ["message":protected]=> + string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)" +%a +} From 9512f268f4fb5164eee59731adaabba464b7c0df Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 Dec 2017 21:55:31 +0100 Subject: [PATCH 43/85] [DI] Add context to service-not-found exceptions thrown by service locators --- .../RegisterServiceSubscribersPass.php | 2 +- .../Compiler/ServiceLocatorTagPass.php | 15 +++- .../DependencyInjection/ServiceLocator.php | 90 +++++++++++++++++-- .../RegisterServiceSubscribersPassTest.php | 4 +- .../Fixtures/php/services_subscriber.php | 5 +- .../Tests/ServiceLocatorTest.php | 69 ++++++++++++-- 6 files changed, 165 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php index f8dba86a0b547..4ed990ac08d2b 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php @@ -94,7 +94,7 @@ protected function processValue($value, $isRoot = false) throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); } - $value->addTag('container.service_subscriber.locator', array('id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap))); + $value->addTag('container.service_subscriber.locator', array('id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId))); return parent::processValue($value); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php index 2c4a09f8476f9..fb32d501ac29e 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php @@ -72,10 +72,11 @@ protected function processValue($value, $isRoot = false) /** * @param ContainerBuilder $container * @param Reference[] $refMap + * @param string|null $callerId * * @return Reference */ - public static function register(ContainerBuilder $container, array $refMap) + public static function register(ContainerBuilder $container, array $refMap, $callerId = null) { foreach ($refMap as $id => $ref) { if (!$ref instanceof Reference) { @@ -94,6 +95,18 @@ public static function register(ContainerBuilder $container, array $refMap) $container->setDefinition($id, $locator); } + if (null !== $callerId) { + $locatorId = $id; + // Locators are shared when they hold the exact same list of factories; + // to have them specialized per consumer service, we use a cloning factory + // to derivate customized instances from the prototype one. + $container->register($id .= '.'.$callerId, ServiceLocator::class) + ->setPublic(false) + ->setFactory(array(new Reference($locatorId), 'withContext')) + ->addArgument($callerId) + ->addArgument(new Reference('service_container')); + } + return new Reference($id); } } diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php index 270de6b935630..324cccab98913 100644 --- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php @@ -22,6 +22,9 @@ class ServiceLocator implements PsrContainerInterface { private $factories; + private $loading = array(); + private $externalId; + private $container; /** * @param callable[] $factories @@ -45,18 +48,22 @@ public function has($id) public function get($id) { if (!isset($this->factories[$id])) { - throw new ServiceNotFoundException($id, null, null, array_keys($this->factories)); + throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, array(), $this->createServiceNotFoundMessage($id)); } - if (true === $factory = $this->factories[$id]) { - throw new ServiceCircularReferenceException($id, array($id, $id)); + if (isset($this->loading[$id])) { + $ids = array_values($this->loading); + $ids = array_slice($this->loading, array_search($id, $ids)); + $ids[] = $id; + + throw new ServiceCircularReferenceException($id, $ids); } - $this->factories[$id] = true; + $this->loading[$id] = $id; try { - return $factory(); + return $this->factories[$id](); } finally { - $this->factories[$id] = $factory; + unset($this->loading[$id]); } } @@ -64,4 +71,75 @@ public function __invoke($id) { return isset($this->factories[$id]) ? $this->get($id) : null; } + + /** + * @internal + */ + public function withContext($externalId, Container $container) + { + $locator = clone $this; + $locator->externalId = $externalId; + $locator->container = $container; + + return $locator; + } + + private function createServiceNotFoundMessage($id) + { + if ($this->loading) { + return sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $this->formatAlternatives()); + } + + $class = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $class = isset($class[2]['object']) ? get_class($class[2]['object']) : null; + $externalId = $this->externalId ?: $class; + + $msg = sprintf('Service "%s" not found: ', $id); + + if (!$this->container) { + $class = null; + } elseif ($this->container->has($id) || isset($this->container->getRemovedIds()[$id])) { + $msg .= 'even though it exists in the app\'s container, '; + } else { + try { + $this->container->get($id); + $class = null; + } catch (ServiceNotFoundException $e) { + if ($e->getAlternatives()) { + $msg .= sprintf(' did you mean %s? Anyway, ', $this->formatAlternatives($e->getAlternatives(), 'or')); + } else { + $class = null; + } + } + } + if ($externalId) { + $msg .= sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); + } else { + $msg .= sprintf('the current service locator %s', $this->formatAlternatives()); + } + + if (!$class) { + // no-op + } elseif (is_subclass_of($class, ServiceSubscriberInterface::class)) { + $msg .= sprintf(' Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', preg_replace('/([^\\\\]++\\\\)++/', '', $class)); + } else { + $msg .= 'Try using dependency injection instead.'; + } + + return $msg; + } + + private function formatAlternatives(array $alternatives = null, $separator = 'and') + { + $format = '"%s"%s'; + if (null === $alternatives) { + if (!$alternatives = array_keys($this->factories)) { + return 'is empty...'; + } + $format = sprintf('only knows about the %s service%s.', $format, 1 < count($alternatives) ? 's' : ''); + } + $last = array_pop($alternatives); + + return sprintf($format, $alternatives ? implode('", "', $alternatives) : $last, $alternatives ? sprintf(' %s "%s"', $separator, $last) : ''); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php index 957a04c6c48c7..42f994e821d97 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -85,7 +85,7 @@ public function testNoAttributes() 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), ); - $this->assertEquals($expected, $locator->getArgument(0)); + $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } public function testWithAttributes() @@ -115,7 +115,7 @@ public function testWithAttributes() 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), ); - $this->assertEquals($expected, $locator->getArgument(0)); + $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php index 967d8012680bc..f682e9752ca6e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php @@ -45,6 +45,7 @@ public function getRemovedIds() 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, 'service_locator.jmktfsv' => true, + 'service_locator.jmktfsv.foo_service' => true, ); } @@ -82,7 +83,7 @@ protected function getTestServiceSubscriberService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { + return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(\call_user_func(array(new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition()) && false ?: '_'}); }, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber()) && false ?: '_'}); @@ -90,7 +91,7 @@ protected function getFooServiceService() $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber()) && false ?: '_'}); }, 'baz' => function () { $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition()) && false ?: '_'}); - }))); + })), 'withContext'), 'foo_service', $this)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php index a1e2fff50fdbe..56fac643eb40b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php @@ -12,8 +12,9 @@ namespace Symfony\Component\DependencyInjection\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ServiceLocator; +use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; class ServiceLocatorTest extends TestCase { @@ -59,7 +60,7 @@ public function testGetDoesNotMemoize() /** * @expectedException \Psr\Container\NotFoundExceptionInterface - * @expectedExceptionMessage You have requested a non-existent service "dummy". Did you mean one of these: "foo", "bar"? + * @expectedExceptionMessage Service "dummy" not found: the container inside "Symfony\Component\DependencyInjection\Tests\ServiceLocatorTest" is a smaller service locator that only knows about the "foo" and "bar" services. */ public function testGetThrowsOnUndefinedService() { @@ -68,13 +69,50 @@ public function testGetThrowsOnUndefinedService() 'bar' => function () { return 'baz'; }, )); - try { - $locator->get('dummy'); - } catch (ServiceNotFoundException $e) { - $this->assertSame(array('foo', 'bar'), $e->getAlternatives()); + $locator->get('dummy'); + } + + /** + * @expectedException \Psr\Container\NotFoundExceptionInterface + * @expectedExceptionMessage The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service. + */ + public function testThrowsOnUndefinedInternalService() + { + $locator = new ServiceLocator(array( + 'foo' => function () use (&$locator) { return $locator->get('bar'); }, + )); + + $locator->get('foo'); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + * @expectedExceptionMessage Circular reference detected for service "bar", path: "bar -> baz -> bar". + */ + public function testThrowsOnCircularReference() + { + $locator = new ServiceLocator(array( + 'foo' => function () use (&$locator) { return $locator->get('bar'); }, + 'bar' => function () use (&$locator) { return $locator->get('baz'); }, + 'baz' => function () use (&$locator) { return $locator->get('bar'); }, + )); - throw $e; - } + $locator->get('foo'); + } + + /** + * @expectedException \Psr\Container\NotFoundExceptionInterface + * @expectedExceptionMessage Service "foo" not found: even though it exists in the app's container, the container inside "caller" is a smaller service locator that only knows about the "bar" service. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "SomeServiceSubscriber::getSubscribedServices()". + */ + public function testThrowsInServiceSubscriber() + { + $container = new Container(); + $container->set('foo', new \stdClass()); + $subscriber = new SomeServiceSubscriber(); + $subscriber->container = new ServiceLocator(array('bar' => function () {})); + $subscriber->container = $subscriber->container->withContext('caller', $container); + + $subscriber->getFoo(); } public function testInvoke() @@ -89,3 +127,18 @@ public function testInvoke() $this->assertNull($locator('dummy'), '->__invoke() should return null on invalid service'); } } + +class SomeServiceSubscriber implements ServiceSubscriberinterface +{ + public $container; + + public function getFoo() + { + return $this->container->get('foo'); + } + + public static function getSubscribedServices() + { + return array('bar' => 'stdClass'); + } +} From e85b371d722dd56a628bd42923f420272f3a463d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 9 Dec 2017 13:45:27 +0100 Subject: [PATCH 44/85] [HttpKernel] Fix logging of post-terminate errors/exceptions --- .../EventListener/DebugHandlersListener.php | 28 ++++++++++++------- .../Component/HttpKernel/HttpKernel.php | 8 ++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 6ce295b0fdfcf..0bcef55df9aef 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -36,6 +36,7 @@ class DebugHandlersListener implements EventSubscriberInterface private $scream; private $fileLinkFormat; private $firstCall = true; + private $hasTerminatedWithException; /** * @param callable|null $exceptionHandler A handler that will be called on Exception @@ -60,14 +61,16 @@ public function __construct($exceptionHandler, LoggerInterface $logger = null, $ */ public function configure(Event $event = null) { - if (!$this->firstCall) { + if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) { return; } - $this->firstCall = false; + $this->firstCall = $this->hasTerminatedWithException = false; + + $handler = set_exception_handler('var_dump'); + $handler = is_array($handler) ? $handler[0] : null; + restore_exception_handler(); + if ($this->logger || null !== $this->throwAt) { - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); if ($handler instanceof ErrorHandler) { if ($this->logger) { $handler->setDefaultLogger($this->logger, $this->levels); @@ -91,8 +94,16 @@ public function configure(Event $event = null) } if (!$this->exceptionHandler) { if ($event instanceof KernelEvent) { - if (method_exists($event->getKernel(), 'terminateWithException')) { - $this->exceptionHandler = array($event->getKernel(), 'terminateWithException'); + if (method_exists($kernel = $event->getKernel(), 'terminateWithException')) { + $request = $event->getRequest(); + $hasRun = &$this->hasTerminatedWithException; + $this->exceptionHandler = function (\Exception $e) use ($kernel, $request, &$hasRun) { + if ($hasRun) { + throw $e; + } + $hasRun = true; + $kernel->terminateWithException($e, $request); + }; } } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { $output = $event->getOutput(); @@ -105,9 +116,6 @@ public function configure(Event $event = null) } } if ($this->exceptionHandler) { - $handler = set_exception_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_exception_handler(); if ($handler instanceof ErrorHandler) { $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler; $handler->setExceptionHandler($h); diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php index f971e248f92c8..60c000f030638 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -78,14 +78,12 @@ public function terminate(Request $request, Response $response) } /** - * @throws \LogicException If the request stack is empty - * * @internal */ - public function terminateWithException(\Exception $exception) + public function terminateWithException(\Exception $exception, Request $request = null) { - if (!$request = $this->requestStack->getMasterRequest()) { - throw new \LogicException('Request stack is empty', 0, $exception); + if (!$request = $request ?: $this->requestStack->getMasterRequest()) { + throw $exception; } $response = $this->handleException($exception, $request, self::MASTER_REQUEST); From 81248bc8556ab5cf2306cd74df73b8a4c0820663 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 9 Dec 2017 23:27:15 +0100 Subject: [PATCH 45/85] [HttpKernel] detect deprecations thrown by container initialization during tests --- src/Symfony/Component/HttpKernel/Kernel.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 42d176612e64e..b777146a29984 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -536,7 +536,8 @@ protected function initializeContainer() if (!$cache->isFresh()) { if ($this->debug) { $collectedLogs = array(); - $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { + $previousHandler = defined('PHPUNIT_COMPOSER_INSTALL'); + $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; } @@ -572,7 +573,7 @@ protected function initializeContainer() $container = $this->buildContainer(); $container->compile(); } finally { - if ($this->debug) { + if ($this->debug && true !== $previousHandler) { restore_error_handler(); file_put_contents($this->getCacheDir().'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); From ef632ec721ac6c908d6228d24299716cd1ec21a7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 10 Dec 2017 10:47:05 +0100 Subject: [PATCH 46/85] [Process] Dont rely on putenv(), it fails on ZTS PHP --- src/Symfony/Component/BrowserKit/Client.php | 1 + src/Symfony/Component/Process/Process.php | 50 +++++++++++-------- .../Component/Process/Tests/ProcessTest.php | 12 +++++ 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 681bf697ef499..26e151e43d9f1 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -343,6 +343,7 @@ protected function doRequestInProcess($request) { $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec'); putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile); + $_ENV['SYMFONY_DEPRECATIONS_SERIALIZE'] = $deprecationsFile; $process = new PhpProcess($this->getScript($request), null, null); $process->run(); diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 3d5ab7d8ff10e..4087dabc14770 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -304,19 +304,16 @@ public function start(callable $callback = null/*, array $env = array()*/) $inheritEnv = true; } - $envBackup = array(); if (null !== $env && $inheritEnv) { - foreach ($env as $k => $v) { - $envBackup[$k] = getenv($k); - putenv(false === $v || null === $v ? $k : "$k=$v"); - } - $env = null; + $env += $this->getDefaultEnv(); } elseif (null !== $env) { @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', E_USER_DEPRECATED); + } else { + $env = $this->getDefaultEnv(); } if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { $this->options['bypass_shell'] = true; - $commandline = $this->prepareWindowsCommandLine($commandline, $envBackup, $env); + $commandline = $this->prepareWindowsCommandLine($commandline, $env); } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { // last exit code is output on the fourth pipe and caught to work around --enable-sigchild $descriptors[3] = array('pipe', 'w'); @@ -332,10 +329,6 @@ public function start(callable $callback = null/*, array $env = array()*/) $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $env, $this->options); - foreach ($envBackup as $k => $v) { - putenv(false === $v ? $k : "$k=$v"); - } - if (!is_resource($this->process)) { throw new RuntimeException('Unable to launch a new process.'); } @@ -1623,7 +1616,7 @@ private function doSignal($signal, $throwException) return true; } - private function prepareWindowsCommandLine($cmd, array &$envBackup, array &$env = null) + private function prepareWindowsCommandLine($cmd, array &$env) { $uid = uniqid('', true); $varCount = 0; @@ -1636,7 +1629,7 @@ private function prepareWindowsCommandLine($cmd, array &$envBackup, array &$env [^"%!^]*+ )++ ) | [^"]*+ )"/x', - function ($m) use (&$envBackup, &$env, &$varCache, &$varCount, $uid) { + function ($m) use (&$env, &$varCache, &$varCount, $uid) { if (!isset($m[1])) { return $m[0]; } @@ -1654,13 +1647,7 @@ function ($m) use (&$envBackup, &$env, &$varCache, &$varCount, $uid) { $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"'; $var = $uid.++$varCount; - if (null === $env) { - putenv("$var=$value"); - } else { - $env[$var] = $value; - } - - $envBackup[$var] = false; + $env[$var] = $value; return $varCache[$m[0]] = '!'.$var.'!'; }, @@ -1728,4 +1715,27 @@ private function escapeArgument($argument) return '"'.str_replace(array('"', '^', '%', '!', "\n"), array('""', '"^^"', '"^%"', '"^!"', '!LF!'), $argument).'"'; } + + private function getDefaultEnv() + { + if (\PHP_VERSION_ID >= 70100) { + $env = getenv(); + } else { + $env = array(); + + foreach ($_SERVER as $k => $v) { + if (is_string($v) && false !== $v = getenv($k)) { + $env[$k] = $v; + } + } + } + + foreach ($_ENV as $k => $v) { + if (is_string($v)) { + $env[$k] = $v; + } + } + + return $env; + } } diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index b73a5fa1660ee..c8bf33df8f0d0 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1406,6 +1406,7 @@ public function testSetBadEnv() public function testEnvBackupDoesNotDeleteExistingVars() { putenv('existing_var=foo'); + $_ENV['existing_var'] = 'foo'; $process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"'); $process->setEnv(array('existing_var' => 'bar', 'new_test_var' => 'foo')); $process->inheritEnvironmentVariables(); @@ -1415,6 +1416,9 @@ public function testEnvBackupDoesNotDeleteExistingVars() $this->assertSame('foo', $process->getOutput()); $this->assertSame('foo', getenv('existing_var')); $this->assertFalse(getenv('new_test_var')); + + putenv('existing_var'); + unset($_ENV['existing_var']); } public function testEnvIsInherited() @@ -1422,6 +1426,7 @@ public function testEnvIsInherited() $process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ')); putenv('FOO=BAR'); + $_ENV['FOO'] = 'BAR'; $process->run(); @@ -1429,6 +1434,9 @@ public function testEnvIsInherited() $env = array_intersect_key(unserialize($process->getOutput()), $expected); $this->assertEquals($expected, $env); + + putenv('FOO'); + unset($_ENV['FOO']); } /** @@ -1439,6 +1447,7 @@ public function testInheritEnvDisabled() $process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ')); putenv('FOO=BAR'); + $_ENV['FOO'] = 'BAR'; $this->assertSame($process, $process->inheritEnvironmentVariables(false)); $this->assertFalse($process->areEnvironmentVariablesInherited()); @@ -1450,6 +1459,9 @@ public function testInheritEnvDisabled() unset($expected['FOO']); $this->assertSame($expected, $env); + + putenv('FOO'); + unset($_ENV['FOO']); } public function testGetCommandLine() From 95c1fc82bdb488abadf6b17f4b5a01a84839784d Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 9 Dec 2017 12:56:59 -0600 Subject: [PATCH 47/85] Extend Argon2i support check to account for sodium_compat --- .../Security/Core/Encoder/Argon2iPasswordEncoder.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index c88bce0081941..0362ccc4a277e 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -22,9 +22,15 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE { public static function isSupported() { - return (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) - || \function_exists('sodium_crypto_pwhash_str') - || \extension_loaded('libsodium'); + if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) { + return true; + } + + if (\class_exists('ParagonIE_Sodium_Compat') && \method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) { + return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available(); + } + + return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium'); } /** From d21aa19e4d9432a5928bea5d4dfd124c61126f10 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 11 Dec 2017 09:44:08 +0100 Subject: [PATCH 48/85] minor #25421 grammar typo in docs (michaelKaefer) This PR was merged into the 4.1-dev branch. Discussion ---------- grammar typo in docs | Q | A | ------------- | --- | Branch? | master for features / 2.7 up to 4.0 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no | Deprecations? | yes/no | Tests pass? | yes/no | Fixed tickets | #... | License | MIT | Doc PR | symfony/symfony-docs#... Commits ------- d53c889 grammar typo in docs --- src/Symfony/Component/Lock/StoreInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Lock/StoreInterface.php b/src/Symfony/Component/Lock/StoreInterface.php index 428786b4c8bf6..725a5c28121ce 100644 --- a/src/Symfony/Component/Lock/StoreInterface.php +++ b/src/Symfony/Component/Lock/StoreInterface.php @@ -31,7 +31,7 @@ interface StoreInterface public function save(Key $key); /** - * Waits a key becomes free, then stores the resource. + * Waits until a key becomes free, then stores the resource. * * If the store does not support this feature it should throw a NotSupportedException. * From 8be950f3a40ffe7151cd470b4040b5adf3baa391 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 11 Dec 2017 10:12:53 +0100 Subject: [PATCH 49/85] [Lock] Fix incorrect phpdoc --- src/Symfony/Component/Lock/StoreInterface.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Symfony/Component/Lock/StoreInterface.php b/src/Symfony/Component/Lock/StoreInterface.php index 725a5c28121ce..985c4476d7da6 100644 --- a/src/Symfony/Component/Lock/StoreInterface.php +++ b/src/Symfony/Component/Lock/StoreInterface.php @@ -24,8 +24,6 @@ interface StoreInterface /** * Stores the resource if it's not locked by someone else. * - * @param Key $key key to lock - * * @throws LockConflictedException */ public function save(Key $key); @@ -35,8 +33,6 @@ public function save(Key $key); * * If the store does not support this feature it should throw a NotSupportedException. * - * @param Key $key key to lock - * * @throws LockConflictedException * @throws NotSupportedException */ @@ -47,7 +43,6 @@ public function waitAndSave(Key $key); * * If the store does not support this feature it should throw a NotSupportedException. * - * @param Key $key key to lock * @param float $ttl amount of second to keep the lock in the store * * @throws LockConflictedException @@ -57,16 +52,12 @@ public function putOffExpiration(Key $key, $ttl); /** * Removes a resource from the storage. - * - * @param Key $key key to remove */ public function delete(Key $key); /** * Returns whether or not the resource exists in the storage. * - * @param Key $key key to remove - * * @return bool */ public function exists(Key $key); From 62f5eaef11a04b6d8d893e7b1bf9e037cae146de Mon Sep 17 00:00:00 2001 From: Bob den Otter Date: Mon, 11 Dec 2017 12:11:10 +0100 Subject: [PATCH 50/85] Set `width: auto` on WebProfiler toolbar's reset. --- .../WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 2e05fb89abe71..361ceb03d8a33 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -23,6 +23,7 @@ -moz-box-sizing: content-box; box-sizing: content-box; vertical-align: baseline; + width: auto; } .sf-toolbarreset { From eb073fa3498e2e4a055c7fd278f98e63acda386c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 11 Dec 2017 16:47:32 +0100 Subject: [PATCH 51/85] empty lines don't count for indent detection --- src/Symfony/Component/Yaml/Parser.php | 6 +++--- src/Symfony/Component/Yaml/Tests/ParserTest.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 773837c995588..aeb138a9a1390 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -543,8 +543,8 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) do { $EOF = false; - // comment-like lines do not influence the indentation depth - if ($this->isCurrentLineComment()) { + // empty and comment-like lines do not influence the indentation depth + if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { $EOF = !$this->moveToNextLine(); if (!$EOF) { @@ -571,7 +571,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) $data = array(); if ($this->getCurrentLineIndentation() >= $newIndent) { $data[] = substr($this->currentLine, $newIndent); - } elseif ($this->isCurrentLineComment()) { + } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { $data[] = $this->currentLine; } else { $this->moveToPreviousLine(); diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 73a482b9399c7..ef82f7d65c5d4 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -2073,6 +2073,18 @@ public function indentedMappingData() ); $tests['mapping in sequence starting on a new line'] = array($yaml, $expected); + $yaml = << array( + 'bar' => 'baz', + ), + ); + $tests['blank line at the beginning of an indented mapping value'] = array($yaml, $expected); + return $tests; } } From 089981e40f3da8530238fc29998ddb44b76b1097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Mon, 11 Dec 2017 18:48:41 +0100 Subject: [PATCH 52/85] fixed #25440 --- src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php index 472ccf631b282..4ff85b2181662 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php @@ -73,7 +73,7 @@ public function execute() $func = 'ldap_search'; break; default: - throw new LdapException(sprintf('Could not search in scope %s', $this->options['scopen'])); + throw new LdapException(sprintf('Could not search in scope "%s"', $this->options['scope'])); } $this->search = @$func( From 63208ad9c4d2a55d2b0390369a60414dc38cb402 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 11 Dec 2017 19:56:38 +0100 Subject: [PATCH 53/85] [TwigBridge] Add missing dev requirement for workflow --- .../Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php | 4 ---- src/Symfony/Bridge/Twig/composer.json | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php index 60934c1c2df84..2adf12d99ea88 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php @@ -25,10 +25,6 @@ class WorkflowExtensionTest extends TestCase protected function setUp() { - if (!class_exists(Workflow::class)) { - $this->markTestSkipped('The Workflow component is needed to run tests for this extension.'); - } - $places = array('ordered', 'waiting_for_payment', 'processed'); $transitions = array( new Transition('t1', 'ordered', 'waiting_for_payment'), diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 7ce7dfc007f43..0c95661699cb7 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -20,7 +20,6 @@ "twig/twig": "~1.34|~2.4" }, "require-dev": { - "fig/link-util": "^1.0", "symfony/asset": "~2.8|~3.0", "symfony/finder": "~2.8|~3.0", "symfony/form": "^3.2.10|^3.3.3", @@ -37,7 +36,8 @@ "symfony/console": "~2.8|~3.0", "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", "symfony/expression-language": "~2.8|~3.0", - "symfony/web-link": "~3.3" + "symfony/web-link": "~3.3", + "symfony/workflow": "~3.3" }, "conflict": { "symfony/form": "<3.2.10|~3.3,<3.3.3" From 8d0b7528bc4a523f26332b275eaa5187e4b72e5f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 11 Dec 2017 12:12:30 -0800 Subject: [PATCH 54/85] [LDAP] added missing dots at the end of some exception messages. --- src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php | 8 ++++---- src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php | 4 ++-- .../Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php | 2 +- .../Component/Ldap/Adapter/ExtLdap/EntryManager.php | 8 ++++---- src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php index d9b2dd4f5d4ea..581cf153ed652 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php @@ -48,7 +48,7 @@ public function count() return $count; } - throw new LdapException(sprintf('Error while retrieving entry count: %s', ldap_error($this->connection->getResource()))); + throw new LdapException(sprintf('Error while retrieving entry count: %s.', ldap_error($this->connection->getResource()))); } public function getIterator() @@ -62,7 +62,7 @@ public function getIterator() } if (false === $current) { - throw new LdapException(sprintf('Could not rewind entries array: %s', ldap_error($con))); + throw new LdapException(sprintf('Could not rewind entries array: %s.', ldap_error($con))); } yield $this->getSingleEntry($con, $current); @@ -105,7 +105,7 @@ private function getSingleEntry($con, $current) $attributes = ldap_get_attributes($con, $current); if (false === $attributes) { - throw new LdapException(sprintf('Could not fetch attributes: %s', ldap_error($con))); + throw new LdapException(sprintf('Could not fetch attributes: %s.', ldap_error($con))); } $attributes = $this->cleanupAttributes($attributes); @@ -113,7 +113,7 @@ private function getSingleEntry($con, $current) $dn = ldap_get_dn($con, $current); if (false === $dn) { - throw new LdapException(sprintf('Could not fetch DN: %s', ldap_error($con))); + throw new LdapException(sprintf('Could not fetch DN: %s.', ldap_error($con))); } return new Entry($dn, $attributes); diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php index d705b3bce9d13..1a6ea28ac6505 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php @@ -134,11 +134,11 @@ private function connect() } if (false === $this->connection) { - throw new LdapException(sprintf('Could not connect to Ldap server: %s', ldap_error($this->connection))); + throw new LdapException(sprintf('Could not connect to Ldap server: %s.', ldap_error($this->connection))); } if ('tls' === $this->config['encryption'] && false === ldap_start_tls($this->connection)) { - throw new LdapException(sprintf('Could not initiate TLS connection: %s', ldap_error($this->connection))); + throw new LdapException(sprintf('Could not initiate TLS connection: %s.', ldap_error($this->connection))); } } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php index 95d65e020a63f..6d878aa699061 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php @@ -65,7 +65,7 @@ public static function getOption($name) $constantName = self::getOptionName($name); if (!defined($constantName)) { - throw new LdapException(sprintf('Unknown option "%s"', $name)); + throw new LdapException(sprintf('Unknown option "%s".', $name)); } return constant($constantName); diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php index 225414884bea2..871c4b049562d 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php @@ -38,7 +38,7 @@ public function add(Entry $entry) $con = $this->getConnectionResource(); if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) { - throw new LdapException(sprintf('Could not add entry "%s": %s', $entry->getDn(), ldap_error($con))); + throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con))); } return $this; @@ -52,7 +52,7 @@ public function update(Entry $entry) $con = $this->getConnectionResource(); if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) { - throw new LdapException(sprintf('Could not update entry "%s": %s', $entry->getDn(), ldap_error($con))); + throw new LdapException(sprintf('Could not update entry "%s": %s.', $entry->getDn(), ldap_error($con))); } } @@ -64,7 +64,7 @@ public function remove(Entry $entry) $con = $this->getConnectionResource(); if (!@ldap_delete($con, $entry->getDn())) { - throw new LdapException(sprintf('Could not remove entry "%s": %s', $entry->getDn(), ldap_error($con))); + throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con))); } } @@ -76,7 +76,7 @@ public function rename(Entry $entry, $newRdn, $removeOldRdn = true) $con = $this->getConnectionResource(); if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) { - throw new LdapException(sprintf('Could not rename entry "%s" to "%s": %s', $entry->getDn(), $newRdn, ldap_error($con))); + throw new LdapException(sprintf('Could not rename entry "%s" to "%s": %s.', $entry->getDn(), $newRdn, ldap_error($con))); } } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php index 4ff85b2181662..09cb42c7d38ee 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php @@ -45,7 +45,7 @@ public function __destruct() $this->search = null; if (!$success) { - throw new LdapException(sprintf('Could not free results: %s', ldap_error($con))); + throw new LdapException(sprintf('Could not free results: %s.', ldap_error($con))); } } @@ -73,7 +73,7 @@ public function execute() $func = 'ldap_search'; break; default: - throw new LdapException(sprintf('Could not search in scope "%s"', $this->options['scope'])); + throw new LdapException(sprintf('Could not search in scope "%s".', $this->options['scope'])); } $this->search = @$func( @@ -89,7 +89,7 @@ public function execute() } if (false === $this->search) { - throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s"', $this->dn, $this->query, implode(',', $this->options['filter']))); + throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s".', $this->dn, $this->query, implode(',', $this->options['filter']))); } return new Collection($this->connection, $this); From 48832e640aba09724ced901dac33961a93b631d8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 17 Oct 2017 21:54:44 -0400 Subject: [PATCH 55/85] Tweaking class not found autowiring error --- .../DependencyInjection/Compiler/AutowirePass.php | 13 ++++++++++++- .../Tests/Compiler/AutowirePassTest.php | 6 +++--- .../Component/DependencyInjection/composer.json | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index a59444fcac375..58c1a9c097060 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -11,6 +11,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; +use Symfony\Component\Config\Resource\ClassExistenceResource; use Symfony\Component\DependencyInjection\Config\AutowireServiceResource; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -485,7 +486,17 @@ private function createAutowiredDefinition($type) private function createTypeNotFoundMessage(TypedReference $reference, $label) { if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) { - $message = sprintf('has type "%s" but this class cannot be loaded.', $type); + // either $type does not exist or a parent class does not exist + try { + $resource = new ClassExistenceResource($type, false); + // isFresh() will explode ONLY if a parent class/trait does not exist + $resource->isFresh(0); + $parentMsg = false; + } catch (\ReflectionException $e) { + $parentMsg = $e->getMessage(); + } + + $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); } else { $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $this->createTypeAlternatives($reference)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index 757db3f229c95..cae761e0ab7fe 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -359,7 +359,7 @@ public function testDontTriggerAutowiring() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException - * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class cannot be loaded. + * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found. */ public function testClassNotFoundThrowsException() { @@ -374,7 +374,7 @@ public function testClassNotFoundThrowsException() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException - * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class cannot be loaded. + * @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found). */ public function testParentClassNotFoundThrowsException() { @@ -761,7 +761,7 @@ public function testNotWireableCalls($method, $expectedMsg) public function provideNotWireableCalls() { return array( - array('setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class cannot be loaded.'), + array('setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.'), array('setDifferentNamespace', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setDifferentNamespace()" references class "stdClass" but no such service exists. It cannot be auto-registered because it is from a different root namespace.'), array(null, 'Cannot autowire service "foo": method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setProtectedMethod()" must be public.'), ); diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index 0ce0ffeeaf57b..5f79b192e04ee 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -32,7 +32,7 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them" }, "conflict": { - "symfony/config": "<3.3.1", + "symfony/config": "<3.3.7", "symfony/finder": "<3.3", "symfony/yaml": "<3.3" }, From fe41155ea1293cf40c5c052ae442b5e5cb9c28aa Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 11 Dec 2017 20:35:50 +0100 Subject: [PATCH 56/85] [Process] remove false-positive BC breaking exception on Windows --- src/Symfony/Component/Process/Process.php | 4 --- .../Component/Process/Tests/ProcessTest.php | 26 ------------------- 2 files changed, 30 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 7f490785e0783..af6f8f9787522 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -331,10 +331,6 @@ public function start(callable $callback = null/*, array $env = array()*/) } if (!is_dir($this->cwd)) { - if ('\\' === DIRECTORY_SEPARATOR) { - throw new RuntimeException('The provided cwd does not exist.'); - } - @trigger_error('The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since version 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); } diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 6af470b58acd9..e741a8308f370 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -54,10 +54,6 @@ protected function tearDown() */ public function testInvalidCwd() { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Windows handles this automatically.'); - } - // Check that it works fine if the CWD exists $cmd = new Process('echo test', __DIR__); $cmd->run(); @@ -66,28 +62,6 @@ public function testInvalidCwd() $cmd->run(); } - /** - * @expectedException \Symfony\Component\Process\Exception\RuntimeException - * @expectedExceptionMessage The provided cwd does not exist. - */ - public function testInvalidCwdOnWindows() - { - if ('\\' !== DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Unix handles this automatically.'); - } - - try { - // Check that it works fine if the CWD exists - $cmd = new Process('echo test', __DIR__); - $cmd->run(); - } catch (\Exception $e) { - $this->fail($e); - } - - $cmd = new Process('echo test', __DIR__.'/notfound/'); - $cmd->run(); - } - public function testThatProcessDoesNotThrowWarningDuringRun() { if ('\\' === DIRECTORY_SEPARATOR) { From 484a082eb1d9fb60dce5ee8446b5f0e7f0fb6b7e Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 5 Dec 2017 13:50:29 +0100 Subject: [PATCH 57/85] [DI] Impossible to set an environment variable and then an array as container parameter --- .../DependencyInjection/ContainerBuilder.php | 10 ++++----- .../Tests/ContainerBuilderTest.php | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c3aee4e6fd35a..6781883f4d482 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -1294,6 +1294,11 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs $format = '%%env(%s)%%'; } + $bag = $this->getParameterBag(); + if (true === $format) { + $value = $bag->resolveValue($value); + } + if (is_array($value)) { $result = array(); foreach ($value as $k => $v) { @@ -1306,11 +1311,6 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs if (!is_string($value)) { return $value; } - - $bag = $this->getParameterBag(); - if (true === $format) { - $value = $bag->resolveValue($value); - } $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; foreach ($envPlaceholders as $env => $placeholders) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 8b905746b2e43..785df13303ce2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -615,6 +615,28 @@ public function testResolveEnvValues() unset($_ENV['DUMMY_ENV_VAR'], $_SERVER['DUMMY_SERVER_VAR'], $_SERVER['HTTP_DUMMY_VAR']); } + public function testResolveEnvValuesWithArray() + { + $_ENV['ANOTHER_DUMMY_ENV_VAR'] = 'dummy'; + + $dummyArray = array('1' => 'one', '2' => 'two'); + + $container = new ContainerBuilder(); + $container->setParameter('dummy', '%env(ANOTHER_DUMMY_ENV_VAR)%'); + $container->setParameter('dummy2', $dummyArray); + + $container->resolveEnvPlaceholders('%dummy%', true); + $container->resolveEnvPlaceholders('%dummy2%', true); + + $this->assertInternalType('array', $container->resolveEnvPlaceholders('%dummy2%', true)); + + foreach ($dummyArray as $key => $value) { + $this->assertArrayHasKey($key, $container->resolveEnvPlaceholders('%dummy2%', true)); + } + + unset($_ENV['ANOTHER_DUMMY_ENV_VAR']); + } + public function testCompileWithResolveEnv() { putenv('DUMMY_ENV_VAR=du%%y'); From 9f1c9bd964dd9e3063cc0cbf37a07b2ea6aed72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Tue, 5 Dec 2017 09:56:13 +0100 Subject: [PATCH 58/85] [HttpFoundation] Support 0 bit netmask in IPv6 () --- src/Symfony/Component/HttpFoundation/IpUtils.php | 4 ++++ src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index 3bb33140f5055..86d135b2d3afd 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -123,6 +123,10 @@ public static function checkIp6($requestIp, $ip) if (false !== strpos($ip, '/')) { list($address, $netmask) = explode('/', $ip, 2); + if ('0' === $netmask) { + return (bool) unpack('n*', @inet_pton($address)); + } + if ($netmask < 1 || $netmask > 128) { return self::$checkedIps[$cacheKey] = false; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php index 54cbb5c20672d..7a93f9947262d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php @@ -62,6 +62,8 @@ public function getIpv6Data() array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), array(true, '0:0:0:0:0:0:0:1', '::1'), array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), + array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'), + array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'), array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')), array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')), array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')), From dfef227837c79c0ca08af173eb72fec2d1c1e312 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Mon, 13 Nov 2017 17:01:41 +0100 Subject: [PATCH 59/85] Fixed exit code with non-integer throwable code --- src/Symfony/Component/Console/Event/ConsoleErrorEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php index 49edb723d212d..a212a3c287182 100644 --- a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php @@ -78,6 +78,6 @@ public function setExitCode($exitCode) */ public function getExitCode() { - return null !== $this->exitCode ? $this->exitCode : ($this->error->getCode() ?: 1); + return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) ? $this->error->getCode() : 1); } } From fea815b2f5256f285c39398d4af8582d8c5aaa7b Mon Sep 17 00:00:00 2001 From: Bjorn Twachtmann Date: Tue, 17 Oct 2017 15:38:11 +0100 Subject: [PATCH 60/85] [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files --- .../Component/Translation/MessageSelector.php | 12 +++++++++--- .../Translation/Tests/MessageSelectorTest.php | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Translation/MessageSelector.php b/src/Symfony/Component/Translation/MessageSelector.php index c6134191bce08..31304cd0d89ed 100644 --- a/src/Symfony/Component/Translation/MessageSelector.php +++ b/src/Symfony/Component/Translation/MessageSelector.php @@ -49,10 +49,16 @@ class MessageSelector */ public function choose($message, $number, $locale) { - preg_match_all('/(?:\|\||[^\|])++/', $message, $parts); + $parts = array(); + if (preg_match('/^\|++$/', $message)) { + $parts = explode('|', $message); + } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { + $parts = $matches[0]; + } + $explicitRules = array(); $standardRules = array(); - foreach ($parts[0] as $part) { + foreach ($parts as $part) { $part = trim(str_replace('||', '|', $part)); if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/xs', $part, $matches)) { @@ -76,7 +82,7 @@ public function choose($message, $number, $locale) if (!isset($standardRules[$position])) { // when there's exactly one rule given, and that rule is a standard // rule, use this rule - if (1 === count($parts[0]) && isset($standardRules[0])) { + if (1 === count($parts) && isset($standardRules[0])) { return $standardRules[0]; } diff --git a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php index a9b92c5cee5fc..42b7e0a3fada8 100644 --- a/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php +++ b/src/Symfony/Component/Translation/Tests/MessageSelectorTest.php @@ -128,6 +128,10 @@ public function getChooseTests() array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1), // esacape pipe array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0), + // Empty plural set (2 plural forms) from a .PO file + array('', '|', 1), + // Empty plural set (3 plural forms) from a .PO file + array('', '||', 1), ); } } From 567e0ab7e67fd7a8f47a658c47aa71bec63de858 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 11 Dec 2017 19:55:31 -0200 Subject: [PATCH 61/85] Refactoring tests. --- .../CompleteConfigurationTest.php | 2 +- .../MainConfigurationTest.php | 4 +-- .../Config/Tests/ConfigCacheTest.php | 4 +-- .../Builder/ArrayNodeDefinitionTest.php | 2 +- .../Tests/Resource/DirectoryResourceTest.php | 2 +- .../Tests/XPath/TranslatorTest.php | 2 +- .../Tests/ContainerBuilderTest.php | 16 ++++++------ .../Tests/ContainerTest.php | 14 +++++----- .../Tests/Loader/XmlFileLoaderTest.php | 26 +++++++++---------- .../Tests/Loader/YamlFileLoaderTest.php | 10 +++---- .../DomCrawler/Tests/CrawlerTest.php | 2 +- .../Component/DomCrawler/Tests/FormTest.php | 6 ++--- .../ContainerAwareEventDispatcherTest.php | 2 +- .../Tests/GenericEventTest.php | 4 +-- .../Filesystem/Tests/FilesystemTest.php | 24 ++++++++--------- .../Component/Form/Tests/CompoundFormTest.php | 4 +-- .../Extension/Core/Type/ChoiceTypeTest.php | 12 ++++----- .../Core/Type/CollectionTypeTest.php | 6 ++--- .../Extension/Core/Type/DateTimeTypeTest.php | 6 ++--- .../Extension/Core/Type/DateTypeTest.php | 8 +++--- .../Extension/Core/Type/TimeTypeTest.php | 2 +- .../Csrf/Type/FormTypeCsrfExtensionTest.php | 10 +++---- .../ViolationMapper/ViolationPathTest.php | 2 +- .../Form/Tests/Util/OrderedHashMapTest.php | 6 ++--- .../HttpFoundation/Tests/HeaderBagTest.php | 2 +- .../HttpFoundation/Tests/ParameterBagTest.php | 2 +- .../Tests/ResponseHeaderBagTest.php | 18 ++++++------- .../HttpFoundation/Tests/ServerBagTest.php | 8 +++--- .../Session/Attribute/AttributeBagTest.php | 2 +- .../Storage/NativeSessionStorageTest.php | 2 +- .../Storage/PhpBridgeSessionStorageTest.php | 8 +++--- .../DataCollector/DumpDataCollectorTest.php | 2 +- .../Tests/HttpCache/HttpCacheTest.php | 18 ++++++------- .../Profiler/AbstractProfilerStorageTest.php | 12 ++++----- .../HttpKernel/Tests/UriSignerTest.php | 2 +- .../Bundle/Reader/IntlBundleReaderTest.php | 12 ++++----- .../Bundle/Reader/JsonBundleReaderTest.php | 2 +- .../Bundle/Reader/PhpBundleReaderTest.php | 2 +- .../Intl/Tests/Data/Util/RingBufferTest.php | 16 ++++++------ .../Locale/Tests/Stub/StubLocaleTest.php | 2 +- .../Tests/LegacyOptionsResolverTest.php | 4 +-- .../Tests/OptionsResolver2Dot6Test.php | 12 ++++----- .../Component/Process/Tests/ProcessTest.php | 2 +- .../Acl/Tests/Dbal/MutableAclProviderTest.php | 26 +++++++++---------- .../Acl/Tests/Permission/MaskBuilderTest.php | 2 +- .../AuthorizationCheckerTest.php | 6 ++--- .../Core/Tests/LegacySecurityContextTest.php | 2 +- .../Templating/Tests/Helper/HelperTest.php | 2 +- .../Tests/Loader/CacheLoaderTest.php | 2 +- .../Templating/Tests/PhpEngineTest.php | 4 +-- .../Tests/Dumper/CsvFileDumperTest.php | 2 +- .../Tests/Dumper/IcuResFileDumperTest.php | 2 +- .../Tests/Dumper/IniFileDumperTest.php | 2 +- .../Tests/Dumper/JsonFileDumperTest.php | 2 +- .../Tests/Dumper/MoFileDumperTest.php | 2 +- .../Tests/Dumper/PhpFileDumperTest.php | 2 +- .../Tests/Dumper/PoFileDumperTest.php | 2 +- .../Tests/Dumper/QtFileDumperTest.php | 2 +- .../Tests/Dumper/XliffFileDumperTest.php | 5 +--- .../Tests/Dumper/YamlFileDumperTest.php | 2 +- .../Tests/ConstraintViolationListTest.php | 6 ++--- .../Tests/Constraints/GroupSequenceTest.php | 10 +++---- 62 files changed, 192 insertions(+), 195 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 6da50316a4721..e731101486562 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -143,7 +143,7 @@ public function testAccess() list($matcherId, $attributes, $channel) = $rule; $requestMatcher = $container->getDefinition($matcherId); - $this->assertFalse(isset($matcherIds[$matcherId])); + $this->assertArrayNotHasKey($matcherId, $matcherIds); $matcherIds[$matcherId] = true; $i = count($matcherIds); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php index c56a4d8bcb145..3aac20301f0f9 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php @@ -84,9 +84,9 @@ public function testCsrfAliases() $processor = new Processor(); $configuration = new MainConfiguration(array(), array()); $processedConfig = $processor->processConfiguration($configuration, array($config)); - $this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_generator'])); + $this->assertArrayHasKey('csrf_token_generator', $processedConfig['firewalls']['stub']['logout']); $this->assertEquals('a_token_generator', $processedConfig['firewalls']['stub']['logout']['csrf_token_generator']); - $this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_id'])); + $this->assertArrayHasKey('csrf_token_id', $processedConfig['firewalls']['stub']['logout']); $this->assertEquals('a_token_id', $processedConfig['firewalls']['stub']['logout']['csrf_token_id']); } diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php index e6bcd19a8aacd..74fd0993a975d 100644 --- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php @@ -112,7 +112,7 @@ public function testWriteDumpsFile() $cache->write('FOOBAR'); $this->assertFileExists($this->cacheFile, 'Cache file is created'); - $this->assertSame('FOOBAR', file_get_contents($this->cacheFile)); + $this->assertStringEqualsFile($this->cacheFile, 'FOOBAR'); $this->assertFileNotExists($this->metaFile, 'Meta file is not created'); } @@ -128,7 +128,7 @@ public function testWriteDumpsMetaFileWithDebugEnabled() $this->assertFileExists($this->cacheFile, 'Cache file is created'); $this->assertFileExists($this->metaFile, 'Meta file is created'); - $this->assertSame(serialize($metadata), file_get_contents($this->metaFile)); + $this->assertStringEqualsFile($this->metaFile, serialize($metadata)); } private function makeCacheFresh() diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 63efd719b5f59..16a38c30b0f9d 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -32,7 +32,7 @@ public function testAppendingSomeNode() ->append($child); $this->assertCount(3, $this->getField($parent, 'children')); - $this->assertTrue(in_array($child, $this->getField($parent, 'children'))); + $this->assertContains($child, $this->getField($parent, 'children')); } /** diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php index 60bd616a41de5..91e7206326bd7 100644 --- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -164,6 +164,6 @@ public function testResourcesWithDifferentPatternsAreDifferent() $resourceA = new DirectoryResource($this->directory, '/.xml$/'); $resourceB = new DirectoryResource($this->directory, '/.yaml$/'); - $this->assertEquals(2, count(array_unique(array($resourceA, $resourceB)))); + $this->assertCount(2, array_unique(array($resourceA, $resourceB))); } } diff --git a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php index 79e2da14bb249..218a3b43c1a78 100644 --- a/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php +++ b/src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php @@ -37,7 +37,7 @@ public function testXmlLang($css, array $elementsId) $translator = new Translator(); $document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml')); $elements = $document->xpath($translator->cssToXPath($css)); - $this->assertEquals(count($elementsId), count($elements)); + $this->assertCount(count($elementsId), $elements); foreach ($elements as $element) { $this->assertTrue(in_array($element->attributes()->id, $elementsId)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 32e1b99adb255..89ce96cc7c207 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -49,7 +49,7 @@ public function testDefinitions() $builder->setDefinition('foobar', $foo = new Definition('FooBarClass')); $this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined'); - $this->assertTrue($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')) === $foo, '->setDefinition() implements a fluid interface by returning the service reference'); + $this->assertSame($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')), $foo, '->setDefinition() implements a fluid interface by returning the service reference'); $builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass'))); $this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions'); @@ -163,7 +163,7 @@ public function testAliases() $this->assertFalse($builder->hasAlias('foobar'), '->hasAlias() returns false if the alias does not exist'); $this->assertEquals('foo', (string) $builder->getAlias('bar'), '->getAlias() returns the aliased service'); $this->assertTrue($builder->has('bar'), '->setAlias() defines a new service'); - $this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one'); + $this->assertSame($builder->get('bar'), $builder->get('foo'), '->setAlias() creates a service that is an alias to another one'); try { $builder->setAlias('foobar', 'foobar'); @@ -208,8 +208,8 @@ public function testSetAliases() $builder->setAliases(array('bar' => 'foo', 'foobar' => 'foo')); $aliases = $builder->getAliases(); - $this->assertTrue(isset($aliases['bar'])); - $this->assertTrue(isset($aliases['foobar'])); + $this->assertArrayHasKey('bar', $aliases); + $this->assertArrayHasKey('foobar', $aliases); } public function testAddAliases() @@ -219,8 +219,8 @@ public function testAddAliases() $builder->addAliases(array('foobar' => 'foo')); $aliases = $builder->getAliases(); - $this->assertTrue(isset($aliases['bar'])); - $this->assertTrue(isset($aliases['foobar'])); + $this->assertArrayHasKey('bar', $aliases); + $this->assertArrayHasKey('foobar', $aliases); } public function testSetReplacesAlias() @@ -480,7 +480,7 @@ public function testMerge() $this->assertEquals(array('foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); $aliases = $container->getAliases(); - $this->assertTrue(isset($aliases['alias_for_foo'])); + $this->assertArrayHasKey('alias_for_foo', $aliases); $this->assertEquals('foo', (string) $aliases['alias_for_foo']); $container = new ContainerBuilder(); @@ -619,7 +619,7 @@ public function testExtension() $container->setResourceTracking(false); $container->registerExtension($extension = new \ProjectExtension()); - $this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension'); + $this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension'); $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException'); $container->getExtension('no_registered'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 5ec0deed3d3a4..129b701d8098f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -172,7 +172,7 @@ public function testSetAlsoSetsScopedService() $c->set('foo', $foo = new \stdClass(), 'foo'); $scoped = $this->getField($c, 'scopedServices'); - $this->assertTrue(isset($scoped['foo']['foo']), '->set() sets a scoped service'); + $this->assertArrayHasKey('foo', $scoped['foo'], '->set() sets a scoped service'); $this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service'); } @@ -340,14 +340,14 @@ public function testEnterLeaveScopeWithChildScopes() $container->set('a', $a, 'bar'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertTrue(isset($scoped['bar']['a'])); + $this->assertArrayHasKey('a', $scoped['bar']); $this->assertSame($a, $scoped['bar']['a']); $this->assertTrue($container->has('a')); $container->leaveScope('foo'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertFalse(isset($scoped['bar'])); + $this->assertArrayNotHasKey('bar', $scoped); $this->assertFalse($container->isScopeActive('foo')); $this->assertFalse($container->has('a')); } @@ -370,14 +370,14 @@ public function testEnterScopeRecursivelyWithInactiveChildScopes() $container->set('a', $a, 'foo'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertTrue(isset($scoped['foo']['a'])); + $this->assertArrayHasKey('a', $scoped['foo']); $this->assertSame($a, $scoped['foo']['a']); $this->assertTrue($container->has('a')); $container->enterScope('foo'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertFalse(isset($scoped['a'])); + $this->assertArrayNotHasKey('a', $scoped); $this->assertTrue($container->isScopeActive('foo')); $this->assertFalse($container->isScopeActive('bar')); $this->assertFalse($container->has('a')); @@ -409,14 +409,14 @@ public function testEnterChildScopeRecursively() $container->set('a', $a, 'bar'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertTrue(isset($scoped['bar']['a'])); + $this->assertArrayHasKey('a', $scoped['bar']); $this->assertSame($a, $scoped['bar']['a']); $this->assertTrue($container->has('a')); $container->enterScope('bar'); $scoped = $this->getField($container, 'scopedServices'); - $this->assertFalse(isset($scoped['a'])); + $this->assertArrayNotHasKey('a', $scoped); $this->assertTrue($container->isScopeActive('foo')); $this->assertTrue($container->isScopeActive('bar')); $this->assertFalse($container->has('a')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 82cef6f1270b9..ca2ad7d0eaf0e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -94,7 +94,7 @@ public function testLoadWithExternalEntitiesDisabled() libxml_disable_entity_loader($disableEntities); - $this->assertTrue(count($containerBuilder->getParameterBag()->all()) > 0, 'Parameters can be read from the config file.'); + $this->assertGreaterThan(0, $containerBuilder->getParameterBag()->all(), 'Parameters can be read from the config file.'); } public function testLoadParameters() @@ -182,7 +182,7 @@ public function testLoadAnonymousServices() $args = $services['foo']->getArguments(); $this->assertCount(1, $args, '->load() references anonymous services as "normal" ones'); $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services'); - $this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones'); + $this->assertArrayHasKey((string) $args[0], $services, '->load() makes a reference to the created ones'); $inner = $services[(string) $args[0]]; $this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); $this->assertFalse($inner->isPublic()); @@ -191,7 +191,7 @@ public function testLoadAnonymousServices() $args = $inner->getArguments(); $this->assertCount(1, $args, '->load() references anonymous services as "normal" ones'); $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services'); - $this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones'); + $this->assertArrayHasKey((string) $args[0], $services, '->load() makes a reference to the created ones'); $inner = $services[(string) $args[0]]; $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); $this->assertFalse($inner->isPublic()); @@ -200,7 +200,7 @@ public function testLoadAnonymousServices() $properties = $services['foo']->getProperties(); $property = $properties['p']; $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $property, '->load() converts anonymous services to references to "normal" services'); - $this->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones'); + $this->assertArrayHasKey((string) $property, $services, '->load() makes a reference to the created ones'); $inner = $services[(string) $property]; $this->assertEquals('BuzClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); $this->assertFalse($inner->isPublic()); @@ -249,7 +249,7 @@ public function testLoadServices() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services6.xml'); $services = $container->getDefinitions(); - $this->assertTrue(isset($services['foo']), '->load() parses elements'); + $this->assertArrayHasKey('foo', $services, '->load() parses elements'); $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('container', $services['scope.container']->getScope()); @@ -267,10 +267,10 @@ public function testLoadServices() $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $aliases = $container->getAliases(); - $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses elements'); + $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses elements'); $this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); $this->assertTrue($aliases['alias_for_foo']->isPublic()); - $this->assertTrue(isset($aliases['another_alias_for_foo'])); + $this->assertArrayHasKey('another_alias_for_foo', $aliases); $this->assertEquals('foo', (string) $aliases['another_alias_for_foo']); $this->assertFalse($aliases['another_alias_for_foo']->isPublic()); @@ -366,8 +366,8 @@ public function testExtensions() $services = $container->getDefinitions(); $parameters = $container->getParameterBag()->all(); - $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); - $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + $this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements'); + $this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements'); $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); @@ -382,8 +382,8 @@ public function testExtensions() $services = $container->getDefinitions(); $parameters = $container->getParameterBag()->all(); - $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); - $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + $this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements'); + $this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements'); $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); @@ -504,8 +504,8 @@ public function testXmlNamespaces() $loader->load('namespaces.xml'); $services = $container->getDefinitions(); - $this->assertTrue(isset($services['foo']), '->load() parses elements'); - $this->assertEquals(1, count($services['foo']->getTag('foo.tag')), '->load parses elements'); + $this->assertArrayHasKey('foo', $services, '->load() parses elements'); + $this->assertCount(1, $services['foo']->getTag('foo.tag'), '->load parses elements'); $this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the tag'); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 644c8711b78b1..85c74b572d080 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -142,7 +142,7 @@ public function testLoadServices() $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services6.yml'); $services = $container->getDefinitions(); - $this->assertTrue(isset($services['foo']), '->load() parses service elements'); + $this->assertArrayHasKey('foo', $services, '->load() parses service elements'); $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('container', $services['scope.container']->getScope()); @@ -160,10 +160,10 @@ public function testLoadServices() $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $aliases = $container->getAliases(); - $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases'); + $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses aliases'); $this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); $this->assertTrue($aliases['alias_for_foo']->isPublic()); - $this->assertTrue(isset($aliases['another_alias_for_foo'])); + $this->assertArrayHasKey('another_alias_for_foo', $aliases); $this->assertEquals('foo', (string) $aliases['another_alias_for_foo']); $this->assertFalse($aliases['another_alias_for_foo']->isPublic()); @@ -192,8 +192,8 @@ public function testExtensions() $services = $container->getDefinitions(); $parameters = $container->getParameterBag()->all(); - $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); - $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + $this->assertArrayHasKey('project.service.bar', $services, '->load() parses extension elements'); + $this->assertArrayHasKey('project.parameter.bar', $parameters, '->load() parses extension elements'); $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index 335406ab2460d..3ba9247618373 100644 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -172,7 +172,7 @@ public function testAddXmlContentWithErrors() EOF , 'UTF-8'); - $this->assertTrue(count(libxml_get_errors()) > 1); + $this->assertGreaterThan(1, libxml_get_errors()); libxml_clear_errors(); libxml_use_internal_errors($internalErrors); diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 437a5ddaf0cbf..258a997a285f2 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -370,15 +370,15 @@ public function testOffsetUnset() { $form = $this->createForm('
'); unset($form['foo']); - $this->assertFalse(isset($form['foo']), '->offsetUnset() removes a field'); + $this->assertArrayNotHasKey('foo', $form, '->offsetUnset() removes a field'); } public function testOffsetExists() { $form = $this->createForm('
'); - $this->assertTrue(isset($form['foo']), '->offsetExists() return true if the field exists'); - $this->assertFalse(isset($form['bar']), '->offsetExists() return false if the field does not exist'); + $this->assertArrayHasKey('foo', $form, '->offsetExists() return true if the field exists'); + $this->assertArrayNotHasKey('bar', $form, '->offsetExists() return false if the field does not exist'); } public function testGetValues() diff --git a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php index 18aac429d4c84..b71f72da51b0b 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -206,7 +206,7 @@ public function testGetListenersOnLazyLoad() $listeners = $dispatcher->getListeners(); - $this->assertTrue(isset($listeners['onEvent'])); + $this->assertArrayHasKey('onEvent', $listeners); $this->assertCount(1, $dispatcher->getListeners('onEvent')); } diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php index c84d3ac24c3b1..9cf68c987f0da 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php @@ -114,8 +114,8 @@ public function testOffsetUnset() public function testOffsetIsset() { - $this->assertTrue(isset($this->event['name'])); - $this->assertFalse(isset($this->event['nameNotExist'])); + $this->assertArrayHasKey('name', $this->event); + $this->assertArrayNotHasKey('nameNotExist', $this->event); } public function testHasArgument() diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 3c50131db2f43..9172dd7877633 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -26,7 +26,7 @@ public function testCopyCreatesNewFile() $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); - $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } /** @@ -73,7 +73,7 @@ public function testCopyOverridesExistingFileIfModified() $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); - $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } public function testCopyDoesNotOverrideExistingFileByDefault() @@ -92,7 +92,7 @@ public function testCopyDoesNotOverrideExistingFileByDefault() $this->filesystem->copy($sourceFilePath, $targetFilePath); $this->assertFileExists($targetFilePath); - $this->assertEquals('TARGET FILE', file_get_contents($targetFilePath)); + $this->assertStringEqualsFile($targetFilePath, 'TARGET FILE'); } public function testCopyOverridesExistingFileIfForced() @@ -111,7 +111,7 @@ public function testCopyOverridesExistingFileIfForced() $this->filesystem->copy($sourceFilePath, $targetFilePath, true); $this->assertFileExists($targetFilePath); - $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } /** @@ -153,7 +153,7 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist() $this->assertTrue(is_dir($targetFileDirectory)); $this->assertFileExists($targetFilePath); - $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + $this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE'); } /** @@ -772,9 +772,9 @@ public function testRemoveSymlink() $this->filesystem->remove($link); - $this->assertTrue(!is_link($link)); - $this->assertTrue(!is_file($link)); - $this->assertTrue(!is_dir($link)); + $this->assertFalse(is_link($link)); + $this->assertFalse(is_file($link)); + $this->assertFalse(is_dir($link)); } public function testSymlinkIsOverwrittenIfPointsToDifferentTarget() @@ -1095,7 +1095,7 @@ public function testDumpFile() $this->filesystem->dumpFile($filename, 'bar'); $this->assertFileExists($filename); - $this->assertSame('bar', file_get_contents($filename)); + $this->assertStringEqualsFile($filename, 'bar'); } /** @@ -1108,7 +1108,7 @@ public function testDumpFileAndSetPermissions() $this->filesystem->dumpFile($filename, 'bar', 0753); $this->assertFileExists($filename); - $this->assertSame('bar', file_get_contents($filename)); + $this->assertStringEqualsFile($filename, 'bar'); // skip mode check on Windows if ('\\' !== DIRECTORY_SEPARATOR) { @@ -1123,7 +1123,7 @@ public function testDumpFileWithNullMode() $this->filesystem->dumpFile($filename, 'bar', null); $this->assertFileExists($filename); - $this->assertSame('bar', file_get_contents($filename)); + $this->assertStringEqualsFile($filename, 'bar'); // skip mode check on Windows if ('\\' !== DIRECTORY_SEPARATOR) { @@ -1139,7 +1139,7 @@ public function testDumpFileOverwritesAnExistingFile() $this->filesystem->dumpFile($filename, 'bar'); $this->assertFileExists($filename); - $this->assertSame('bar', file_get_contents($filename)); + $this->assertStringEqualsFile($filename, 'bar'); } public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile() diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index b9b93e54c1637..5f638b68fe431 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -309,12 +309,12 @@ public function testArrayAccess() $this->form[] = $child; - $this->assertTrue(isset($this->form['foo'])); + $this->assertArrayHasKey('foo', $this->form); $this->assertSame($child, $this->form['foo']); unset($this->form['foo']); - $this->assertFalse(isset($this->form['foo'])); + $this->assertArrayNotHasKey('foo', $this->form); } public function testCountable() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 3e36c7dd2936a..9b0983eac5937 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -243,7 +243,7 @@ public function testPlaceholderPresentOnNonRequiredExpandedSingleChoice() 'choices_as_values' => true, )); - $this->assertTrue(isset($form['placeholder'])); + $this->assertArrayHasKey('placeholder', $form); $this->assertCount(count($this->choices) + 1, $form, 'Each choice should become a new field'); } @@ -257,7 +257,7 @@ public function testPlaceholderNotPresentIfRequired() 'choices_as_values' => true, )); - $this->assertFalse(isset($form['placeholder'])); + $this->assertArrayNotHasKey('placeholder', $form); $this->assertCount(count($this->choices), $form, 'Each choice should become a new field'); } @@ -271,7 +271,7 @@ public function testPlaceholderNotPresentIfMultiple() 'choices_as_values' => true, )); - $this->assertFalse(isset($form['placeholder'])); + $this->assertArrayNotHasKey('placeholder', $form); $this->assertCount(count($this->choices), $form, 'Each choice should become a new field'); } @@ -288,7 +288,7 @@ public function testPlaceholderNotPresentIfEmptyChoice() 'choices_as_values' => true, )); - $this->assertFalse(isset($form['placeholder'])); + $this->assertArrayNotHasKey('placeholder', $form); $this->assertCount(2, $form, 'Each choice should become a new field'); } @@ -348,7 +348,7 @@ public function testPlaceholderWithExpandedBooleanChoices() 'choices_as_values' => true, )); - $this->assertTrue(isset($form['placeholder']), 'Placeholder should be set'); + $this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set'); $this->assertCount(3, $form, 'Each choice should become a new field, placeholder included'); $view = $form->createView(); @@ -373,7 +373,7 @@ public function testPlaceholderWithExpandedBooleanChoicesAndWithFalseAsPreSetDat 'choices_as_values' => true, )); - $this->assertTrue(isset($form['placeholder']), 'Placeholder should be set'); + $this->assertArrayHasKey('placeholder', $form, 'Placeholder should be set'); $this->assertCount(3, $form, 'Each choice should become a new field, placeholder included'); $view = $form->createView(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php index 34851d316dd74..b52b1650cebb9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php @@ -49,7 +49,7 @@ public function testSetDataAdjustsSize() $form->setData(array('foo@baz.com')); $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]); - $this->assertFalse(isset($form[1])); + $this->assertArrayNotHasKey(1, $form); $this->assertCount(1, $form); $this->assertEquals('foo@baz.com', $form[0]->getData()); $formAttrs0 = $form[0]->getConfig()->getOption('attr'); @@ -228,7 +228,7 @@ public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet() )); $data = $form->getData(); - $this->assertFalse(isset($data['__name__'])); + $this->assertArrayNotHasKey('__name__', $data); } public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet() @@ -241,7 +241,7 @@ public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet() $form->setData(array('foobar.png')); $data = $form->getData(); - $this->assertFalse(isset($data['__name__'])); + $this->assertArrayNotHasKey('__name__', $data); } public function testPrototypeNameOption() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index 9a80bdd87ba86..48c1b764bdda6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -444,7 +444,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testDontPassHtml5TypeIfNotHtml5Format() @@ -455,7 +455,7 @@ public function testDontPassHtml5TypeIfNotHtml5Format() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testDontPassHtml5TypeIfNotSingleText() @@ -465,7 +465,7 @@ public function testDontPassHtml5TypeIfNotSingleText() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testDateTypeChoiceErrorsBubbleUp() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 6c3806d23c713..21962d12adb8d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -678,7 +678,7 @@ public function testDontPassDatePatternIfText() )) ->createView(); - $this->assertFalse(isset($view->vars['date_pattern'])); + $this->assertArrayNotHasKey('date_pattern', $view->vars); } public function testDatePatternFormatWithQuotedStrings() @@ -844,7 +844,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testDontPassHtml5TypeIfNotHtml5Format() @@ -855,7 +855,7 @@ public function testDontPassHtml5TypeIfNotHtml5Format() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testDontPassHtml5TypeIfNotSingleText() @@ -865,7 +865,7 @@ public function testDontPassHtml5TypeIfNotSingleText() )) ->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function provideCompoundWidgets() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 48fd5964db611..8f7d13961f1de 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -536,7 +536,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() )); $view = $form->createView(); - $this->assertFalse(isset($view->vars['type'])); + $this->assertArrayNotHasKey('type', $view->vars); } public function testPassDefaultPlaceholderToViewIfNotRequired() diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php index 4a88d18d71abd..7ac00c350d69d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -77,7 +77,7 @@ public function testCsrfProtectionByDefaultIfRootAndCompound() )) ->createView(); - $this->assertTrue(isset($view['csrf'])); + $this->assertArrayHasKey('csrf', $view); } public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot() @@ -94,7 +94,7 @@ public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot() ->get('form') ->createView(); - $this->assertFalse(isset($view['csrf'])); + $this->assertArrayNotHasKey('csrf', $view); } public function testNoCsrfProtectionByDefaultIfRootButNotCompound() @@ -106,7 +106,7 @@ public function testNoCsrfProtectionByDefaultIfRootButNotCompound() )) ->createView(); - $this->assertFalse(isset($view['csrf'])); + $this->assertArrayNotHasKey('csrf', $view); } public function testCsrfProtectionCanBeDisabled() @@ -119,7 +119,7 @@ public function testCsrfProtectionCanBeDisabled() )) ->createView(); - $this->assertFalse(isset($view['csrf'])); + $this->assertArrayNotHasKey('csrf', $view); } public function testGenerateCsrfToken() @@ -362,7 +362,7 @@ public function testNoCsrfProtectionOnPrototype() ->createView() ->vars['prototype']; - $this->assertFalse(isset($prototypeView['csrf'])); + $this->assertArrayNotHasKey('csrf', $prototypeView); $this->assertCount(1, $prototypeView); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php index 31377dec3e58c..88d5169cd7a4b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php @@ -96,7 +96,7 @@ public function testCreatePath($string, $entries, $slicedPath = null) $path = new ViolationPath($string); $this->assertSame($slicedPath, $path->__toString()); - $this->assertSame(count($entries), count($path->getElements())); + $this->assertCount(count($entries), $path->getElements()); $this->assertSame(count($entries), $path->getLength()); foreach ($entries as $index => $entry) { diff --git a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php index fe922e9239faa..8ce3f8fc82b82 100644 --- a/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php +++ b/src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php @@ -91,14 +91,14 @@ public function testIsset() $map = new OrderedHashMap(); $map['first'] = 1; - $this->assertTrue(isset($map['first'])); + $this->assertArrayHasKey('first', $map); } public function testIssetReturnsFalseForNonExisting() { $map = new OrderedHashMap(); - $this->assertFalse(isset($map['first'])); + $this->assertArrayNotHasKey('first', $map); } public function testIssetReturnsFalseForNull() @@ -106,7 +106,7 @@ public function testIssetReturnsFalseForNull() $map = new OrderedHashMap(); $map['first'] = null; - $this->assertFalse(isset($map['first'])); + $this->assertArrayNotHasKey('first', $map); } public function testUnset() diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index e5b1b38fdd028..683ef47b276be 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -191,6 +191,6 @@ public function testCount() $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); $headerBag = new HeaderBag($headers); - $this->assertEquals(count($headers), count($headerBag)); + $this->assertCount(count($headers), $headerBag); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index 5ee2954db9460..83f49f695ffe3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -210,7 +210,7 @@ public function testCount() $parameters = array('foo' => 'bar', 'hello' => 'world'); $bag = new ParameterBag($parameters); - $this->assertEquals(count($parameters), count($bag)); + $this->assertCount(count($parameters), $bag); } public function testGetBoolean() diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php index c55a7f6a51d40..48be572962732 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php @@ -183,10 +183,10 @@ public function testCookiesWithSameNames() $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo'])); - $this->assertTrue(isset($cookies['foo.bar']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['bar.foo']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['']['/']['foo'])); + $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']); + $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']); + $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']); + $this->assertArrayHasKey('foo', $cookies['']['/']); } public function testRemoveCookie() @@ -196,17 +196,17 @@ public function testRemoveCookie() $bag->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar')); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['foo.bar']['/path/foo'])); + $this->assertArrayHasKey('/path/foo', $cookies['foo.bar']); $bag->removeCookie('foo', '/path/foo', 'foo.bar'); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar']['/path/foo'])); + $this->assertArrayNotHasKey('/path/foo', $cookies['foo.bar']); $bag->removeCookie('bar', '/path/bar', 'foo.bar'); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar'])); + $this->assertArrayNotHasKey('foo.bar', $cookies); } public function testRemoveCookieWithNullRemove() @@ -216,11 +216,11 @@ public function testRemoveCookieWithNullRemove() $bag->setCookie(new Cookie('bar', 'foo', 0)); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['']['/'])); + $this->assertArrayHasKey('/', $cookies['']); $bag->removeCookie('foo', null); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['']['/']['foo'])); + $this->assertArrayNotHasKey('foo', $cookies['']['/']); $bag->removeCookie('bar', null); $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php index c1d9d12a654ba..f8becec5a982d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php @@ -74,8 +74,8 @@ public function testHttpBasicAuthWithPhpCgiBogus() // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); + $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers); + $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers); } public function testHttpBasicAuthWithPhpCgiRedirect() @@ -118,8 +118,8 @@ public function testHttpDigestAuthWithPhpCgiBogus() // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); + $this->assertArrayNotHasKey('PHP_AUTH_USER', $headers); + $this->assertArrayNotHasKey('PHP_AUTH_PW', $headers); } public function testHttpDigestAuthWithPhpCgiRedirect() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index 655c26a9c24ce..724a0b9844700 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -181,6 +181,6 @@ public function testGetIterator() public function testCount() { - $this->assertEquals(count($this->array), count($this->bag)); + $this->assertCount(count($this->array), $this->bag); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 7eb7e56478ce5..3501f74784a9e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -255,7 +255,7 @@ public function testStartedOutside() $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); + $this->assertArrayNotHasKey($key, $_SESSION); $storage->start(); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 5cfb328d3095c..384ad7b038d09 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -79,9 +79,9 @@ public function testPhpSession53() $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); + $this->assertArrayNotHasKey($key, $_SESSION); $storage->start(); - $this->assertTrue(isset($_SESSION[$key])); + $this->assertArrayHasKey($key, $_SESSION); } /** @@ -102,9 +102,9 @@ public function testPhpSession54() $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); + $this->assertArrayNotHasKey($key, $_SESSION); $storage->start(); - $this->assertTrue(isset($_SESSION[$key])); + $this->assertArrayHasKey($key, $_SESSION); } public function testClear() diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 91f4b2e6f25e0..23b1d87d1ca69 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -35,7 +35,7 @@ public function testDump() $this->assertSame(1, $collector->getDumpsCount()); $dump = $collector->getDumps('html'); - $this->assertTrue(isset($dump[0]['data'])); + $this->assertArrayHasKey('data', $dump[0]); $dump[0]['data'] = preg_replace('/^.*?
request('GET', '/');
         $this->assertHttpKernelIsNotCalled();
         $this->assertEquals(200, $this->response->getStatusCode());
-        $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
-        $this->assertTrue($this->response->headers->get('Age') > 0);
+        $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+        $this->assertGreaterThan(0, $this->response->headers->get('Age'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
         $this->assertTraceContains('fresh');
         $this->assertTraceNotContains('store');
@@ -554,8 +554,8 @@ public function testHitsCachedResponseWithMaxAgeDirective()
         $this->request('GET', '/');
         $this->assertHttpKernelIsNotCalled();
         $this->assertEquals(200, $this->response->getStatusCode());
-        $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
-        $this->assertTrue($this->response->headers->get('Age') > 0);
+        $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+        $this->assertGreaterThan(0, $this->response->headers->get('Age'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
         $this->assertTraceContains('fresh');
         $this->assertTraceNotContains('store');
@@ -578,8 +578,8 @@ public function testHitsCachedResponseWithSMaxAgeDirective()
         $this->request('GET', '/');
         $this->assertHttpKernelIsNotCalled();
         $this->assertEquals(200, $this->response->getStatusCode());
-        $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2);
-        $this->assertTrue($this->response->headers->get('Age') > 0);
+        $this->assertLessThan(2, strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')));
+        $this->assertGreaterThan(0, $this->response->headers->get('Age'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
         $this->assertTraceContains('fresh');
         $this->assertTraceNotContains('store');
@@ -753,7 +753,7 @@ public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent()
         $this->request('GET', '/');
         $this->assertHttpKernelIsCalled();
         $this->assertEquals(200, $this->response->getStatusCode());
-        $this->assertTrue($this->response->headers->get('Age') <= 1);
+        $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
         $this->assertTraceContains('stale');
         $this->assertTraceNotContains('fresh');
@@ -791,7 +791,7 @@ public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInform
         $this->assertEquals(200, $this->response->getStatusCode());
         $this->assertNotNull($this->response->headers->get('Last-Modified'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
-        $this->assertTrue($this->response->headers->get('Age') <= 1);
+        $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
         $this->assertEquals('Hello World', $this->response->getContent());
         $this->assertTraceContains('stale');
         $this->assertTraceContains('valid');
@@ -841,7 +841,7 @@ public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
         $this->assertEquals(200, $this->response->getStatusCode());
         $this->assertNotNull($this->response->headers->get('ETag'));
         $this->assertNotNull($this->response->headers->get('X-Content-Digest'));
-        $this->assertTrue($this->response->headers->get('Age') <= 1);
+        $this->assertLessThanOrEqual(1, $this->response->headers->get('Age'));
         $this->assertEquals('Hello World', $this->response->getContent());
         $this->assertTraceContains('stale');
         $this->assertTraceContains('valid');
diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php
index f3557eedcb885..e9dfccbc51523 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php
@@ -64,22 +64,22 @@ public function testStoreSpecialCharsInUrl()
         $profile = new Profile('simple_quote');
         $profile->setUrl('http://foo.bar/\'');
         $this->getStorage()->write($profile);
-        $this->assertTrue(false !== $this->getStorage()->read('simple_quote'), '->write() accepts single quotes in URL');
+        $this->assertNotFalse($this->getStorage()->read('simple_quote'), '->write() accepts single quotes in URL');
 
         $profile = new Profile('double_quote');
         $profile->setUrl('http://foo.bar/"');
         $this->getStorage()->write($profile);
-        $this->assertTrue(false !== $this->getStorage()->read('double_quote'), '->write() accepts double quotes in URL');
+        $this->assertNotFalse($this->getStorage()->read('double_quote'), '->write() accepts double quotes in URL');
 
         $profile = new Profile('backslash');
         $profile->setUrl('http://foo.bar/\\');
         $this->getStorage()->write($profile);
-        $this->assertTrue(false !== $this->getStorage()->read('backslash'), '->write() accepts backslash in URL');
+        $this->assertNotFalse($this->getStorage()->read('backslash'), '->write() accepts backslash in URL');
 
         $profile = new Profile('comma');
         $profile->setUrl('http://foo.bar/,');
         $this->getStorage()->write($profile);
-        $this->assertTrue(false !== $this->getStorage()->read('comma'), '->write() accepts comma in URL');
+        $this->assertNotFalse($this->getStorage()->read('comma'), '->write() accepts comma in URL');
     }
 
     public function testStoreDuplicateToken()
@@ -214,7 +214,7 @@ public function testPurge()
         $profile->setMethod('GET');
         $this->getStorage()->write($profile);
 
-        $this->assertTrue(false !== $this->getStorage()->read('token1'));
+        $this->assertNotFalse($this->getStorage()->read('token1'));
         $this->assertCount(1, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
 
         $profile = new Profile('token2');
@@ -223,7 +223,7 @@ public function testPurge()
         $profile->setMethod('GET');
         $this->getStorage()->write($profile);
 
-        $this->assertTrue(false !== $this->getStorage()->read('token2'));
+        $this->assertNotFalse($this->getStorage()->read('token2'));
         $this->assertCount(2, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'));
 
         $this->getStorage()->purge();
diff --git a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
index 06de8902dc8cd..1304b219e7ae7 100644
--- a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php
@@ -36,7 +36,7 @@ public function testCheck()
         $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
         $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));
 
-        $this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
+        $this->assertSame($signer->sign('http://example.com/foo?foo=bar&bar=foo'), $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
     }
 
     public function testCheckWithDifferentArgSeparator()
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
index 76543d3f0aa99..34328770ef7a2 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php
@@ -36,7 +36,7 @@ public function testReadReturnsArrayAccess()
 
         $this->assertInstanceOf('\ArrayAccess', $data);
         $this->assertSame('Bar', $data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     public function testReadFollowsAlias()
@@ -46,7 +46,7 @@ public function testReadFollowsAlias()
 
         $this->assertInstanceOf('\ArrayAccess', $data);
         $this->assertSame('Bar', $data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     public function testReadDoesNotFollowFallback()
@@ -64,9 +64,9 @@ public function testReadDoesNotFollowFallback()
 
         $this->assertInstanceOf('\ArrayAccess', $data);
         $this->assertSame('Bam', $data['Baz']);
-        $this->assertFalse(isset($data['Foo']));
+        $this->assertArrayNotHasKey('Foo', $data);
         $this->assertNull($data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     public function testReadDoesNotFollowFallbackAlias()
@@ -84,9 +84,9 @@ public function testReadDoesNotFollowFallbackAlias()
 
         $this->assertInstanceOf('\ArrayAccess', $data);
         $this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed');
-        $this->assertFalse(isset($data['Foo']));
+        $this->assertArrayNotHasKey('Foo', $data);
         $this->assertNull($data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     /**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
index 2b6e6c4169e7f..dd0cf9cd872cd 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php
@@ -35,7 +35,7 @@ public function testReadReturnsArray()
 
         $this->assertInternalType('array', $data);
         $this->assertSame('Bar', $data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     /**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
index 954e2f04237c8..f6adae9b7de00 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php
@@ -35,7 +35,7 @@ public function testReadReturnsArray()
 
         $this->assertInternalType('array', $data);
         $this->assertSame('Bar', $data['Foo']);
-        $this->assertFalse(isset($data['ExistsNot']));
+        $this->assertArrayNotHasKey('ExistsNot', $data);
     }
 
     /**
diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
index bbaecfcbd668f..f13bf36c96d19 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php
@@ -34,8 +34,8 @@ public function testWriteWithinBuffer()
         $this->buffer[0] = 'foo';
         $this->buffer['bar'] = 'baz';
 
-        $this->assertTrue(isset($this->buffer[0]));
-        $this->assertTrue(isset($this->buffer['bar']));
+        $this->assertArrayHasKey(0, $this->buffer);
+        $this->assertArrayHasKey('bar', $this->buffer);
         $this->assertSame('foo', $this->buffer[0]);
         $this->assertSame('baz', $this->buffer['bar']);
     }
@@ -46,8 +46,8 @@ public function testWritePastBuffer()
         $this->buffer['bar'] = 'baz';
         $this->buffer[2] = 'bam';
 
-        $this->assertTrue(isset($this->buffer['bar']));
-        $this->assertTrue(isset($this->buffer[2]));
+        $this->assertArrayHasKey('bar', $this->buffer);
+        $this->assertArrayHasKey(2, $this->buffer);
         $this->assertSame('baz', $this->buffer['bar']);
         $this->assertSame('bam', $this->buffer[2]);
     }
@@ -62,14 +62,14 @@ public function testReadNonExistingFails()
 
     public function testQueryNonExisting()
     {
-        $this->assertFalse(isset($this->buffer['foo']));
+        $this->assertArrayNotHasKey('foo', $this->buffer);
     }
 
     public function testUnsetNonExistingSucceeds()
     {
         unset($this->buffer['foo']);
 
-        $this->assertFalse(isset($this->buffer['foo']));
+        $this->assertArrayNotHasKey('foo', $this->buffer);
     }
 
     /**
@@ -86,7 +86,7 @@ public function testReadOverwrittenFails()
 
     public function testQueryOverwritten()
     {
-        $this->assertFalse(isset($this->buffer[0]));
+        $this->assertArrayNotHasKey(0, $this->buffer);
     }
 
     public function testUnsetOverwrittenSucceeds()
@@ -97,6 +97,6 @@ public function testUnsetOverwrittenSucceeds()
 
         unset($this->buffer[0]);
 
-        $this->assertFalse(isset($this->buffer[0]));
+        $this->assertArrayNotHasKey(0, $this->buffer);
     }
 }
diff --git a/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php b/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php
index 4d82b42881fad..674472bd8ef9d 100644
--- a/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php
+++ b/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php
@@ -43,6 +43,6 @@ public function testGetDisplayCurrencies()
     public function testGetCurrencies()
     {
         $currencies = StubLocale::getCurrencies();
-        $this->assertTrue(in_array('BRL', $currencies));
+        $this->assertContains('BRL', $currencies);
     }
 }
diff --git a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsResolverTest.php
index 44e07b7726c9b..1b42814ea7cfc 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsResolverTest.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsResolverTest.php
@@ -124,7 +124,7 @@ public function testResolveLazyDependencyOnMissingOptionalWithoutDefault()
         $this->resolver->setDefaults(array(
             'two' => function (Options $options) use ($test) {
                 /* @var TestCase $test */
-                $test->assertFalse(isset($options['one']));
+                $test->assertArrayNotHasKey('one', $options);
 
                 return '2';
             },
@@ -148,7 +148,7 @@ public function testResolveLazyDependencyOnOptionalWithoutDefault()
         $this->resolver->setDefaults(array(
             'two' => function (Options $options) use ($test) {
                 /* @var TestCase $test */
-                $test->assertTrue(isset($options['one']));
+                $test->assertArrayHasKey('one', $options);
 
                 return $options['one'].'2';
             },
diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php
index c548f16ba6d90..ffa2872243981 100644
--- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php
+++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php
@@ -1419,12 +1419,12 @@ public function testArrayAccess()
         });
 
         $this->resolver->setDefault('lazy2', function (Options $options) {
-            Assert::assertTrue(isset($options['default1']));
-            Assert::assertTrue(isset($options['default2']));
-            Assert::assertTrue(isset($options['required']));
-            Assert::assertTrue(isset($options['lazy1']));
-            Assert::assertTrue(isset($options['lazy2']));
-            Assert::assertFalse(isset($options['defined']));
+            Assert::assertArrayHasKey('default1', $options);
+            Assert::assertArrayHasKey('default2', $options);
+            Assert::assertArrayHasKey('required', $options);
+            Assert::assertArrayHasKey('lazy1', $options);
+            Assert::assertArrayHasKey('lazy2', $options);
+            Assert::assertArrayNotHasKey('defined', $options);
 
             Assert::assertSame(0, $options['default1']);
             Assert::assertSame(42, $options['default2']);
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 3240aa7954d30..c614b3aa40089 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -567,7 +567,7 @@ public function testUpdateStatus()
     {
         $process = $this->getProcess('echo foo');
         $process->run();
-        $this->assertTrue(strlen($process->getOutput()) > 0);
+        $this->assertGreaterThan(0, strlen($process->getOutput()));
     }
 
     public function testGetExitCodeIsNullOnStart()
diff --git a/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php b/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php
index 56aff2ff40095..a1ff9186c07c0 100644
--- a/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php
+++ b/src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php
@@ -181,7 +181,7 @@ public function testPropertyChangedTracksChangesToAclProperties()
 
         $provider->propertyChanged($acl, 'entriesInheriting', false, true);
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertTrue(isset($changes['entriesInheriting']));
+        $this->assertArrayHasKey('entriesInheriting', $changes);
         $this->assertFalse($changes['entriesInheriting'][0]);
         $this->assertTrue($changes['entriesInheriting'][1]);
 
@@ -189,7 +189,7 @@ public function testPropertyChangedTracksChangesToAclProperties()
         $provider->propertyChanged($acl, 'entriesInheriting', false, true);
         $provider->propertyChanged($acl, 'entriesInheriting', true, false);
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertFalse(isset($changes['entriesInheriting']));
+        $this->assertArrayNotHasKey('entriesInheriting', $changes);
     }
 
     public function testPropertyChangedTracksChangesToAceProperties()
@@ -202,42 +202,42 @@ public function testPropertyChangedTracksChangesToAceProperties()
 
         $provider->propertyChanged($ace, 'mask', 1, 3);
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertTrue(isset($changes['aces']));
+        $this->assertArrayHasKey('aces', $changes);
         $this->assertInstanceOf('\SplObjectStorage', $changes['aces']);
         $this->assertTrue($changes['aces']->contains($ace));
         $aceChanges = $changes['aces']->offsetGet($ace);
-        $this->assertTrue(isset($aceChanges['mask']));
+        $this->assertArrayHasKey('mask', $aceChanges);
         $this->assertEquals(1, $aceChanges['mask'][0]);
         $this->assertEquals(3, $aceChanges['mask'][1]);
 
         $provider->propertyChanged($ace, 'strategy', 'all', 'any');
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertTrue(isset($changes['aces']));
+        $this->assertArrayHasKey('aces', $changes);
         $this->assertInstanceOf('\SplObjectStorage', $changes['aces']);
         $this->assertTrue($changes['aces']->contains($ace));
         $aceChanges = $changes['aces']->offsetGet($ace);
-        $this->assertTrue(isset($aceChanges['mask']));
-        $this->assertTrue(isset($aceChanges['strategy']));
+        $this->assertArrayHasKey('mask', $aceChanges);
+        $this->assertArrayHasKey('strategy', $aceChanges);
         $this->assertEquals('all', $aceChanges['strategy'][0]);
         $this->assertEquals('any', $aceChanges['strategy'][1]);
 
         $provider->propertyChanged($ace, 'mask', 3, 1);
         $changes = $propertyChanges->offsetGet($acl);
         $aceChanges = $changes['aces']->offsetGet($ace);
-        $this->assertFalse(isset($aceChanges['mask']));
-        $this->assertTrue(isset($aceChanges['strategy']));
+        $this->assertArrayNotHasKey('mask', $aceChanges);
+        $this->assertArrayHasKey('strategy', $aceChanges);
 
         $provider->propertyChanged($ace2, 'mask', 1, 3);
         $provider->propertyChanged($ace, 'strategy', 'any', 'all');
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertTrue(isset($changes['aces']));
+        $this->assertArrayHasKey('aces', $changes);
         $this->assertFalse($changes['aces']->contains($ace));
         $this->assertTrue($changes['aces']->contains($ace2));
 
         $provider->propertyChanged($ace2, 'mask', 3, 4);
         $provider->propertyChanged($ace2, 'mask', 4, 1);
         $changes = $propertyChanges->offsetGet($acl);
-        $this->assertFalse(isset($changes['aces']));
+        $this->assertArrayNotHasKey('aces', $changes);
     }
 
     /**
@@ -319,7 +319,7 @@ public function testUpdateAcl()
 
         $aces = $acl->getObjectAces();
         $reloadedAces = $reloadedAcl->getObjectAces();
-        $this->assertEquals(count($aces), count($reloadedAces));
+        $this->assertCount(count($aces), $reloadedAces);
         foreach ($aces as $index => $ace) {
             $this->assertAceEquals($ace, $reloadedAces[$index]);
         }
@@ -437,7 +437,7 @@ public function testUpdateUserSecurityIdentity()
 
         $aces = $acl->getObjectAces();
         $reloadedAces = $reloadedAcl->getObjectAces();
-        $this->assertEquals(count($aces), count($reloadedAces));
+        $this->assertCount(count($aces), $reloadedAces);
         foreach ($reloadedAces as $ace) {
             $this->assertTrue($ace->getSecurityIdentity()->equals($newSid));
         }
diff --git a/src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php b/src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php
index 6e34e6d5e7096..eed0090dfcf0f 100644
--- a/src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php
+++ b/src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php
@@ -96,7 +96,7 @@ public function testReset()
         $this->assertEquals(0, $builder->get());
 
         $builder->add('view');
-        $this->assertTrue($builder->get() > 0);
+        $this->assertGreaterThan(0, $builder->get());
 
         $builder->reset();
         $this->assertEquals(0, $builder->get());
diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
index ca28d53c5cc42..e3e1c447af3cd 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
@@ -61,9 +61,9 @@ public function testVoteAuthenticatesTokenIfNecessary()
             ->will($this->returnValue(true));
 
         // first run the token has not been re-authenticated yet, after isGranted is called, it should be equal
-        $this->assertFalse($newToken === $this->tokenStorage->getToken());
+        $this->assertNotSame($newToken, $this->tokenStorage->getToken());
         $this->assertTrue($this->authorizationChecker->isGranted('foo'));
-        $this->assertTrue($newToken === $this->tokenStorage->getToken());
+        $this->assertSame($newToken, $this->tokenStorage->getToken());
     }
 
     /**
@@ -90,7 +90,7 @@ public function testIsGranted($decide)
             ->method('decide')
             ->will($this->returnValue($decide));
         $this->tokenStorage->setToken($token);
-        $this->assertTrue($decide === $this->authorizationChecker->isGranted('ROLE_FOO'));
+        $this->assertSame($decide, $this->authorizationChecker->isGranted('ROLE_FOO'));
     }
 
     public function isGrantedProvider()
diff --git a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php
index 3c842aae76cef..aa521ce8edeb9 100644
--- a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php
@@ -39,7 +39,7 @@ public function testGetTokenDelegation()
             ->method('getToken')
             ->will($this->returnValue($token));
 
-        $this->assertTrue($token === $this->securityContext->getToken());
+        $this->assertSame($token, $this->securityContext->getToken());
     }
 
     public function testSetTokenDelegation()
diff --git a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
index 8921ff19c81fc..dec9082efc30f 100644
--- a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
+++ b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php
@@ -20,7 +20,7 @@ public function testGetSetCharset()
     {
         $helper = new ProjectTemplateHelper();
         $helper->setCharset('ISO-8859-1');
-        $this->assertTrue('ISO-8859-1' === $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
+        $this->assertSame('ISO-8859-1', $helper->getCharset(), '->setCharset() sets the charset set related to this helper');
     }
 }
 
diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
index b4bf42b57240a..c889d21817a6d 100644
--- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
+++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php
@@ -23,7 +23,7 @@ class CacheLoaderTest extends TestCase
     public function testConstructor()
     {
         $loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir());
-        $this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument');
+        $this->assertSame($loader->getLoader(), $varLoader, '__construct() takes a template loader as its first argument');
         $this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
     }
 
diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
index 4481c2abf526c..abbb6b583cf64 100644
--- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
+++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php
@@ -65,7 +65,7 @@ public function testGetSetHas()
         $engine[$foo] = 'bar';
         $this->assertEquals($foo, $engine->get('bar'), '->set() takes an alias as a second argument');
 
-        $this->assertTrue(isset($engine['bar']));
+        $this->assertArrayHasKey('bar', $engine);
 
         try {
             $engine->get('foobar');
@@ -75,7 +75,7 @@ public function testGetSetHas()
             $this->assertEquals('The helper "foobar" is not defined.', $e->getMessage(), '->get() throws an InvalidArgumentException if the helper is not defined');
         }
 
-        $this->assertTrue(isset($engine['bar']));
+        $this->assertArrayHasKey('bar', $engine);
         $this->assertTrue($engine->has('foo'), '->has() returns true if the helper exists');
         $this->assertFalse($engine->has('foobar'), '->has() returns false if the helper does not exist');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
index 39b1d64eb7d97..f9c4b1d8afe74 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
@@ -27,7 +27,7 @@ public function testDump()
         $dumper = new CsvFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/valid.csv'), file_get_contents($tempDir.'/messages.en.csv'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/valid.csv', $tempDir.'/messages.en.csv');
 
         unlink($tempDir.'/messages.en.csv');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
index 5d2037c3f7ee6..da5474e4cfe8c 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
@@ -29,7 +29,7 @@ public function testDump()
         $dumper = new IcuResFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resourcebundle/res/en.res'), file_get_contents($tempDir.'/messages/en.res'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resourcebundle/res/en.res', $tempDir.'/messages/en.res');
 
         @unlink($tempDir.'/messages/en.res');
         @rmdir($tempDir.'/messages');
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
index efbdfa2c29d85..2b9876f4d2174 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
@@ -26,7 +26,7 @@ public function testDump()
         $dumper = new IniFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ini'), file_get_contents($tempDir.'/messages.en.ini'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.ini', $tempDir.'/messages.en.ini');
 
         unlink($tempDir.'/messages.en.ini');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php
index 74d1c27b6407f..f3a746c05179a 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php
@@ -30,7 +30,7 @@ public function testDump()
         $dumper = new JsonFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.json'), file_get_contents($tempDir.'/messages.en.json'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.json', $tempDir.'/messages.en.json');
 
         unlink($tempDir.'/messages.en.json');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
index 6ac9b94002a06..f64d5c516df7b 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
@@ -25,7 +25,7 @@ public function testDump()
         $tempDir = sys_get_temp_dir();
         $dumper = new MoFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.mo'), file_get_contents($tempDir.'/messages.en.mo'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.mo', $tempDir.'/messages.en.mo');
 
         unlink($tempDir.'/messages.en.mo');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
index 5c5073c7eddba..04a92e5cd4fa5 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
@@ -26,7 +26,7 @@ public function testDump()
         $dumper = new PhpFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.php'), file_get_contents($tempDir.'/messages.en.php'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.php', $tempDir.'/messages.en.php');
 
         unlink($tempDir.'/messages.en.php');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
index 03469770a331a..1e84bfaefe633 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
@@ -25,7 +25,7 @@ public function testDump()
         $tempDir = sys_get_temp_dir();
         $dumper = new PoFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.po'), file_get_contents($tempDir.'/messages.en.po'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.po', $tempDir.'/messages.en.po');
 
         unlink($tempDir.'/messages.en.po');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
index 3b7337d3f1cd0..425b5987f9da0 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
@@ -26,7 +26,7 @@ public function testDump()
         $dumper = new QtFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ts'), file_get_contents($tempDir.'/resources.en.ts'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.ts', $tempDir.'/resources.en.ts');
 
         unlink($tempDir.'/resources.en.ts');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
index 07411a0117ed4..462ba9917c399 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
@@ -32,10 +32,7 @@ public function testDump()
         $dumper = new XliffFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir, 'default_locale' => 'fr_FR'));
 
-        $this->assertEquals(
-            file_get_contents(__DIR__.'/../fixtures/resources-clean.xlf'),
-            file_get_contents($tempDir.'/messages.en_US.xlf')
-        );
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources-clean.xlf', $tempDir.'/messages.en_US.xlf');
 
         unlink($tempDir.'/messages.en_US.xlf');
     }
diff --git a/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
index ae036bc3e9d00..dfd02b32535d3 100644
--- a/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
+++ b/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
@@ -26,7 +26,7 @@ public function testDump()
         $dumper = new YamlFileDumper();
         $dumper->dump($catalogue, array('path' => $tempDir));
 
-        $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.yml'), file_get_contents($tempDir.'/messages.en.yml'));
+        $this->assertFileEquals(__DIR__.'/../fixtures/resources.yml', $tempDir.'/messages.en.yml');
 
         unlink($tempDir.'/messages.en.yml');
     }
diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
index 6f4518cab39e4..a35a1cd171b54 100644
--- a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
+++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php
@@ -89,16 +89,16 @@ public function testArrayAccess()
         $this->list[] = $violation;
 
         $this->assertSame($violation, $this->list[0]);
-        $this->assertTrue(isset($this->list[0]));
+        $this->assertArrayHasKey(0, $this->list);
 
         unset($this->list[0]);
 
-        $this->assertFalse(isset($this->list[0]));
+        $this->assertArrayNotHasKey(0, $this->list);
 
         $this->list[10] = $violation;
 
         $this->assertSame($violation, $this->list[10]);
-        $this->assertTrue(isset($this->list[10]));
+        $this->assertArrayHasKey(10, $this->list);
     }
 
     public function testToString()
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php
index f298cd27e6257..2b906a918f0f5 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php
@@ -62,15 +62,15 @@ public function testLegacyArrayAccess()
 
         $this->assertSame('Group 1', $sequence[0]);
         $this->assertSame('Group 2', $sequence[1]);
-        $this->assertTrue(isset($sequence[0]));
-        $this->assertFalse(isset($sequence[2]));
+        $this->assertArrayHasKey(0, $sequence);
+        $this->assertArrayNotHasKey(2, $sequence);
         unset($sequence[0]);
-        $this->assertFalse(isset($sequence[0]));
+        $this->assertArrayNotHasKey(0, $sequence);
         $sequence[] = 'Group 3';
-        $this->assertTrue(isset($sequence[2]));
+        $this->assertArrayHasKey(2, $sequence);
         $this->assertSame('Group 3', $sequence[2]);
         $sequence[0] = 'Group 1';
-        $this->assertTrue(isset($sequence[0]));
+        $this->assertArrayHasKey(0, $sequence);
         $this->assertSame('Group 1', $sequence[0]);
     }
 

From 57f81295984f191e3dc5fad6a39fe2670bf5cdb5 Mon Sep 17 00:00:00 2001
From: Amrouche Hamza 
Date: Tue, 12 Dec 2017 08:24:27 +0100
Subject: [PATCH 62/85] [Console] Fix console tests by adding the missing
 condition

---
 src/Symfony/Component/Console/Event/ConsoleErrorEvent.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
index a212a3c287182..0d05b9dad5bd0 100644
--- a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
+++ b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
@@ -78,6 +78,6 @@ public function setExitCode($exitCode)
      */
     public function getExitCode()
     {
-        return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) ? $this->error->getCode() : 1);
+        return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
     }
 }

From fb52f9472214918d61a8ad88dddec638c9e66d47 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 12 Dec 2017 09:25:42 +0100
Subject: [PATCH 63/85] fix merge

---
 .../Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt
index 2a9bcf9b0a88e..bd7b644dc3aa7 100644
--- a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt
+++ b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt
@@ -33,7 +33,7 @@ array(1) {
   [0]=>
   string(37) "Error and exception handlers do match"
 }
-object(Symfony\Component\Debug\Exception\FatalErrorException)#4 (8) {
+object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
   ["message":protected]=>
   string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)"
 %a

From f859ae9f1e0c9ba5c195d71557975d5cbbf65510 Mon Sep 17 00:00:00 2001
From: Christian Flothmann 
Date: Tue, 12 Dec 2017 09:37:06 +0100
Subject: [PATCH 64/85] [Form] fix how form type is referenced in test

---
 .../Component/Form/Tests/AbstractBootstrap3LayoutTest.php       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
index 01fa86cab824a..076340d92905d 100644
--- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
@@ -1979,7 +1979,7 @@ public function testMoney()
 
     public function testMoneyWithoutCurrency()
     {
-        $form = $this->factory->createNamed('name', 'money', 1234.56, array(
+        $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
             'currency' => false,
         ));
 

From 6e248cabe3d1fc20d496569fc1f5ed46ea307739 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= 
Date: Tue, 12 Dec 2017 09:38:51 +0100
Subject: [PATCH 65/85] [HttpFoundation] Add immutable to setCache's PHPDoc

---
 src/Symfony/Component/HttpFoundation/Response.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index e079ae2e95d55..cf1325afe0627 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -952,7 +952,7 @@ public function setEtag($etag = null, $weak = false)
     /**
      * Sets the response's cache headers (validation and/or expiration).
      *
-     * Available options are: etag, last_modified, max_age, s_maxage, private, and public.
+     * Available options are: etag, last_modified, max_age, s_maxage, private, public and immutable.
      *
      * @param array $options An array of cache options
      *

From 76176d993c95f61a30364277cfb1d5c46679b79a Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 12 Dec 2017 10:23:32 +0100
Subject: [PATCH 66/85] fix merge

---
 src/Symfony/Component/HttpKernel/Kernel.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 60446d36afbec..4baa86c410b8f 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -635,13 +635,13 @@ protected function initializeContainer()
 
                 $oldContainer = file_exists($cache->getPath()) && is_object($oldContainer = include $cache->getPath()) ? new \ReflectionClass($oldContainer) : false;
             } finally {
-                if ($this->debug && true !== $previousHandler) {
+                if (!$this->debug) {
+                    error_reporting($errorLevel);
+                } elseif (true !== $previousHandler) {
                     restore_error_handler();
 
                     file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
                     file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : '');
-                } else {
-                    error_reporting($errorLevel);
                 }
             }
 

From fde1f48874104fe4d5d995e9c9b00f47a73aa64b Mon Sep 17 00:00:00 2001
From: Christian Flothmann 
Date: Tue, 12 Dec 2017 12:26:50 +0100
Subject: [PATCH 67/85] add missing logout_on_user_change options

---
 .../Tests/Functional/app/CsrfFormLogin/config.yml               | 1 +
 .../Tests/Functional/app/FirewallEntryPoint/config.yml          | 2 ++
 .../SecurityBundle/Tests/Functional/app/JsonLogin/config.yml    | 1 +
 .../Tests/Functional/app/JsonLogin/custom_handlers.yml          | 1 +
 .../Tests/Functional/app/SecurityHelper/config.yml              | 1 +
 .../Tests/Functional/app/StandardFormLogin/config.yml           | 2 ++
 .../app/StandardFormLogin/localized_form_failure_handler.yml    | 1 +
 .../Tests/Functional/app/StandardFormLogin/localized_routes.yml | 1 +
 8 files changed, 10 insertions(+)

diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
index 5a00ac329895d..6077b0b4a7870 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
@@ -28,6 +28,7 @@ security:
             security: false
 
         default:
+            logout_on_user_change: true
             form_login:
                 check_path: /login_check
                 default_target_path: /profile
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml
index 955c41192e26d..fc032ab5ef0e0 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml
@@ -16,10 +16,12 @@ services:
 security:
     firewalls:
         secure:
+            logout_on_user_change: true
             pattern: ^/secure/
             http_basic: { realm: "Secure Gateway API" }
             entry_point: firewall_entry_point.entry_point.stub
         default:
+            logout_on_user_change: true
             anonymous: ~
     access_control:
         - { path: ^/secure/, roles: ROLE_SECURE }
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/config.yml
index d6ed10e896ff9..9cf5e8bf9a3a0 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/config.yml
@@ -13,6 +13,7 @@ security:
 
     firewalls:
         main:
+            logout_on_user_change: true
             pattern: ^/
             anonymous: true
             json_login:
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/custom_handlers.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/custom_handlers.yml
index e15e203c626cc..c49f7312e00d5 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/custom_handlers.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLogin/custom_handlers.yml
@@ -13,6 +13,7 @@ security:
 
     firewalls:
         main:
+            logout_on_user_change: true
             pattern: ^/
             anonymous: true
             json_login:
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml
index d7b8ac97d9775..d486d63065903 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml
@@ -15,4 +15,5 @@ security:
 
     firewalls:
         default:
+            logout_on_user_change: true
             anonymous: ~
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/config.yml
index 19b9d8952ec5e..2276b14dd920c 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/config.yml
@@ -20,6 +20,7 @@ security:
             security: false
 
         default:
+            logout_on_user_change: true
             form_login:
                 check_path: /login_check
                 default_target_path: /profile
@@ -28,6 +29,7 @@ security:
 
         # This firewall is here just to check its the logout functionality
         second_area:
+            logout_on_user_change: true
             http_basic: ~
             anonymous: ~
             logout:
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_form_failure_handler.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_form_failure_handler.yml
index e01ed369b1f56..e9c266af126dd 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_form_failure_handler.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_form_failure_handler.yml
@@ -13,6 +13,7 @@ security:
 
     firewalls:
         default:
+            logout_on_user_change: true
             form_login:
                 login_path: localized_login_path
                 check_path: localized_check_path
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_routes.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_routes.yml
index 5251fd1d93de1..df54ac83f4aab 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_routes.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/StandardFormLogin/localized_routes.yml
@@ -13,6 +13,7 @@ security:
 
     firewalls:
         default:
+            logout_on_user_change: true
             form_login:
                 login_path: localized_login_path
                 check_path: localized_check_path

From ef6adb89efd1711d0dc0e13e1ba790b2f539eab6 Mon Sep 17 00:00:00 2001
From: Robin Chalas 
Date: Tue, 12 Dec 2017 12:55:28 +0100
Subject: [PATCH 68/85] Fix tests

---
 .../HttpFoundation/Tests/ResponseHeaderBagTest.php        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
index 922093e549c33..d15e49ebdb5b1 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -199,10 +199,10 @@ public function testCookiesWithSameNames()
 
         $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
 
-        $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']));
-        $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']));
-        $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']));
-        $this->assertArrayHasKey('foo', $cookies['']['/']));
+        $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/foo']);
+        $this->assertArrayHasKey('foo', $cookies['foo.bar']['/path/bar']);
+        $this->assertArrayHasKey('foo', $cookies['bar.foo']['/path/bar']);
+        $this->assertArrayHasKey('foo', $cookies['']['/']);
     }
 
     public function testRemoveCookie()

From 79b64ce328898547e2f59fe03868f62596df0c15 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 12 Dec 2017 13:01:02 +0100
Subject: [PATCH 69/85] fix merge

---
 src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index a6e859493b427..52e0d4e7666ee 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -169,7 +169,7 @@ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
         $this->filesystem->copy($sourceFilePath, $targetFilePath, false);
 
         $this->assertFileExists($targetFilePath);
-        $this->assertFileEquals($sourceFilePath, $targetFilePath);
+        $this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
     }
 
     public function testMkdirCreatesDirectoriesRecursively()
@@ -1518,7 +1518,7 @@ public function testAppendToFile()
         $this->filesystem->appendToFile($filename, 'bar');
 
         $this->assertFileExists($filename);
-        $this->assertStringEqualsFile($filename, 'bar');
+        $this->assertStringEqualsFile($filename, 'foobar');
 
         // skip mode check on Windows
         if ('\\' !== DIRECTORY_SEPARATOR) {

From 4fe255154552a9467ac823e89ed8eb511daea5e8 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Tue, 12 Dec 2017 22:42:08 +0100
Subject: [PATCH 70/85] [DI] Optimize Container::get() for perf

---
 .../Component/DependencyInjection/Container.php        | 10 +++++-----
 .../Component/DependencyInjection/Dumper/PhpDumper.php |  2 +-
 .../Tests/Fixtures/php/services9.php                   |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
index 14af37ef78ac4..a7b9a94e4f5d4 100644
--- a/src/Symfony/Component/DependencyInjection/Container.php
+++ b/src/Symfony/Component/DependencyInjection/Container.php
@@ -264,7 +264,7 @@ public function has($id)
      *
      * @see Reference
      */
-    public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
+    public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1)
     {
         // Attempt to retrieve the service by checking first aliases then
         // available services. Service IDs are case insensitive, however since
@@ -294,9 +294,9 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
 
             try {
                 if (isset($this->fileMap[$id])) {
-                    return self::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior ? null : $this->load($this->fileMap[$id]);
+                    return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->load($this->fileMap[$id]);
                 } elseif (isset($this->methodMap[$id])) {
-                    return self::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior ? null : $this->{$this->methodMap[$id]}();
+                    return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->{$this->methodMap[$id]}();
                 } elseif (--$i && $id !== $normalizedId = $this->normalizeId($id)) {
                     unset($this->loading[$id]);
                     $id = $normalizedId;
@@ -306,7 +306,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
                     // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper)
                     @trigger_error('Generating a dumped container without populating the method map is deprecated since 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED);
 
-                    return self::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior ? null : $this->{$method}();
+                    return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->{$method}();
                 }
 
                 break;
@@ -319,7 +319,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
             }
         }
 
-        if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) {
+        if (/* self::EXCEPTION_ON_INVALID_REFERENCE */ 1 === $invalidBehavior) {
             if (!$id) {
                 throw new ServiceNotFoundException($id);
             }
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 59f33e80dcfdd..5e402556af6d2 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -1854,7 +1854,7 @@ private function getServiceCall($id, Reference $reference = null)
         } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) {
             return 'null';
         } elseif (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
-            $code = sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
+            $code = sprintf('$this->get(\'%s\', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $id, ContainerInterface::NULL_ON_INVALID_REFERENCE);
         } else {
             $code = sprintf('$this->get(\'%s\')', $id);
         }
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
index 4220c146aacbf..ad316b23c6ee9 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
@@ -281,7 +281,7 @@ protected function getLazyContextIgnoreInvalidRefService()
         return $this->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () {
             yield 0 => ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'};
             if ($this->has('invalid')) {
-                yield 1 => ${($_ = isset($this->services['invalid']) ? $this->services['invalid'] : $this->get('invalid', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'};
+                yield 1 => ${($_ = isset($this->services['invalid']) ? $this->services['invalid'] : $this->get('invalid', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2)) && false ?: '_'};
             }
         }, function () {
             return 1 + (int) ($this->has('invalid'));
@@ -302,12 +302,12 @@ protected function getMethodCall1Service()
         $this->services['method_call1'] = $instance = new \Bar\FooClass();
 
         $instance->setBar(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'});
-        $instance->setBar(${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
+        $instance->setBar(${($_ = isset($this->services['foo2']) ? $this->services['foo2'] : $this->get('foo2', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2)) && false ?: '_'});
         if ($this->has('foo3')) {
-            $instance->setBar(${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : $this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
+            $instance->setBar(${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : $this->get('foo3', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2)) && false ?: '_'});
         }
         if ($this->has('foobaz')) {
-            $instance->setBar(${($_ = isset($this->services['foobaz']) ? $this->services['foobaz'] : $this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
+            $instance->setBar(${($_ = isset($this->services['foobaz']) ? $this->services['foobaz'] : $this->get('foobaz', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ 2)) && false ?: '_'});
         }
         $instance->setBar((${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
 

From 97c3f429eb0e5fea990849aca022c3f30419bcc3 Mon Sep 17 00:00:00 2001
From: Jonathan Johnson 
Date: Sun, 10 Dec 2017 13:39:54 -0800
Subject: [PATCH 71/85] Take advantage of
 AnnotationRegistry::registerUniqueLoader

This method will only add 'class_exists' as an autoloader if it has not
already been added. This helps alleviate a performance issue when the
same loader is added many times in tests.
---
 .../PhpUnit/Legacy/SymfonyTestsListenerTrait.php |  6 +++++-
 src/Symfony/Bridge/PhpUnit/bootstrap.php         |  6 +++++-
 .../DependencyInjection/FrameworkExtension.php   |  6 ++++++
 .../Resources/config/annotations.xml             | 16 ++++++++--------
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
index 655687575d241..d2ddddf3f23bb 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
@@ -120,7 +120,11 @@ public function startTestSuite($suite)
             $this->state = 0;
 
             if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
-                AnnotationRegistry::registerLoader('class_exists');
+                if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
+                    AnnotationRegistry::registerUniqueLoader('class_exists');
+                } else {
+                    AnnotationRegistry::registerLoader('class_exists');
+                }
             }
 
             if ($this->skippedFile = getenv('SYMFONY_PHPUNIT_SKIPPED_TESTS')) {
diff --git a/src/Symfony/Bridge/PhpUnit/bootstrap.php b/src/Symfony/Bridge/PhpUnit/bootstrap.php
index a265a129e6fdc..5de946789155d 100644
--- a/src/Symfony/Bridge/PhpUnit/bootstrap.php
+++ b/src/Symfony/Bridge/PhpUnit/bootstrap.php
@@ -28,7 +28,11 @@
 setlocale(LC_ALL, 'C');
 
 if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
-    AnnotationRegistry::registerLoader('class_exists');
+    if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
+        AnnotationRegistry::registerUniqueLoader('class_exists');
+    } else {
+        AnnotationRegistry::registerLoader('class_exists');
+    }
 }
 
 if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 8b21f6c644a5a..e4c3b08d938e8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -12,6 +12,7 @@
 namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
 
 use Doctrine\Common\Annotations\Reader;
+use Doctrine\Common\Annotations\AnnotationRegistry;
 use Symfony\Bridge\Monolog\Processor\DebugProcessor;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -1087,6 +1088,11 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
 
         $loader->load('annotations.xml');
 
+        if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
+            $container->getDefinition('annotations.dummy_registry')
+                ->setMethodCalls(array(array('registerLoader', array('class_exists'))));
+        }
+
         if ('none' !== $config['cache']) {
             $cacheService = $config['cache'];
 
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
index 15bf002954199..b751fe3a3d9d9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
@@ -10,14 +10,14 @@
         
             
                 required
-                
-                    
-                    
-                        
-                            class_exists
-                        
-                    
-                
+                
+                
+            
+        
+
+        
+            
+                class_exists
             
         
 

From e7d8e1783b16d09f3aebaf19075abad1348a84f1 Mon Sep 17 00:00:00 2001
From: Christian Flothmann 
Date: Wed, 13 Dec 2017 08:51:34 +0100
Subject: [PATCH 72/85] add missing validation options to XSD file

---
 .../Resources/config/schema/symfony-1.0.xsd        |  2 ++
 .../Fixtures/php/validation_strict_email.php       |  7 +++++++
 .../Fixtures/php/validation_translation_domain.php |  7 +++++++
 .../Fixtures/xml/validation_strict_email.xml       | 11 +++++++++++
 .../Fixtures/xml/validation_translation_domain.xml | 11 +++++++++++
 .../Fixtures/yml/validation_strict_email.yml       |  3 +++
 .../Fixtures/yml/validation_translation_domain.yml |  3 +++
 .../DependencyInjection/FrameworkExtensionTest.php | 14 ++++++++++++++
 8 files changed, 58 insertions(+)
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml
 create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml

diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
index 2d866ff1b5cac..cfcfb34da85d9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -204,6 +204,8 @@
         
         
         
+        
+        
         
     
 
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php
new file mode 100644
index 0000000000000..64a47a232204e
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_strict_email.php
@@ -0,0 +1,7 @@
+loadFromExtension('framework', array(
+    'validation' => array(
+        'strict_email' => true,
+    ),
+));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php
new file mode 100644
index 0000000000000..40a81d4936ce1
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php
@@ -0,0 +1,7 @@
+loadFromExtension('framework', array(
+    'validation' => array(
+        'translation_domain' => 'messages',
+    ),
+));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml
new file mode 100644
index 0000000000000..5b4aba1b70dd6
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_strict_email.xml
@@ -0,0 +1,11 @@
+
+
+
+    
+        
+    
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml
new file mode 100644
index 0000000000000..733d5fa683ebe
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_translation_domain.xml
@@ -0,0 +1,11 @@
+
+
+
+    
+        
+    
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml
new file mode 100644
index 0000000000000..1c805f9b923d2
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_strict_email.yml
@@ -0,0 +1,3 @@
+framework:
+    validation:
+        strict_email: true
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml
new file mode 100644
index 0000000000000..167b5fcce85b1
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_translation_domain.yml
@@ -0,0 +1,3 @@
+framework:
+    validation:
+        translation_domain: messages
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 5601e6a88b236..34a4e2dccd02e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -420,6 +420,20 @@ public function testValidationNoStaticMethod()
         // no cache, no annotations, no static methods
     }
 
+    public function testValidationTranslationDomain()
+    {
+        $container = $this->createContainerFromFile('validation_translation_domain');
+
+        $this->assertSame('messages', $container->getParameter('validator.translation_domain'));
+    }
+
+    public function testValidationStrictEmail()
+    {
+        $container = $this->createContainerFromFile('validation_strict_email');
+
+        $this->assertTrue($container->getDefinition('validator.email')->getArgument(0));
+    }
+
     public function testFormsCanBeEnabledWithoutCsrfProtection()
     {
         $container = $this->createContainerFromFile('form_no_csrf');

From a8871de263d7f1bc7bc659cada4cb98a98ac7469 Mon Sep 17 00:00:00 2001
From: Amrouche Hamza 
Date: Wed, 13 Dec 2017 19:55:05 +0100
Subject: [PATCH 73/85] [Console] Fix a bug when passing a letter that could be
 an alias

---
 src/Symfony/Component/Console/Input/ArgvInput.php           | 2 ++
 src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index 4493a5bafc3b9..23430edde6f70 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -284,6 +284,8 @@ public function hasParameterOption($values)
                 }
 
                 if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
+                    $noValue = explode('=', $token);
+                    $token = $noValue[0];
                     $searchableToken = str_replace('-', '', $token);
                     $searchableValue = str_replace('-', '', $value);
                     if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
index 85fb533715b62..8ded178bbeb6b 100644
--- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
@@ -299,6 +299,9 @@ public function testHasParameterOption()
         $input = new ArgvInput(array('cli.php', '-fh'));
         $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
 
+        $input = new ArgvInput(array('cli.php', '-e=test'));
+        $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input');
+
         $input = new ArgvInput(array('cli.php', '--foo', 'foo'));
         $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
 

From e1c36525fd55b1eb187ce5aefbdc2d39c7286f86 Mon Sep 17 00:00:00 2001
From: David Maicher 
Date: Wed, 13 Dec 2017 20:39:50 +0100
Subject: [PATCH 74/85] [FrameworkBundle] remove esi/ssi renderers if inactive

---
 .../DependencyInjection/FrameworkExtension.php |  4 ++++
 .../FrameworkExtensionTest.php                 | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index dff3d0a62e587..9060660d58a9f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -213,6 +213,8 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
     private function registerEsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
     {
         if (!$this->isConfigEnabled($container, $config)) {
+            $container->removeDefinition('fragment.renderer.esi');
+
             return;
         }
 
@@ -222,6 +224,8 @@ private function registerEsiConfiguration(array $config, ContainerBuilder $conta
     private function registerSsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
     {
         if (!$this->isConfigEnabled($container, $config)) {
+            $container->removeDefinition('fragment.renderer.ssi');
+
             return;
         }
 
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 5601e6a88b236..20bd2322332c6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -96,6 +96,15 @@ public function testEsi()
         $container = $this->createContainerFromFile('full');
 
         $this->assertTrue($container->hasDefinition('esi'), '->registerEsiConfiguration() loads esi.xml');
+        $this->assertTrue($container->hasDefinition('fragment.renderer.esi'));
+    }
+
+    public function testEsiInactive()
+    {
+        $container = $this->createContainerFromFile('default_config');
+
+        $this->assertFalse($container->hasDefinition('fragment.renderer.esi'));
+        $this->assertFalse($container->hasDefinition('esi'));
     }
 
     public function testSsi()
@@ -103,6 +112,15 @@ public function testSsi()
         $container = $this->createContainerFromFile('full');
 
         $this->assertTrue($container->hasDefinition('ssi'), '->registerSsiConfiguration() loads ssi.xml');
+        $this->assertTrue($container->hasDefinition('fragment.renderer.ssi'));
+    }
+
+    public function testSsiInactive()
+    {
+        $container = $this->createContainerFromFile('default_config');
+
+        $this->assertFalse($container->hasDefinition('fragment.renderer.ssi'));
+        $this->assertFalse($container->hasDefinition('ssi'));
     }
 
     public function testEnabledProfiler()

From 8146510304297ad7d5abf9c54fa2b96de759f254 Mon Sep 17 00:00:00 2001
From: Matthias Pigulla 
Date: Sun, 10 Dec 2017 23:33:15 +0100
Subject: [PATCH 75/85] Preserve percent-encoding in URLs when performing
 redirects in the UrlMatcher

---
 .../Matcher/Dumper/PhpMatcherDumper.php       |  8 +--
 .../Tests/Fixtures/dumper/url_matcher1.php    |  4 +-
 .../Tests/Fixtures/dumper/url_matcher2.php    | 14 ++--
 .../Tests/Fixtures/dumper/url_matcher3.php    |  4 +-
 .../Matcher/Dumper/PhpMatcherDumperTest.php   | 72 +++++++++++++++++++
 .../Matcher/RedirectableUrlMatcherTest.php    | 10 +++
 6 files changed, 97 insertions(+), 15 deletions(-)

diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
index 48187c0e3f8b2..016021e259c5f 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
@@ -96,10 +96,10 @@ private function generateMatchMethod($supportsRedirections)
         $code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
 
         return <<context;
         \$request = \$this->request;
 
@@ -284,7 +284,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
         if ($hasTrailingSlash) {
             $code .= <<redirect(\$pathinfo.'/', '$name');
+                return \$this->redirect(\$rawPathinfo.'/', '$name');
             }
 
 
@@ -299,7 +299,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
             $code .= <<context->getScheme()])) {
-                return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes));
+                return \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes));
             }
 
 
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
index 8ab42890aa006..6451192d1877e 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $context = $this->context;
         $request = $this->request;
 
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
index 0f4b33b3c1d70..9b44eb920deab 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $context = $this->context;
         $request = $this->request;
 
@@ -67,7 +67,7 @@ public function match($pathinfo)
                 // baz3
                 if ('/test/baz3' === rtrim($pathinfo, '/')) {
                     if (substr($pathinfo, -1) !== '/') {
-                        return $this->redirect($pathinfo.'/', 'baz3');
+                        return $this->redirect($rawPathinfo.'/', 'baz3');
                     }
 
                     return array('_route' => 'baz3');
@@ -78,7 +78,7 @@ public function match($pathinfo)
             // baz4
             if (preg_match('#^/test/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'baz4');
+                    return $this->redirect($rawPathinfo.'/', 'baz4');
                 }
 
                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
@@ -171,7 +171,7 @@ public function match($pathinfo)
             // hey
             if ('/multi/hey' === rtrim($pathinfo, '/')) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'hey');
+                    return $this->redirect($rawPathinfo.'/', 'hey');
                 }
 
                 return array('_route' => 'hey');
@@ -318,7 +318,7 @@ public function match($pathinfo)
         if ('/secure' === $pathinfo) {
             $requiredSchemes = array (  'https' => 0,);
             if (!isset($requiredSchemes[$this->context->getScheme()])) {
-                return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
+                return $this->redirect($rawPathinfo, 'secure', key($requiredSchemes));
             }
 
             return array('_route' => 'secure');
@@ -328,7 +328,7 @@ public function match($pathinfo)
         if ('/nonsecure' === $pathinfo) {
             $requiredSchemes = array (  'http' => 0,);
             if (!isset($requiredSchemes[$this->context->getScheme()])) {
-                return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
+                return $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes));
             }
 
             return array('_route' => 'nonsecure');
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
index 031b366b6ca22..04043273df740 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $context = $this->context;
         $request = $this->request;
 
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index cb3a1441656e4..da90bc4fdf0a6 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -13,11 +13,39 @@
 
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
+use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
+use Symfony\Component\Routing\Matcher\UrlMatcher;
+use Symfony\Component\Routing\RequestContext;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 
 class PhpMatcherDumperTest extends TestCase
 {
+    /**
+     * @var string
+     */
+    private $matcherClass;
+
+    /**
+     * @var string
+     */
+    private $dumpPath;
+
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->matcherClass = uniqid('ProjectUrlMatcher');
+        $this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+
+        @unlink($this->dumpPath);
+    }
+
     /**
      * @expectedException \LogicException
      */
@@ -36,6 +64,23 @@ public function testDumpWhenSchemeIsUsedWithoutAProperDumper()
         $dumper->dump();
     }
 
+    public function testRedirectPreservesUrlEncoding()
+    {
+        $collection = new RouteCollection();
+        $collection->add('foo', new Route('/foo:bar/'));
+
+        $class = $this->generateDumpedMatcher($collection, true);
+
+        $matcher = $this->getMockBuilder($class)
+                        ->setMethods(array('redirect'))
+                        ->setConstructorArgs(array(new RequestContext()))
+                        ->getMock();
+        
+        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo');
+
+        $matcher->match('/foo%3Abar');
+    }
+
     /**
      * @dataProvider getRouteCollections
      */
@@ -285,4 +330,31 @@ public function getRouteCollections()
            array($rootprefixCollection, 'url_matcher3.php', array()),
         );
     }
+
+    /**
+     * @param $dumper
+     */
+    private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false)
+    {
+        $options = array('class' => $this->matcherClass);
+
+        if ($redirectableStub) {
+            $options['base_class'] = '\Symfony\Component\Routing\Tests\Matcher\Dumper\RedirectableUrlMatcherStub';
+        }
+
+        $dumper = new PhpMatcherDumper($collection);
+        $code = $dumper->dump($options);
+
+        file_put_contents($this->dumpPath, $code);
+        include $this->dumpPath;
+
+        return $this->matcherClass;
+    }
+}
+
+abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface
+{
+    public function redirect($path, $route, $scheme = null)
+    {
+    }
 }
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index ba4c6e972f19c..0b5bb0dc78cac 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -69,4 +69,14 @@ public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches()
         ;
         $matcher->match('/foo');
     }
+
+    public function testRedirectPreservesUrlEncoding()
+    {
+        $coll = new RouteCollection();
+        $coll->add('foo', new Route('/foo:bar/'));
+
+        $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/');
+        $matcher->match('/foo%3Abar');
+    }
 }

From be75bd994b6d0532a376ad0757f7961e4c19afb7 Mon Sep 17 00:00:00 2001
From: Ryan Weaver 
Date: Thu, 14 Dec 2017 11:30:58 -0800
Subject: [PATCH 76/85] Fixing wrong class_exists on interface

---
 .../FrameworkBundle/DependencyInjection/Configuration.php       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index c9dbd6af77a2a..bfb5f9e70d245 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -143,7 +143,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
         $rootNode
             ->children()
                 ->arrayNode('csrf_protection')
-                    ->{!class_exists(FullStack::class) && class_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
+                    ->{!class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
                 ->end()
             ->end()
         ;

From f5f3dd7878f73585de83022b708c4de4f3d7f0f9 Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 11:33:46 -0800
Subject: [PATCH 77/85] [Routing] fixed tests

---
 .../Tests/Fixtures/dumper/url_matcher4.php    |  4 ++--
 .../Tests/Fixtures/dumper/url_matcher5.php    | 22 +++++++++----------
 .../Tests/Fixtures/dumper/url_matcher6.php    |  4 ++--
 .../Tests/Fixtures/dumper/url_matcher7.php    | 16 +++++++-------
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
index 6aefd6938272c..50da489fb2a0b 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher4.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $trimmedPathinfo = rtrim($pathinfo, '/');
         $context = $this->context;
         $request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
index 1884df1c45e27..14c5f5bdf93d9 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher5.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $trimmedPathinfo = rtrim($pathinfo, '/');
         $context = $this->context;
         $request = $this->request;
@@ -57,7 +57,7 @@ public function match($pathinfo)
             // a_fourth
             if ('/a/44' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'a_fourth');
+                    return $this->redirect($rawPathinfo.'/', 'a_fourth');
                 }
 
                 return array('_route' => 'a_fourth');
@@ -66,7 +66,7 @@ public function match($pathinfo)
             // a_fifth
             if ('/a/55' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'a_fifth');
+                    return $this->redirect($rawPathinfo.'/', 'a_fifth');
                 }
 
                 return array('_route' => 'a_fifth');
@@ -75,7 +75,7 @@ public function match($pathinfo)
             // a_sixth
             if ('/a/66' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'a_sixth');
+                    return $this->redirect($rawPathinfo.'/', 'a_sixth');
                 }
 
                 return array('_route' => 'a_sixth');
@@ -92,7 +92,7 @@ public function match($pathinfo)
             // nested_a
             if ('/nested/group/a' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'nested_a');
+                    return $this->redirect($rawPathinfo.'/', 'nested_a');
                 }
 
                 return array('_route' => 'nested_a');
@@ -101,7 +101,7 @@ public function match($pathinfo)
             // nested_b
             if ('/nested/group/b' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'nested_b');
+                    return $this->redirect($rawPathinfo.'/', 'nested_b');
                 }
 
                 return array('_route' => 'nested_b');
@@ -110,7 +110,7 @@ public function match($pathinfo)
             // nested_c
             if ('/nested/group/c' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'nested_c');
+                    return $this->redirect($rawPathinfo.'/', 'nested_c');
                 }
 
                 return array('_route' => 'nested_c');
@@ -122,7 +122,7 @@ public function match($pathinfo)
             // slashed_a
             if ('/slashed/group' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'slashed_a');
+                    return $this->redirect($rawPathinfo.'/', 'slashed_a');
                 }
 
                 return array('_route' => 'slashed_a');
@@ -131,7 +131,7 @@ public function match($pathinfo)
             // slashed_b
             if ('/slashed/group/b' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'slashed_b');
+                    return $this->redirect($rawPathinfo.'/', 'slashed_b');
                 }
 
                 return array('_route' => 'slashed_b');
@@ -140,7 +140,7 @@ public function match($pathinfo)
             // slashed_c
             if ('/slashed/group/c' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'slashed_c');
+                    return $this->redirect($rawPathinfo.'/', 'slashed_c');
                 }
 
                 return array('_route' => 'slashed_c');
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
index bb9d80b55181b..933525699c0e7 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher6.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $trimmedPathinfo = rtrim($pathinfo, '/');
         $context = $this->context;
         $request = $this->request;
diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
index 404d462ed5415..3306bb124e741 100644
--- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
+++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher7.php
@@ -15,10 +15,10 @@ public function __construct(RequestContext $context)
         $this->context = $context;
     }
 
-    public function match($pathinfo)
+    public function match($rawPathinfo)
     {
         $allow = array();
-        $pathinfo = rawurldecode($pathinfo);
+        $pathinfo = rawurldecode($rawPathinfo);
         $trimmedPathinfo = rtrim($pathinfo, '/');
         $context = $this->context;
         $request = $this->request;
@@ -34,7 +34,7 @@ public function match($pathinfo)
             // simple_trailing_slash_no_methods
             if ('/trailing/simple/no-methods' === $trimmedPathinfo) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods');
+                    return $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods');
                 }
 
                 return array('_route' => 'simple_trailing_slash_no_methods');
@@ -48,7 +48,7 @@ public function match($pathinfo)
                 }
 
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method');
+                    return $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method');
                 }
 
                 return array('_route' => 'simple_trailing_slash_GET_method');
@@ -63,7 +63,7 @@ public function match($pathinfo)
                 }
 
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method');
+                    return $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method');
                 }
 
                 return array('_route' => 'simple_trailing_slash_HEAD_method');
@@ -87,7 +87,7 @@ public function match($pathinfo)
             // regex_trailing_slash_no_methods
             if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods');
+                    return $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods');
                 }
 
                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
@@ -101,7 +101,7 @@ public function match($pathinfo)
                 }
 
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method');
+                    return $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method');
                 }
 
                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
@@ -116,7 +116,7 @@ public function match($pathinfo)
                 }
 
                 if (substr($pathinfo, -1) !== '/') {
-                    return $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method');
+                    return $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method');
                 }
 
                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());

From eaf5642b95abf6063d80e8e85d1a33b69340f692 Mon Sep 17 00:00:00 2001
From: Ryan Weaver 
Date: Thu, 14 Dec 2017 11:37:45 -0800
Subject: [PATCH 78/85] Tweak message to be Flex friendly

---
 .../FrameworkBundle/DependencyInjection/FrameworkExtension.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index e4c3b08d938e8..3418557352045 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -1158,7 +1158,7 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
         }
 
         if (!class_exists('Symfony\Component\Security\Csrf\CsrfToken')) {
-            throw new LogicException('CSRF support cannot be enabled as the Security CSRF component is not installed.');
+            throw new LogicException('CSRF support cannot be enabled as the Security CSRF component is not installed. Try running "composer require security-csrf".');
         }
 
         if (!$this->sessionConfigEnabled) {

From 826d545ba0dda18f468601df40fc7218f051861e Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 11:41:37 -0800
Subject: [PATCH 79/85] fixed wrong merge

---
 .../DependencyInjection/FrameworkExtension.php                | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 62b6abaa94b6f..7676f98474d95 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -1343,14 +1343,12 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
 
         $loader->load('annotations.xml');
 
-<<<<<<< HEAD
         $container->getAlias('annotation_reader')->setPrivate(true);
-=======
+
         if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
             $container->getDefinition('annotations.dummy_registry')
                 ->setMethodCalls(array(array('registerLoader', array('class_exists'))));
         }
->>>>>>> 3.3
 
         if ('none' !== $config['cache']) {
             if (!class_exists('Doctrine\Common\Cache\CacheProvider')) {

From e273d8107efe108b3cec4a85a3508c90b7607acc Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Thu, 14 Dec 2017 23:23:34 +0100
Subject: [PATCH 80/85] [SecurityBundle] fix test by always disabling CSRF

---
 .../Compiler/AddSessionDomainConstraintPassTest.php             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php
index 5238eb3f842c3..382bdebe018fa 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php
@@ -121,7 +121,7 @@ private function createContainer($sessionStorageOptions)
         );
 
         $ext = new FrameworkExtension();
-        $ext->load(array(), $container);
+        $ext->load(array('framework' => array('csrf_protection' => false)), $container);
 
         $ext = new SecurityExtension();
         $ext->load($config, $container);

From 3c67741954b164e30f4621026b53e2aa95d8cd7d Mon Sep 17 00:00:00 2001
From: Nicolas Grekas 
Date: Thu, 14 Dec 2017 23:37:31 +0100
Subject: [PATCH 81/85] [Routing] Fix tests

---
 .../Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php       | 2 +-
 .../Routing/Tests/Matcher/RedirectableUrlMatcherTest.php        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index 4365394d23934..37ac752a6bf91 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -76,7 +76,7 @@ public function testRedirectPreservesUrlEncoding()
                         ->setConstructorArgs(array(new RequestContext()))
                         ->getMock();
         
-        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo');
+        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn(array());
 
         $matcher->match('/foo%3Abar');
     }
diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index 3c84c35209c6a..0948e002adf8a 100644
--- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -105,7 +105,7 @@ public function testRedirectPreservesUrlEncoding()
         $coll->add('foo', new Route('/foo:bar/'));
 
         $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
-        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/');
+        $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn(array());
         $matcher->match('/foo%3Abar');
     }
 }

From 8013b4b2d37f429c1db941cfcf2a9c06b354c525 Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 17:44:00 -0800
Subject: [PATCH 82/85] Revert "bug #25502 Fixing wrong class_exists on
 interface (weaverryan)"

This reverts commit 5fd5f19eaf3c4041a3556867270974cbcf0e8f90, reversing
changes made to 826d545ba0dda18f468601df40fc7218f051861e.
---
 .../FrameworkBundle/DependencyInjection/Configuration.php       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index bfb5f9e70d245..c9dbd6af77a2a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -143,7 +143,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
         $rootNode
             ->children()
                 ->arrayNode('csrf_protection')
-                    ->{!class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
+                    ->{!class_exists(FullStack::class) && class_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
                 ->end()
             ->end()
         ;

From 903f120816374ebb11edac924610c922b8d0a27d Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 17:44:04 -0800
Subject: [PATCH 83/85] Revert "bug #25151 [FrameworkBundle] Automatically
 enable the CSRF protection if CSRF manager exists (sroze)"

This reverts commit d5f04284f9aacf3eed825c69eca7426b0f333487, reversing
changes made to e52825e2533af77361ed7a424fb0952e9161ff2d.
---
 .../FrameworkBundle/DependencyInjection/Configuration.php      | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index c9dbd6af77a2a..d5030fc9fe7cf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -21,7 +21,6 @@
 use Symfony\Component\Form\Form;
 use Symfony\Component\Lock\Lock;
 use Symfony\Component\Lock\Store\SemaphoreStore;
-use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
 use Symfony\Component\Serializer\Serializer;
 use Symfony\Component\Translation\Translator;
 use Symfony\Component\Validator\Validation;
@@ -143,7 +142,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
         $rootNode
             ->children()
                 ->arrayNode('csrf_protection')
-                    ->{!class_exists(FullStack::class) && class_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
+                    ->canBeEnabled()
                 ->end()
             ->end()
         ;

From caff4915d748ba15907a576532307927232af427 Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 18:05:10 -0800
Subject: [PATCH 84/85] updated CHANGELOG for 3.4.2

---
 CHANGELOG-3.4.md | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md
index 7be69fd18959c..24620ba3a50fb 100644
--- a/CHANGELOG-3.4.md
+++ b/CHANGELOG-3.4.md
@@ -7,6 +7,40 @@ in 3.4 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.4.0...v3.4.1
 
+* 3.4.2 (2017-12-15)
+
+ * bug #25489 [FrameworkBundle] remove esi/ssi renderers if inactive (dmaicher)
+ * bug #25502 Fixing wrong class_exists on interface (weaverryan)
+ * bug #25427 Preserve percent-encoding in URLs when performing redirects in the UrlMatcher (mpdude)
+ * bug #25480 [FrameworkBundle] add missing validation options to XSD file (xabbuh)
+ * bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit)
+ * bug #25425 When available use AnnotationRegistry::registerUniqueLoader (jrjohnson)
+ * bug #25474 [DI] Optimize Container::get() for perf (nicolas-grekas)
+ * bug #24594 [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files (BjornTwachtmann)
+ * bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque)
+ * bug #25413 [HttpKernel] detect deprecations thrown by container initialization during tests (nicolas-grekas)
+ * bug #25408 [Debug] Fix catching fatal errors in case of nested error handlers (nicolas-grekas)
+ * bug #25330 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) (stephank)
+ * bug #25378 [VarDumper] Fixed file links leave blank pages when ide is configured (antalaron)
+ * bug #25410 [HttpKernel] Fix logging of post-terminate errors/exceptions (nicolas-grekas)
+ * bug #25417 [Process] Dont rely on putenv(), it fails on ZTS PHP (nicolas-grekas)
+ * bug #25333 [DI] Impossible to set an environment variable and then an array as container parameter (Phantas0s)
+ * bug #25447 [Process] remove false-positive BC breaking exception on Windows (nicolas-grekas)
+ * bug #25381 [DI] Add context to service-not-found exceptions thrown by service locators (nicolas-grekas)
+ * bug #25438 [Yaml] empty lines don't count for indent detection (xabbuh)
+ * bug #25412 Extend Argon2i support check to account for sodium_compat (mbabker)
+ * bug #25389 [Yaml] fix some edge cases with indented blocks (xabbuh)
+ * bug #25396 [Form] Fix debug:form command definition (yceruto)
+ * bug #25398 [HttpFoundation] don't prefix cookies with "Set-Cookie:" (pableu)
+ * bug #25354 [DI] Fix non-string class handling in PhpDumper (nicolas-grekas, sroze)
+ * bug #25340 [Serializer] Unset attributes when creating child context (dunglas)
+ * bug #25325 [Yaml] do not evaluate PHP constant names (xabbuh)
+ * bug #25380 [FrameworkBundle][Cache] register system cache clearer only if it's used (xabbuh)
+ * bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit)
+ * bug #25363 [HttpKernel] Disable inlining on PHP 5 (nicolas-grekas)
+ * bug #25364 [DependencyInjection] Prevent a loop in aliases within the `findDefinition` method (sroze)
+ * bug #25337 Remove Exclusive Lock That Breaks NFS Caching (brianfreytag)
+
 * 3.4.1 (2017-12-04)
 
  * bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox)

From fa1546a0e780b6e97eba86859b1cf9a9d0dfcafc Mon Sep 17 00:00:00 2001
From: Fabien Potencier 
Date: Thu, 14 Dec 2017 18:05:18 -0800
Subject: [PATCH 85/85] updated VERSION for 3.4.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 4baa86c410b8f..94686a389ad77 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
     private $requestStackSize = 0;
     private $resetServices = false;
 
-    const VERSION = '3.4.2-DEV';
+    const VERSION = '3.4.2';
     const VERSION_ID = 30402;
     const MAJOR_VERSION = 3;
     const MINOR_VERSION = 4;
     const RELEASE_VERSION = 2;
-    const EXTRA_VERSION = 'DEV';
+    const EXTRA_VERSION = '';
 
     const END_OF_MAINTENANCE = '11/2020';
     const END_OF_LIFE = '11/2021';