From 17f02e0dc4825c870311e4fe0c355559bddfbd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Fri, 9 Dec 2016 11:59:21 +0100 Subject: [PATCH 01/98] [Config] Fix checking cache for non existing meta file --- .../Component/Config/ResourceCheckerConfigCache.php | 5 ----- .../Config/Tests/ResourceCheckerConfigCacheTest.php | 12 ++++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index ba7d600c7737b..0e3a411b07552 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -72,11 +72,6 @@ public function isFresh() return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all } - $metadata = $this->getMetaFile(); - if (!is_file($metadata)) { - return true; - } - $metadata = $this->getMetaFile(); if (!is_file($metadata)) { return false; diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php index c76c0dd0ac2b9..f921ad492848d 100644 --- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php @@ -128,4 +128,16 @@ public function testCacheKeepsContent() $this->assertSame('FOOBAR', file_get_contents($cache->getPath())); } + + public function testCacheIsNotFreshIfNotExistsMetaFile() + { + $checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface'); + $cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker)); + $cache->write('foo', array(new FileResource(__FILE__))); + + $metaFile = "{$this->cacheFile}.meta"; + unlink($metaFile); + + $this->assertFalse($cache->isFresh()); + } } From 9e0d531d36d607e711b97e2c7951fda867397dee Mon Sep 17 00:00:00 2001 From: HeahDude Date: Tue, 27 Dec 2016 15:46:49 +0100 Subject: [PATCH 02/98] [Form] Fixed DateType format option --- .../Form/Extension/Core/Type/DateType.php | 12 +++++--- .../Extension/Core/Type/DateTypeTest.php | 29 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 8af7a96f13cd6..2bc433f8414f2 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -51,11 +51,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); } - if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) { - throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); - } - if ('single_text' === $options['widget']) { + if (null !== $pattern && false === strpos($pattern, 'y') && false === strpos($pattern, 'M') && false === strpos($pattern, 'd')) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern)); + } + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( $options['model_timezone'], $options['view_timezone'], @@ -65,6 +65,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) $pattern )); } else { + if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); + } + $yearOptions = $monthOptions = $dayOptions = array( 'error_bubbling' => true, ); 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 ea302d020eec3..b31fa5e9c5fe1 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -67,6 +67,22 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() $this->assertEquals('2010-06-02', $form->getViewData()); } + public function testSubmitFromSingleTextDateTimeWithCustomFormat() + { + $form = $this->factory->create('date', null, array( + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', + 'widget' => 'single_text', + 'input' => 'datetime', + 'format' => 'yyyy', + )); + + $form->submit('2010'); + + $this->assertDateTimeEquals(new \DateTime('2010-01-01 UTC'), $form->getData()); + $this->assertEquals('2010', $form->getViewData()); + } + public function testSubmitFromSingleTextDateTime() { // we test against "de_AT", so we need the full implementation @@ -337,6 +353,7 @@ public function testThrowExceptionIfFormatIsNoPattern() /** * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @expectedExceptionMessage The "format" option should contain the letters "y", "M" and "d". Its current value is "yy". */ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() { @@ -346,6 +363,18 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() )); } + /** + * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @expectedExceptionMessage The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong". + */ + public function testThrowExceptionIfFormatDoesNotContainYearMonthOrDay() + { + $this->factory->create('date', null, array( + 'widget' => 'single_text', + 'format' => 'wrong', + )); + } + /** * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ From 7f15bc39ea9f5d923d16adcceaedd76d43559058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 12 Jan 2017 19:45:33 +0100 Subject: [PATCH 03/98] [FrameworkBundle] Skip test if xdebug.file_link_format is defined. The test suite does not pass locally because I use a custom file_link_format. I do it because it works everywhere. Then, Symfony tries to read this value before the default one. We could use ini_set before the test but unfortunatelly there are no way to define the "cfg_var". For recall, get_cfg_var allows to return the configuration value even if the extension is not loaded. And again it's my case: I don't enable xdebug to have better performance. --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b9116d39a3602..bc1eac93e6dac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -318,6 +318,10 @@ public function testAnnotations() public function testFileLinkFormat() { + if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { + $this->markTestSkipped('A custom file_link_format is defined.'); + } + $container = $this->createContainerFromFile('full'); $this->assertEquals('file%link%format', $container->getParameter('templating.helper.code.file_link_format')); From dd3fbea1491467e5287bf1c0e219adc6319bf6e6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:04 -0800 Subject: [PATCH 04/98] updated CHANGELOG for 2.7.23 --- CHANGELOG-2.7.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index ff7d6301ddcc4..df5011ef69c67 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,43 @@ 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.23 (2017-01-12) + + * bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik) + * bug #21104 [FrameworkBundle] fix IPv6 address handling in server commands (xabbuh) + * bug #20793 [Validator] Fix caching of constraints derived from non-serializable parents (uwej711) + * bug #19586 [TwigBundle] Fix bug where namespaced paths don't take parent bundles in account (wesleylancel) + * bug #21237 [FrameworkBundle] Fix relative paths used as cache keys (nicolas-grekas) + * bug #21183 [Validator] respect groups when merging constraints (xabbuh) + * bug #21179 [TwigBundle] Fixing regression in TwigEngine exception handling (Bertalan Attila) + * bug #21220 [DI] Fix missing new line after private alias (ogizanagi) + * bug #21211 Classloader tmpname (lyrixx) + * bug #21205 [TwigBundle] fixed usage when Templating is not installed (fabpot) + * bug #21155 [Validator] Check cascasdedGroups for being countable (scaytrase) + * bug #21200 [Filesystem] Check that directory is writable after created it in dumpFile() (chalasr) + * bug #21113 [FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure (chalasr) + * bug #21084 [Yaml] handle empty lines inside unindented collection (xabbuh) + * bug #20925 [HttpFoundation] Validate/cast cookie expire time (ro0NL) + * bug #21032 [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService (lyrixx) + * bug #21078 [Console] Escape default value when dumping help (lyrixx) + * bug #21076 [Console] OS X Can't call cli_set_process_title php without superuser (ogizanagi) + * bug #20900 [Console] Descriptors should use Helper::strlen (ogizanagi) + * bug #21064 [Debug] Wrap call to ->log in a try catch block (lyrixx) + * bug #21010 [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes (SpacePossum) + * bug #20859 Avoid warning in PHP 7.2 because of non-countable data (wouterj) + * bug #21053 [Validator] override property constraints in child class (xabbuh) + * bug #20970 [Console] Fix question formatting using SymfonyStyle::ask() (chalasr, ogizanagi) + * bug #20975 [Form] fix group sequence based validation (xabbuh) + * bug #20599 [WebProfilerBundle] Display multiple HTTP headers in WDT (ro0NL) + * bug #20799 [TwigBundle] do not try to register incomplete definitions (xabbuh) + * bug #20961 [Validator] phpize default option values (xabbuh) + * bug #20934 [FrameworkBundle] Fix PHP form templates on translatable attributes (ro0NL) + * bug #20957 [FrameworkBundle] test for the Validator component to be present (xabbuh) + * bug #20936 [DependencyInjection] Fix on-invalid attribute type in xsd (ogizanagi) + * bug #20931 [VarDumper] Fix dumping by-ref variadics (nicolas-grekas) + * bug #20734 [Security] AbstractVoter->supportsAttribute gives false positive if attribute is zero (0) (martynas-foodpanda) + * bug #14082 [config] Fix issue when key removed and left value only (zerustech) + * 2.7.22 (2016-12-13) * bug #20714 [FrameworkBundle] Fix unresolved parameters from default configs in debug:config (chalasr) From fe67ce520968c763be3e34f8ac8919ead730fd23 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:11 -0800 Subject: [PATCH 05/98] update CONTRIBUTORS for 2.7.23 --- CONTRIBUTORS.md | 77 +++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 24f9845d0b517..f740b56abf6f9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -27,18 +27,18 @@ Symfony is the result of the work of many people who made the code better - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - - Jeremy Mikola (jmikola) - Grégoire Pineau (lyrixx) + - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Eriksen Costa (eriksencosta) - - Jules Pietri (heah) - Maxime Steinhausser (ogizanagi) + - Jules Pietri (heah) + - Robin Chalas (chalas_r) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Diego Saint Esteben (dosten) - - Robin Chalas (chalas_r) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -49,11 +49,12 @@ Symfony is the result of the work of many people who made the code better - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik - - Diego Saint Esteben (dii3g0) - Ener-Getick (energetick) + - Diego Saint Esteben (dii3g0) - Konstantin Kudryashov (everzet) - - Bilal Amarni (bamarni) - Iltar van der Berg (kjarli) + - Roland Franssen (ro0) + - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Peter Rehm (rpet) - Kevin Bond (kbond) @@ -69,19 +70,18 @@ Symfony is the result of the work of many people who made the code better - Henrik Westphal (snc) - Dariusz Górecki (canni) - Douglas Greenshields (shieldo) + - Titouan Galopin (tgalopin) - Konstantin Myakshin (koc) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Graham Campbell (graham) - - Titouan Galopin (tgalopin) - Daniel Holmes (dholmes) - Pierre du Plessis (pierredup) - Toni Uebernickel (havvg) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - John Wards (johnwards) - - Roland Franssen (ro0) - Fran Moreno (franmomu) - Jáchym Toušek (enumag) - Antoine Hérault (herzult) @@ -98,6 +98,7 @@ Symfony is the result of the work of many people who made the code better - lenar - Włodzimierz Gajda (gajdaw) - Baptiste Clavié (talus) + - Maxime STEINHAUSSER - Alexander Schwenn (xelaris) - Florian Voutzinos (florianv) - Colin Frei @@ -114,13 +115,13 @@ Symfony is the result of the work of many people who made the code better - Eric GELOEN (gelo) - David Buchmann (dbu) - Tugdual Saunier (tucksaun) - - Maxime STEINHAUSSER - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - Juti Noppornpitak (shiroyuki) + - Tobias Nyholm (tobias) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) @@ -130,12 +131,11 @@ Symfony is the result of the work of many people who made the code better - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) - Andréia Bohner (andreia) + - Yonel Ceruto González (yonelceruto) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - jwdeitch - - Tobias Nyholm (tobias) - Joel Wurtz (brouznouf) - - Yonel Ceruto González (yonelceruto) - Philipp Wahala (hifi) - Vyacheslav Pavlov - Javier Spagnoletti (phansys) @@ -179,6 +179,7 @@ Symfony is the result of the work of many people who made the code better - fivestar - Dominique Bongiraud - Jeremy Livingston (jeremylivingston) + - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) - Leszek Prabucki (l3l0) - François Zaninotto (fzaninotto) @@ -187,6 +188,7 @@ Symfony is the result of the work of many people who made the code better - John Kary (johnkary) - Justin Hileman (bobthecow) - Blanchon Vincent (blanchonvincent) + - Chris Wilkinson (thewilkybarkid) - Michele Orselli (orso) - Tom Van Looy (tvlooy) - Sven Paulus (subsven) @@ -195,6 +197,7 @@ Symfony is the result of the work of many people who made the code better - Dawid Nowak - Eugene Wissner - Julien Brochet (mewt) + - Tristan Darricau (nicofuma) - Sergey Linnik (linniksa) - Michaël Perrin (michael.perrin) - Marcel Beerta (mazen) @@ -202,7 +205,6 @@ Symfony is the result of the work of many people who made the code better - Jannik Zschiesche (apfelbox) - Marco Pivetta (ocramius) - julien pauli (jpauli) - - Michael Lee (zerustech) - Lorenz Schori - Sébastien Lavoie (lavoiesl) - Francois Zaninotto @@ -216,20 +218,20 @@ Symfony is the result of the work of many people who made the code better - Roman Marintšenko (inori) - Christian Schmidt - Xavier Montaña Carreras (xmontana) - - Chris Wilkinson (thewilkybarkid) - Mickaël Andrieu (mickaelandrieu) - Xavier Perez - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA + - Patrick McDougle (patrick-mcdougle) - James Halsall (jaitsu) - Alif Rachmawadi - Kristen Gilden (kgilden) + - SpacePossum - Pierre-Yves LEBECQ (pylebecq) - Alex Pott - Jakub Kucharovic (jkucharovic) - Eugene Leonovich (rybakit) - Filippo Tessarotto - - Tristan Darricau (nicofuma) - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) - GordonsLondon @@ -259,7 +261,6 @@ Symfony is the result of the work of many people who made the code better - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Marc Weistroff (futurecat) - - SpacePossum - Hidde Wieringa (hiddewie) - Chris Smith (cs278) - Florian Klein (docteurklein) @@ -278,12 +279,14 @@ Symfony is the result of the work of many people who made the code better - Ismael Ambrosi (iambrosi) - Uwe Jäger (uwej711) - Aurelijus Valeiša (aurelijus) + - Victor Bocharsky (bocharsky_bw) - Jan Decavele (jandc) - Gustavo Piltcher - Stepan Tanasiychuk (stfalcon) - Tiago Ribeiro (fixe) - Hidde Boomsma (hboomsma) - John Bafford (jbafford) + - Pavel Batanov (scaytrase) - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) @@ -304,6 +307,7 @@ Symfony is the result of the work of many people who made the code better - Matthew Lewinski (lewinski) - Magnus Nordlander (magnusnordlander) - alquerci + - Adam Prager (padam87) - Francesco Levorato - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) @@ -324,6 +328,7 @@ Symfony is the result of the work of many people who made the code better - Clément Gautier (clementgautier) - Eduardo Gulias (egulias) - giulio de donato (liuggio) + - ShinDarth - Stéphane PY (steph_py) - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) @@ -336,9 +341,9 @@ Symfony is the result of the work of many people who made the code better - Hassan Amouhzi - Tamas Szijarto - Pavel Volokitin (pvolok) + - François Pluchino (francoispluchino) - Nicolas Dewez (nicolas_dewez) - Endre Fejes - - Victor Bocharsky (bocharsky_bw) - Tobias Naumann (tna) - Daniel Beyer - Shein Alexey @@ -355,7 +360,6 @@ Symfony is the result of the work of many people who made the code better - Xavier HAUSHERR - Albert Jessurum (ajessu) - Laszlo Korte - - Pavel Batanov (scaytrase) - Miha Vrhovnik - Alessandro Desantis - hubert lecorche (hlecorche) @@ -412,6 +416,7 @@ Symfony is the result of the work of many people who made the code better - boombatower - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) + - Andrey Astakhov (aast) - Fabian Lange (codingfabian) - Frank Neff (fneff) - Roman Lapin (memphys) @@ -422,6 +427,7 @@ Symfony is the result of the work of many people who made the code better - Pablo Díez (pablodip) - Kevin McBride - Sergio Santoro + - Robin van der Vleuten (robinvdvleuten) - Philipp Rieber (bicpi) - Manuel de Ruiter (manuel) - Eduardo Oliveira (entering) @@ -478,7 +484,6 @@ Symfony is the result of the work of many people who made the code better - Alexander Deruwe (aderuwe) - Alain Hippolyte (aloneh) - Dave Hulbert (dave1010) - - François Pluchino (francoispluchino) - Ivan Rey (ivanrey) - Marcin Chyłek (songoq) - Ned Schwartz @@ -512,6 +517,7 @@ Symfony is the result of the work of many people who made the code better - Konstantin S. M. Möllers (ksmmoellers) - Sinan Eldem - Alexandre Dupuy (satchette) + - Rob Frawley 2nd - Nahuel Cuesta (ncuesta) - Chris Boden (cboden) - Asmir Mustafic (goetas) @@ -522,6 +528,7 @@ Symfony is the result of the work of many people who made the code better - Åsmund Garfors - Maxime Douailin - Jean Pasdeloup (pasdeloup) + - Benjamin Cremer (bcremer) - Javier López (loalf) - Andreas Braun - Reinier Kip @@ -551,7 +558,6 @@ Symfony is the result of the work of many people who made the code better - umpirski - Chris Heng (gigablah) - Ulumuddin Yunus (joenoez) - - Adam Prager (padam87) - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - Samuel ROZE (sroze) @@ -586,6 +592,7 @@ Symfony is the result of the work of many people who made the code better - develop - ReenExe - Mark Sonnabaum + - Thomas Royer (cydonia7) - Richard Quadling - jochenvdv - Arturas Smorgun (asarturas) @@ -593,6 +600,7 @@ Symfony is the result of the work of many people who made the code better - Michael Piecko - yclian - twifty + - Indra Gunawan (guind) - Peter Ward - Julien DIDIER (juliendidier) - Dominik Ritter (dritter) @@ -600,10 +608,10 @@ Symfony is the result of the work of many people who made the code better - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) + - Thomas Calvet - Vladyslav Petrovych - Alex Xandra Albert Sim - Carson Full - - Andrey Astakhov (aast) - Trent Steel (trsteel88) - Yuen-Chi Lian - Besnik Br @@ -630,11 +638,13 @@ Symfony is the result of the work of many people who made the code better - Christian Soronellas (theunic) - Romain Gautier (mykiwi) - Yosmany Garcia (yosmanyga) + - Wouter J - Wouter de Wild - Miroslav Sustek - Degory Valentine - Benoit Lévêque (benoit_leveque) - Jeroen Fiege (fieg) + - Arthur de Moulins (4rthem) - Krzysiek Łabuś - Xavier Lacot (xavier) - possum @@ -642,6 +652,7 @@ Symfony is the result of the work of many people who made the code better - Olivier Maisonneuve (olineuve) - Masterklavi - Francis Turmel (fturmel) + - Nikita Nefedov (nikita2206) - cgonzalez - Ben - Jayson Xu (superjavason) @@ -683,8 +694,10 @@ Symfony is the result of the work of many people who made the code better - Ivan Menshykov - David Romaní - Patrick Allaert + - Fabien Bourigault (fbourigault) - Gustavo Falco (gfalco) - Matt Robinson (inanimatt) + - Ruud Kamphuis (ruudk) - Aleksey Podskrebyshev - Calin Mihai Pristavu - David Marín Carreño (davefx) @@ -734,7 +747,6 @@ Symfony is the result of the work of many people who made the code better - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) - - Robin van der Vleuten (robinvdvleuten) - Simon Terrien (sterrien) - Benoît Merlet (trompette) - Koen Kuipers @@ -763,6 +775,7 @@ Symfony is the result of the work of many people who made the code better - Colin O'Dell (colinodell) - xaav - Mahmoud Mostafa (mahmoud) + - Alessandro Lai - Pieter - Michael Tibben - Sander Marechal @@ -811,8 +824,10 @@ Symfony is the result of the work of many people who made the code better - Nicolas Macherey - Lin Clark - Jeremy David (jeremy.david) + - Denis Brumann (dbrumann) - Troy McCabe - Ville Mattila + - ilyes kooli - Boris Vujicic (boris.vujicic) - Max Beutel - Antanas Arvasevicius @@ -832,6 +847,7 @@ Symfony is the result of the work of many people who made the code better - Christian - Sergii Smertin (nfx) - hugofonseca (fonsecas72) + - Martynas Narbutas - Bailey Parker - Eddie Jaoude - Haritz Iturbe (hizai) @@ -846,7 +862,6 @@ Symfony is the result of the work of many people who made the code better - Alex Demchenko (pilot) - Tadas Gliaubicas (tadcka) - Benoit Garret - - Thomas Royer (cydonia7) - DerManoMann - Olaf Klischat - orlovv @@ -867,7 +882,6 @@ Symfony is the result of the work of many people who made the code better - rpg600 - Péter Buri (burci) - Davide Borsatto (davide.borsatto) - - Indra Gunawan (guind) - kaiwa - Charles Sanquer (csanquer) - Albert Ganiev (helios-ag) @@ -909,6 +923,7 @@ Symfony is the result of the work of many people who made the code better - Krzysztof Przybyszewski - Paul Matthews - Juan Traverso + - Tarjei Huse (tarjei) - Philipp Strube - Christian Sciberras - Clement Herreman (clemherreman) @@ -919,7 +934,6 @@ Symfony is the result of the work of many people who made the code better - Alberto Aldegheri - heccjj - Alexandre Melard - - Thomas Calvet - Sergey Yuferev - Tobias Stöckler - Mario Young @@ -973,6 +987,7 @@ Symfony is the result of the work of many people who made the code better - Samuel Vogel (samuelvogel) - Berat Doğan - Juanmi Rodriguez Cerón + - Andy Raines - Anthony Ferrara - Klaas Cuvelier (kcuvelier) - Steve Frécinaux @@ -998,6 +1013,7 @@ Symfony is the result of the work of many people who made the code better - Alberto Pirovano (geezmo) - Pete Mitchell (peterjmit) - Tom Corrigan (tomcorrigan) + - Luis Galeas - Martin Pärtel - Noah Heck (myesain) - Patrick Daley (padrig) @@ -1014,7 +1030,6 @@ Symfony is the result of the work of many people who made the code better - Romain Geissler - Adrien Moiruad - Tomaz Ahlin - - Benjamin Cremer (bcremer) - Marcus Stöhr (dafish) - Emmanuel Vella (emmanuel.vella) - Carsten Nielsen (phreaknerd) @@ -1036,6 +1051,7 @@ Symfony is the result of the work of many people who made the code better - Damien Tournoud - Jon Gotlin (jongotlin) - Michael Dowling (mtdowling) + - Karlos Presumido (oneko) - BilgeXA - r1pp3rj4ck - Robert Queck @@ -1073,7 +1089,6 @@ Symfony is the result of the work of many people who made the code better - kor3k kor3k (kor3k) - Stelian Mocanita (stelian) - Flavian (2much) - - Arthur de Moulins (4rthem) - mike - Keith Maika - Mephistofeles @@ -1164,6 +1179,7 @@ Symfony is the result of the work of many people who made the code better - Julius Beckmann - Romain Dorgueil - Grayson Koonce (breerly) + - Fabien LUCAS (flucas2) - Karim Cassam Chenaï (ka) - Nicolas Bastien (nicolas_bastien) - Denis (yethee) @@ -1212,7 +1228,6 @@ Symfony is the result of the work of many people who made the code better - Bram Van der Sype (brammm) - Guile (guile) - Julien Moulin (lizjulien) - - Nikita Nefedov (nikita2206) - Mauro Foti (skler) - Yannick Warnier (ywarnier) - Kevin Decherf @@ -1235,7 +1250,9 @@ Symfony is the result of the work of many people who made the code better - Tischoi - J Bruni - Alexey Prilipko + - vlakoff - bertillon + - Bertalan Attila - Yannick Bensacq (cibou) - Luca Genuzio (genuzio) - Hans Nilsson (hansnilsson) @@ -1254,7 +1271,6 @@ Symfony is the result of the work of many people who made the code better - Joel Marcey - David Christmann - root - - Wouter J - James Hudson - Tom Maguire - David Zuelke @@ -1309,9 +1325,9 @@ Symfony is the result of the work of many people who made the code better - ddebree - Tomas Liubinas - Alex + - Patrick Dawkins - Klaas Naaijkens - Daniel González Cerviño - - ShinDarth - Rafał - Adria Lopez (adlpz) - Rosio (ben-rosio) @@ -1338,9 +1354,9 @@ Symfony is the result of the work of many people who made the code better - Michael Pohlers (mick_the_big) - Cayetano Soriano Gallego (neoshadybeat) - Ondrej Machulda (ondram) - - Patrick McDougle (patrick-mcdougle) - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) + - Marcin Szepczynski (szepczynski) - Cyrille Jouineau (tuxosaurus) - Yorkie Chadwick (yorkie76) - Yanick Witschi @@ -1363,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better - Arnaud Buathier (arnapou) - chesteroni (chesteroni) - Mauricio Lopez (diaspar) + - HADJEDJ Vincent (hadjedjvincent) - Daniele Cesarini (ijanki) - Ismail Asci (ismailasci) - Simon CONSTANS (kosssi) @@ -1505,7 +1522,6 @@ Symfony is the result of the work of many people who made the code better - Damián Nohales (eagleoneraptor) - Elliot Anderson (elliot) - Fabien D. (fabd) - - Fabien Bourigault (fbourigault) - Carsten Eilers (fnc) - Sorin Gitlan (forapathy) - Yohan Giarelli (frequence-web) @@ -1549,7 +1565,6 @@ Symfony is the result of the work of many people who made the code better - Daniel Perez Pinazo (pitiflautico) - Brayden Williams (redstar504) - Rich Sage (richsage) - - Ruud Kamphuis (ruudk) - Bart Ruysseveldt (ruyss) - Sascha Dens (saschadens) - scourgen hung (scourgen) From 69a553a2a3769db6d0095bf1230be0facb812da2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:12 -0800 Subject: [PATCH 06/98] updated VERSION for 2.7.23 --- 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 d4e79f35b6510..0e65c94231a8b 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.23-DEV'; + const VERSION = '2.7.23'; const VERSION_ID = 20723; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 23; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 6babdb3296a5fbbd9c69d1e3410adbdf749959ef Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:24:37 -0800 Subject: [PATCH 07/98] bumped Symfony version to 2.7.24 --- 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 0e65c94231a8b..cdb573837452a 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.23'; - const VERSION_ID = 20723; + const VERSION = '2.7.24-DEV'; + const VERSION_ID = 20724; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 23; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 24; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From dd2b920dda6db4c4c6c3eefa069bc8758343da6d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:27:19 -0800 Subject: [PATCH 08/98] updated CHANGELOG for 2.8.16 --- CHANGELOG-2.8.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 9fd4cd6412cf3..070264f0c3ea0 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,45 @@ 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.16 (2017-01-12) + + * bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik) + * bug #21104 [FrameworkBundle] fix IPv6 address handling in server commands (xabbuh) + * bug #20793 [Validator] Fix caching of constraints derived from non-serializable parents (uwej711) + * bug #19586 [TwigBundle] Fix bug where namespaced paths don't take parent bundles in account (wesleylancel) + * bug #21237 [FrameworkBundle] Fix relative paths used as cache keys (nicolas-grekas) + * bug #21183 [Validator] respect groups when merging constraints (xabbuh) + * bug #21179 [TwigBundle] Fixing regression in TwigEngine exception handling (Bertalan Attila) + * bug #21220 [DI] Fix missing new line after private alias (ogizanagi) + * bug #21211 Classloader tmpname (lyrixx) + * bug #21205 [TwigBundle] fixed usage when Templating is not installed (fabpot) + * bug #21155 [Validator] Check cascasdedGroups for being countable (scaytrase) + * bug #21200 [Filesystem] Check that directory is writable after created it in dumpFile() (chalasr) + * bug #21113 [FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure (chalasr) + * bug #21084 [Yaml] handle empty lines inside unindented collection (xabbuh) + * bug #20925 [HttpFoundation] Validate/cast cookie expire time (ro0NL) + * bug #21032 [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService (lyrixx) + * bug #21078 [Console] Escape default value when dumping help (lyrixx) + * bug #21076 [Console] OS X Can't call cli_set_process_title php without superuser (ogizanagi) + * bug #20900 [Console] Descriptors should use Helper::strlen (ogizanagi) + * bug #21064 [Debug] Wrap call to ->log in a try catch block (lyrixx) + * bug #21010 [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes (SpacePossum) + * bug #20859 Avoid warning in PHP 7.2 because of non-countable data (wouterj) + * bug #21053 [Validator] override property constraints in child class (xabbuh) + * bug #21034 [FrameworkBundle] Make TemplateController working without the Templating component (dunglas) + * bug #20970 [Console] Fix question formatting using SymfonyStyle::ask() (chalasr, ogizanagi) + * bug #20975 [Form] fix group sequence based validation (xabbuh) + * bug #20599 [WebProfilerBundle] Display multiple HTTP headers in WDT (ro0NL) + * bug #20799 [TwigBundle] do not try to register incomplete definitions (xabbuh) + * bug #20961 [Validator] phpize default option values (xabbuh) + * bug #20934 [FrameworkBundle] Fix PHP form templates on translatable attributes (ro0NL) + * bug #20957 [FrameworkBundle] test for the Validator component to be present (xabbuh) + * bug #20936 [DependencyInjection] Fix on-invalid attribute type in xsd (ogizanagi) + * bug #20931 [VarDumper] Fix dumping by-ref variadics (nicolas-grekas) + * bug #20734 [Security] AbstractVoter->supportsAttribute gives false positive if attribute is zero (0) (martynas-foodpanda) + * bug #14082 [config] Fix issue when key removed and left value only (zerustech) + * bug #20847 [Console] fixed BC issue with static closures (araines) + * 2.8.15 (2016-12-13) * bug #20714 [FrameworkBundle] Fix unresolved parameters from default configs in debug:config (chalasr) From 953c2192a28e1f4e9e8e3add8e68367184561b3b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:27:24 -0800 Subject: [PATCH 09/98] updated VERSION for 2.8.16 --- 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 922787aa3c8dd..acc77dc8c789b 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.16-DEV'; + const VERSION = '2.8.16'; const VERSION_ID = 20816; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 16; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From e18281eef637125786c199a4661c2f48d0c032fa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:42:17 -0800 Subject: [PATCH 10/98] bumped Symfony version to 2.8.17 --- 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 acc77dc8c789b..27439d33399e1 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.16'; - const VERSION_ID = 20816; + const VERSION = '2.8.17-DEV'; + const VERSION_ID = 20817; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 16; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 17; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 7e12e0ad308e8ab84138d06406ceb91174b6287a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:43:31 -0800 Subject: [PATCH 11/98] updated CHANGELOG for 3.1.9 --- CHANGELOG-3.1.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CHANGELOG-3.1.md b/CHANGELOG-3.1.md index fc198328e6002..36efff588f4d8 100644 --- a/CHANGELOG-3.1.md +++ b/CHANGELOG-3.1.md @@ -7,6 +7,52 @@ in 3.1 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.1.0...v3.1.1 +* 3.1.9 (2017-01-12) + + * bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik) + * bug #20605 [Ldap] Always have a valid connection when using the EntryManager (bobvandevijver) + * bug #21104 [FrameworkBundle] fix IPv6 address handling in server commands (xabbuh) + * bug #20793 [Validator] Fix caching of constraints derived from non-serializable parents (uwej711) + * bug #19586 [TwigBundle] Fix bug where namespaced paths don't take parent bundles in account (wesleylancel) + * bug #21237 [FrameworkBundle] Fix relative paths used as cache keys (nicolas-grekas) + * bug #21183 [Validator] respect groups when merging constraints (xabbuh) + * bug #21179 [TwigBundle] Fixing regression in TwigEngine exception handling (Bertalan Attila) + * bug #21220 [DI] Fix missing new line after private alias (ogizanagi) + * bug #21211 Classloader tmpname (lyrixx) + * bug #21205 [TwigBundle] fixed usage when Templating is not installed (fabpot) + * bug #21155 [Validator] Check cascasdedGroups for being countable (scaytrase) + * bug #21200 [Filesystem] Check that directory is writable after created it in dumpFile() (chalasr) + * bug #21165 [Serializer] int is valid when float is expected when deserializing JSON (dunglas) + * bug #21166 [Cache] Fix order of writes in ChainAdapter (nicolas-grekas) + * bug #21113 [FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure (chalasr) + * bug #21084 [Yaml] handle empty lines inside unindented collection (xabbuh) + * bug #20925 [HttpFoundation] Validate/cast cookie expire time (ro0NL) + * bug #21032 [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService (lyrixx) + * bug #21078 [Console] Escape default value when dumping help (lyrixx) + * bug #21076 [Console] OS X Can't call cli_set_process_title php without superuser (ogizanagi) + * bug #20900 [Console] Descriptors should use Helper::strlen (ogizanagi) + * bug #21025 [Cache] remove is_writable check on filesystem cache (4rthem) + * bug #21064 [Debug] Wrap call to ->log in a try catch block (lyrixx) + * bug #21010 [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes (SpacePossum) + * bug #20991 [cache] Bump RedisAdapter default timeout to 5s (Nicofuma) + * bug #20859 Avoid warning in PHP 7.2 because of non-countable data (wouterj) + * bug #21053 [Validator] override property constraints in child class (xabbuh) + * bug #21034 [FrameworkBundle] Make TemplateController working without the Templating component (dunglas) + * bug #20970 [Console] Fix question formatting using SymfonyStyle::ask() (chalasr, ogizanagi) + * bug #20999 [HttpKernel] Continuation of #20599 for 3.1 (ro0NL) + * bug #20975 [Form] fix group sequence based validation (xabbuh) + * bug #20599 [WebProfilerBundle] Display multiple HTTP headers in WDT (ro0NL) + * bug #20799 [TwigBundle] do not try to register incomplete definitions (xabbuh) + * bug #20961 [Validator] phpize default option values (xabbuh) + * bug #20934 [FrameworkBundle] Fix PHP form templates on translatable attributes (ro0NL) + * bug #20957 [FrameworkBundle] test for the Validator component to be present (xabbuh) + * bug #20936 [DependencyInjection] Fix on-invalid attribute type in xsd (ogizanagi) + * bug #20931 [VarDumper] Fix dumping by-ref variadics (nicolas-grekas) + * bug #20734 [Security] AbstractVoter->supportsAttribute gives false positive if attribute is zero (0) (martynas-foodpanda) + * bug #14082 [config] Fix issue when key removed and left value only (zerustech) + * bug #20910 [HttpFoundation] Fix cookie to string conversion for raw cookies (ro0NL) + * bug #20847 [Console] fixed BC issue with static closures (araines) + * 3.1.8 (2016-12-13) * bug #20714 [FrameworkBundle] Fix unresolved parameters from default configs in debug:config (chalasr) From bb172ebfc506938c3aec01f783e79a588d50fedb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:43:39 -0800 Subject: [PATCH 12/98] updated VERSION for 3.1.9 --- 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 19d952e0a1dcc..ff4537f788611 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 = '3.1.9-DEV'; + const VERSION = '3.1.9'; const VERSION_ID = 30109; const MAJOR_VERSION = 3; const MINOR_VERSION = 1; const RELEASE_VERSION = 9; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2017'; const END_OF_LIFE = '07/2017'; From d63160957d2729252efd8a9972aaa17df9d293a6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 13:34:53 -0800 Subject: [PATCH 13/98] bumped Symfony version to 3.1.10 --- 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 ff4537f788611..c2d329312e574 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 = '3.1.9'; - const VERSION_ID = 30109; + const VERSION = '3.1.10-DEV'; + const VERSION_ID = 30110; const MAJOR_VERSION = 3; const MINOR_VERSION = 1; - const RELEASE_VERSION = 9; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 10; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2017'; const END_OF_LIFE = '07/2017'; From 364ad971c28a3b341e17516ff9805e4651d214d0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 13:51:00 -0800 Subject: [PATCH 14/98] bumped Symfony version to 3.2.3 --- 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 0f8d13868d28e..d5362b29ff0ef 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 = '3.2.2'; - const VERSION_ID = 30202; + const VERSION = '3.2.3-DEV'; + const VERSION_ID = 30203; const MAJOR_VERSION = 3; const MINOR_VERSION = 2; - const RELEASE_VERSION = 2; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 3; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2017'; const END_OF_LIFE = '01/2018'; From 9e36436703b9b378e22b4e48eaf9b2e783a13f0b Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Thu, 12 Jan 2017 23:09:43 +0100 Subject: [PATCH 15/98] DX: remove invalid inheritdoc --- .../Component/Intl/Data/Generator/AbstractDataGenerator.php | 3 --- .../Component/Intl/Data/Generator/LocaleDataGenerator.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php index 84b7f74373992..6b7cf5a0caf1d 100644 --- a/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php @@ -42,9 +42,6 @@ public function __construct(GenrbCompiler $compiler, $dirName) $this->dirName = $dirName; } - /** - * {@inheritdoc} - */ public function generateData(GeneratorConfig $config) { $filesystem = new Filesystem(); diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index 5f4f95102fd85..e89e5e8757b67 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -57,9 +57,6 @@ public function __construct($dirName, LanguageDataProvider $languageDataProvider $this->regionDataProvider = $regionDataProvider; } - /** - * {@inheritdoc} - */ public function generateData(GeneratorConfig $config) { $filesystem = new Filesystem(); From 47feb18d31efdf54ec95954ec6fd5fb5d2cea24b Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Thu, 12 Jan 2017 23:27:26 +0100 Subject: [PATCH 16/98] CS: apply is_null --- src/Symfony/Bridge/Twig/Command/DebugCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 39b910d6b4f61..349a8b81b83c1 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -141,7 +141,7 @@ private function getMetadata($type, $entity) } if ($type === 'functions' || $type === 'filters') { $cb = $entity->getCallable(); - if (is_null($cb)) { + if (null === $cb) { return; } if (is_array($cb)) { From d68c4517118593c6f6b2deb8b6e926f87d18ee82 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 13 Jan 2017 10:44:13 +0100 Subject: [PATCH 17/98] [Cache] Using strpbrk() instead of strcspn() is faster --- src/Symfony/Component/Cache/CacheItem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index bdef410ca2675..d8ceb28ebdb74 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -101,7 +101,7 @@ public function expiresAfter($time) * * @param string $key The key to validate * - * @throws InvalidArgumentException When $key is not valid. + * @throws InvalidArgumentException When $key is not valid */ public static function validateKey($key) { @@ -111,7 +111,7 @@ public static function validateKey($key) if (!isset($key[0])) { throw new InvalidArgumentException('Cache key length must be greater than zero'); } - if (isset($key[strcspn($key, '{}()/\@:')])) { + if (false !== strpbrk($key, '{}()/\@:')) { throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); } } From cd08f7e20e98d1db7dd978ac9dd2aa518eb0d5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Parmentier?= Date: Fri, 13 Jan 2017 14:35:13 +0100 Subject: [PATCH 18/98] Add missing use statement in FilesystemAdapter --- src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php index 5fd1d31a45e66..1c62641cf6d67 100644 --- a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Cache\Adapter; +use Symfony\Component\Cache\Exception\CacheException; + /** * @author Nicolas Grekas */ From 5f7baa5a42e6447f56f3a8ffaab1cb488f2d09c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Fri, 13 Jan 2017 15:19:59 +0100 Subject: [PATCH 19/98] [DX][Cache] Set right type hint for cacheItem on AdapterInterface getters | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Fixes missing type hint for cache item on pool getters so methods on Symfony CacheItem is correclty suggested when using IDE's or api documentation. As proposed here: https://github.com/symfony/symfony/issues/19728#issuecomment-269615921 Note: Specifically sets array of items as return type of getItems as phpdoc and IDEs supports this by now, and since this is specifically what is being returned. --- .../Component/Cache/Adapter/AdapterInterface.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php index 85a0da80db079..529ad79ad48ea 100644 --- a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php +++ b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php @@ -21,4 +21,17 @@ */ interface AdapterInterface extends CacheItemPoolInterface { + /** + * {@inheritdoc} + * + * @return \Symfony\Component\Cache\CacheItem + */ + public function getItem($key); + + /** + * {@inheritdoc} + * + * return \Symfony\Component\Cache\CacheItem[] + */ + public function getItems(array $keys = []); } From 51bca66dfbe7a2903bb1505037370bc9098efcb2 Mon Sep 17 00:00:00 2001 From: Richard Bradley Date: Fri, 13 Jan 2017 16:26:16 +0000 Subject: [PATCH 20/98] #20411 fix Yaml parsing for very long quoted strings --- src/Symfony/Component/Yaml/Inline.php | 2 +- src/Symfony/Component/Yaml/Tests/InlineTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 624088fbba767..aa1833745a95b 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -21,7 +21,7 @@ */ class Inline { - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; private static $exceptionOnInvalidType = false; private static $objectSupport = false; diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 755dfce592df8..56966bacd333c 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -410,4 +410,14 @@ public function testNotSupportedMissingValue() { Inline::parse('{this, is not, supported}'); } + + public function testVeryLongQuotedStrings() + { + $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); + + $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes)); + $arrayFromYaml = Inline::parse($yamlString); + + $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']); + } } From cb1a4b778f522c7ae85bcc977cbaceaafc62d3f1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 14 Jan 2017 10:53:53 +0100 Subject: [PATCH 21/98] [TwigBundle] do not lose already set method calls --- .../Compiler/ExtensionPass.php | 2 +- .../Compiler/ExtensionPassTest.php | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index 36cea3d0fed1a..ab9479e46166a 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -91,7 +91,7 @@ public function process(ContainerBuilder $container) $twigLoader = $container->getDefinition('twig.loader.native_filesystem'); if ($container->has('templating')) { $loader = $container->getDefinition('twig.loader.filesystem'); - $loader->setMethodCalls($twigLoader->getMethodCalls()); + $loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls())); $twigLoader->clearTag('twig.loader'); } else { diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php new file mode 100644 index 0000000000000..587801d8db622 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler; + +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; + +class ExtensionPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcessDoesNotDropExistingFileLoaderMethodCalls() + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.debug', false); + + $container->register('twig.app_variable', '\Symfony\Bridge\Twig\AppVariable'); + $container->register('templating', '\Symfony\Bundle\TwigBundle\TwigEngine'); + + $nativeTwigLoader = new Definition('\Twig_Loader_Filesystem'); + $nativeTwigLoader->addMethodCall('addPath', array()); + $container->setDefinition('twig.loader.native_filesystem', $nativeTwigLoader); + + $filesystemLoader = new Definition('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader'); + $filesystemLoader->addMethodCall('addPath', array()); + $container->setDefinition('twig.loader.filesystem', $filesystemLoader); + + $extensionPass = new ExtensionPass(); + $extensionPass->process($container); + + $this->assertCount(2, $filesystemLoader->getMethodCalls()); + } +} From 5aadce39891a916112436dc779057c7b9dd75a97 Mon Sep 17 00:00:00 2001 From: David Maicher Date: Sat, 14 Jan 2017 12:51:35 +0100 Subject: [PATCH 22/98] [Doctrine Bridge] fix UniqueEntityValidator for composite object primary keys --- .../CompositeObjectNoToStringIdEntity.php | 53 +++++++++++++++++++ .../Constraints/UniqueEntityValidatorTest.php | 31 +++++++++++ .../Constraints/UniqueEntityValidator.php | 25 ++++++++- 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php new file mode 100644 index 0000000000000..ac97367094bd5 --- /dev/null +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php @@ -0,0 +1,53 @@ +objectOne = $objectOne; + $this->objectTwo = $objectTwo; + } + + /** + * @return SingleIntIdNoToStringEntity + */ + public function getObjectOne() + { + return $this->objectOne; + } + + /** + * @return SingleIntIdNoToStringEntity + */ + public function getObjectTwo() + { + return $this->objectTwo; + } +} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index f141410af83c6..5d903a12ebda2 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -17,6 +17,7 @@ use Doctrine\Common\Persistence\ObjectRepository; use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper; use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory; +use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity; @@ -140,6 +141,7 @@ private function createSchema(ObjectManager $em) $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2'), + $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity'), )); } @@ -561,4 +563,33 @@ public function testEntityManagerNullObject() $this->validator->validate($entity, $constraint); } + + public function testValidateUniquenessWithCompositeObjectNoToStringIdEntity() + { + $constraint = new UniqueEntity(array( + 'message' => 'myMessage', + 'fields' => array('objectOne', 'objectTwo'), + 'em' => self::EM_NAME, + )); + + $objectOne = new SingleIntIdNoToStringEntity(1, 'foo'); + $objectTwo = new SingleIntIdNoToStringEntity(2, 'bar'); + $entity = new CompositeObjectNoToStringIdEntity($objectOne, $objectTwo); + + $this->em->persist($entity); + $this->em->flush(); + + $newEntity = new CompositeObjectNoToStringIdEntity($objectOne, $objectTwo); + + $this->validator->validate($newEntity, $constraint); + + $expectedValue = 'Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity" identified by "(Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity" identified by "1"), (Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity" identified by "2")"'; + + $this->buildViolation('myMessage') + ->atPath('property.path.objectOne') + ->setParameter('{{ value }}', '"'.$expectedValue.'"') + ->setInvalidValue($expectedValue) + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) + ->assertRaised(); + } } diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index eb90b78af2f7d..68ea4a6709b2a 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -12,6 +12,8 @@ namespace Symfony\Bridge\Doctrine\Validator\Constraints; use Doctrine\Common\Persistence\ManagerRegistry; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; +use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; @@ -128,7 +130,7 @@ public function validate($entity, Constraint $constraint) $invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]]; if (is_object($invalidValue) && !method_exists($invalidValue, '__toString')) { - $invalidValue = sprintf('Object of class "%s" identified by "%s"', get_class($entity), implode(', ', $class->getIdentifierValues($entity))); + $invalidValue = $this->buildInvalidValueString($em, $class, $entity); } $this->context->buildViolation($constraint->message) @@ -138,4 +140,25 @@ public function validate($entity, Constraint $constraint) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->addViolation(); } + + /** + * @param ObjectManager $em + * @param ClassMetadata $class + * @param object $entity + * + * @return string + */ + private function buildInvalidValueString(ObjectManager $em, ClassMetadata $class, $entity) + { + $identifiers = array_map(function ($identifier) use ($em) { + // identifiers can be objects (without any __toString method) if its a composite PK + if (is_object($identifier) && !method_exists($identifier, '__toString')) { + return sprintf('(%s)', $this->buildInvalidValueString($em, $em->getClassMetadata(get_class($identifier)), $identifier)); + } + + return $identifier; + }, $class->getIdentifierValues($entity)); + + return sprintf('Object of class "%s" identified by "%s"', get_class($entity), implode(', ', $identifiers)); + } } From edd5431e6ed5f146f91a166fa5a6c61677e23347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 13 Jan 2017 15:53:55 +0100 Subject: [PATCH 23/98] [Workflow] Fixed support of multiple transition with the same name. The previous behavior was underterministic because it took the first transition during the `can` and the `apply` method. But the "first" does not mean anything. Now the workflow apply all possible transitions with the same name. --- .../Workflow/Tests/WorkflowBuilderTrait.php | 28 +++++ .../Component/Workflow/Tests/WorkflowTest.php | 107 ++++++++++++++-- src/Symfony/Component/Workflow/Workflow.php | 116 ++++++++---------- 3 files changed, 177 insertions(+), 74 deletions(-) diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php index 5e8db29061295..3084be5749b7f 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php @@ -49,6 +49,34 @@ private function createSimpleWorkflowDefinition() // +---+ +----+ +---+ +----+ +---+ } + private function createWorkflowWithSameNameTransition() + { + $places = range('a', 'c'); + + $transitions = array(); + $transitions[] = new Transition('a_to_bc', 'a', array('b', 'c')); + $transitions[] = new Transition('b_to_c', 'b', 'c'); + $transitions[] = new Transition('to_a', 'b', 'a'); + $transitions[] = new Transition('to_a', 'c', 'a'); + + return new Definition($places, $transitions); + + // The graph looks like: + // +------------------------------------------------------------+ + // | | + // | | + // | +----------------------------------------+ | + // v | v | + // +---+ +---------+ +---+ +--------+ +---+ +------+ + // | a | --> | a_to_bc | --> | b | --> | b_to_c | --> | c | --> | to_a | -+ + // +---+ +---------+ +---+ +--------+ +---+ +------+ | + // ^ | ^ | + // | +----------------------------------+ | + // | | + // | | + // +--------------------------------------------------------------------+ + } + private function createComplexStateMachineDefinition() { $places = array('a', 'b', 'c', 'd'); diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index cb5256f412933..1766e66fe3fb1 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -48,7 +48,7 @@ public function testGetMarkingWithEmptyDefinition() public function testGetMarkingWithImpossiblePlace() { $subject = new \stdClass(); - $subject->marking = array('nope' => true); + $subject->marking = array('nope' => 1); $workflow = new Workflow(new Definition(array(), array()), new MultipleStateMarkingStore()); $workflow->getMarking($subject); @@ -83,10 +83,6 @@ public function testGetMarkingWithExistingMarking() $this->assertTrue($marking->has('c')); } - /** - * @expectedException \Symfony\Component\Workflow\Exception\LogicException - * @expectedExceptionMessage Transition "foobar" does not exist for workflow "unnamed". - */ public function testCanWithUnexistingTransition() { $definition = $this->createComplexWorkflowDefinition(); @@ -94,7 +90,7 @@ public function testCanWithUnexistingTransition() $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); - $workflow->can($subject, 'foobar'); + $this->assertFalse($workflow->can($subject, 'foobar')); } public function testCan() @@ -136,6 +132,23 @@ public function testApplyWithImpossibleTransition() $workflow->apply($subject, 't2'); } + public function testCanWithSameNameTransition() + { + $definition = $this->createWorkflowWithSameNameTransition(); + $workflow = new Workflow($definition, new MultipleStateMarkingStore()); + + $subject = new \stdClass(); + $subject->marking = null; + $this->assertTrue($workflow->can($subject, 'a_to_bc')); + $this->assertFalse($workflow->can($subject, 'b_to_c')); + $this->assertFalse($workflow->can($subject, 'to_a')); + + $subject->marking = array('b' => 1); + $this->assertFalse($workflow->can($subject, 'a_to_bc')); + $this->assertTrue($workflow->can($subject, 'b_to_c')); + $this->assertTrue($workflow->can($subject, 'to_a')); + } + public function testApply() { $definition = $this->createComplexWorkflowDefinition(); @@ -151,6 +164,59 @@ public function testApply() $this->assertTrue($marking->has('c')); } + public function testApplyWithSameNameTransition() + { + $subject = new \stdClass(); + $subject->marking = null; + $definition = $this->createWorkflowWithSameNameTransition(); + $workflow = new Workflow($definition, new MultipleStateMarkingStore()); + + $marking = $workflow->apply($subject, 'a_to_bc'); + + $this->assertFalse($marking->has('a')); + $this->assertTrue($marking->has('b')); + $this->assertTrue($marking->has('c')); + + $marking = $workflow->apply($subject, 'to_a'); + + $this->assertTrue($marking->has('a')); + $this->assertFalse($marking->has('b')); + $this->assertFalse($marking->has('c')); + + $marking = $workflow->apply($subject, 'a_to_bc'); + $marking = $workflow->apply($subject, 'b_to_c'); + + $this->assertFalse($marking->has('a')); + $this->assertFalse($marking->has('b')); + $this->assertTrue($marking->has('c')); + + $marking = $workflow->apply($subject, 'to_a'); + + $this->assertTrue($marking->has('a')); + $this->assertFalse($marking->has('b')); + $this->assertFalse($marking->has('c')); + } + + public function testApplyWithSameNameTransition2() + { + $subject = new \stdClass(); + $subject->marking = array('a' => 1, 'b' => 1); + + $places = range('a', 'd'); + $transitions = array(); + $transitions[] = new Transition('t', 'a', 'c'); + $transitions[] = new Transition('t', 'b', 'd'); + $definition = new Definition($places, $transitions); + $workflow = new Workflow($definition, new MultipleStateMarkingStore()); + + $marking = $workflow->apply($subject, 't'); + + $this->assertFalse($marking->has('a')); + $this->assertFalse($marking->has('b')); + $this->assertTrue($marking->has('c')); + $this->assertTrue($marking->has('d')); + } + public function testApplyWithEventDispatcher() { $definition = $this->createComplexWorkflowDefinition(); @@ -198,17 +264,36 @@ public function testGetEnabledTransitions() $this->assertEmpty($workflow->getEnabledTransitions($subject)); - $subject->marking = array('d' => true); + $subject->marking = array('d' => 1); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(2, $transitions); $this->assertSame('t3', $transitions[0]->getName()); $this->assertSame('t4', $transitions[1]->getName()); - $subject->marking = array('c' => true, 'e' => true); + $subject->marking = array('c' => 1, 'e' => 1); $transitions = $workflow->getEnabledTransitions($subject); $this->assertCount(1, $transitions); $this->assertSame('t5', $transitions[0]->getName()); } + + public function testGetEnabledTransitionsWithSameNameTransition() + { + $definition = $this->createWorkflowWithSameNameTransition(); + $subject = new \stdClass(); + $subject->marking = null; + $workflow = new Workflow($definition, new MultipleStateMarkingStore()); + + $transitions = $workflow->getEnabledTransitions($subject); + $this->assertCount(1, $transitions); + $this->assertSame('a_to_bc', $transitions[0]->getName()); + + $subject->marking = array('b' => 1, 'c' => 1); + $transitions = $workflow->getEnabledTransitions($subject); + $this->assertCount(3, $transitions); + $this->assertSame('b_to_c', $transitions[0]->getName()); + $this->assertSame('to_a', $transitions[1]->getName()); + $this->assertSame('to_a', $transitions[2]->getName()); + } } class EventDispatcherMock implements \Symfony\Component\EventDispatcher\EventDispatcherInterface @@ -223,21 +308,27 @@ public function dispatch($eventName, \Symfony\Component\EventDispatcher\Event $e public function addListener($eventName, $listener, $priority = 0) { } + public function addSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) { } + public function removeListener($eventName, $listener) { } + public function removeSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) { } + public function getListeners($eventName = null) { } + public function getListenerPriority($eventName, $listener) { } + public function hasListeners($eventName = null) { } diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php index b66cc85f51d90..8fc64e979d3b8 100644 --- a/src/Symfony/Component/Workflow/Workflow.php +++ b/src/Symfony/Component/Workflow/Workflow.php @@ -89,15 +89,18 @@ public function getMarking($subject) * @param string $transitionName A transition * * @return bool true if the transition is enabled - * - * @throws LogicException If the transition does not exist */ public function can($subject, $transitionName) { - $transitions = $this->getTransitions($transitionName); - $marking = $this->getMarking($subject); + $transitions = $this->getEnabledTransitions($subject, $this->getMarking($subject)); + + foreach ($transitions as $transition) { + if ($transitionName === $transition->getName()) { + return true; + } + } - return null !== $this->getTransitionForSubject($subject, $marking, $transitions); + return false; } /** @@ -113,22 +116,36 @@ public function can($subject, $transitionName) */ public function apply($subject, $transitionName) { - $transitions = $this->getTransitions($transitionName); - $marking = $this->getMarking($subject); + $transitions = $this->getEnabledTransitions($subject, $this->getMarking($subject)); - if (null === $transition = $this->getTransitionForSubject($subject, $marking, $transitions)) { - throw new LogicException(sprintf('Unable to apply transition "%s" for workflow "%s".', $transitionName, $this->name)); - } + // We can shortcut the getMarking method in order to boost performance, + // since the "getEnabledTransitions" method already checks the Marking + // state + $marking = $this->markingStore->getMarking($subject); - $this->leave($subject, $transition, $marking); + $applied = false; - $this->transition($subject, $transition, $marking); + foreach ($transitions as $transition) { + if ($transitionName !== $transition->getName()) { + continue; + } - $this->enter($subject, $transition, $marking); + $applied = true; - $this->markingStore->setMarking($subject, $marking); + $this->leave($subject, $transition, $marking); - $this->announce($subject, $transition, $marking); + $this->transition($subject, $transition, $marking); + + $this->enter($subject, $transition, $marking); + + $this->markingStore->setMarking($subject, $marking); + + $this->announce($subject, $transition, $marking); + } + + if (!$applied) { + throw new LogicException(sprintf('Unable to apply transition "%s" for workflow "%s".', $transitionName, $this->name)); + } return $marking; } @@ -146,7 +163,7 @@ public function getEnabledTransitions($subject) $marking = $this->getMarking($subject); foreach ($this->definition->getTransitions() as $transition) { - if (null !== $this->getTransitionForSubject($subject, $marking, array($transition))) { + if ($this->doCan($subject, $marking, $transition)) { $enabled[] = $transition; } } @@ -167,6 +184,21 @@ public function getDefinition() return $this->definition; } + private function doCan($subject, Marking $marking, Transition $transition) + { + foreach ($transition->getFroms() as $place) { + if (!$marking->has($place)) { + return false; + } + } + + if (true === $this->guardTransition($subject, $marking, $transition)) { + return false; + } + + return true; + } + /** * @param object $subject * @param Marking $marking @@ -246,56 +278,8 @@ private function announce($subject, Transition $initialTransition, Marking $mark $event = new Event($subject, $marking, $initialTransition); - foreach ($this->definition->getTransitions() as $transition) { - if (null !== $this->getTransitionForSubject($subject, $marking, array($transition))) { - $this->dispatcher->dispatch(sprintf('workflow.%s.announce.%s', $this->name, $transition->getName()), $event); - } - } - } - - /** - * @param $transitionName - * - * @return Transition[] - */ - private function getTransitions($transitionName) - { - $transitions = $this->definition->getTransitions(); - - $transitions = array_filter($transitions, function (Transition $transition) use ($transitionName) { - return $transitionName === $transition->getName(); - }); - - if (!$transitions) { - throw new LogicException(sprintf('Transition "%s" does not exist for workflow "%s".', $transitionName, $this->name)); - } - - return $transitions; - } - - /** - * Return the first Transition in $transitions that is valid for the - * $subject and $marking. null is returned when you cannot do any Transition - * in $transitions on the $subject. - * - * @param object $subject - * @param Marking $marking - * @param Transition[] $transitions - * - * @return Transition|null - */ - private function getTransitionForSubject($subject, Marking $marking, array $transitions) - { - foreach ($transitions as $transition) { - foreach ($transition->getFroms() as $place) { - if (!$marking->has($place)) { - continue 2; - } - } - - if (true !== $this->guardTransition($subject, $marking, $transition)) { - return $transition; - } + foreach ($this->getEnabledTransitions($subject) as $transition) { + $this->dispatcher->dispatch(sprintf('workflow.%s.announce.%s', $this->name, $transition->getName()), $event); } } } From b3ced8608b8229c1ec54181819d869d47ca92a7d Mon Sep 17 00:00:00 2001 From: HeahDude Date: Sat, 14 Jan 2017 19:07:55 +0100 Subject: [PATCH 24/98] [DoctrineBridge] Fixed invalid unique value as composite key Fixed UniqueEntityValidator tests --- .../Constraints/UniqueEntityValidatorTest.php | 23 ++++++---- .../Constraints/UniqueEntityValidator.php | 45 ++++++++++--------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 5d903a12ebda2..efd9c54374181 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -175,7 +175,7 @@ public function testValidateUniqueness() $this->buildViolation('myMessage') ->atPath('property.path.name') ->setParameter('{{ value }}', '"Foo"') - ->setInvalidValue('Foo') + ->setInvalidValue($entity2) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -200,7 +200,7 @@ public function testValidateCustomErrorPath() $this->buildViolation('myMessage') ->atPath('property.path.bar') ->setParameter('{{ value }}', '"Foo"') - ->setInvalidValue('Foo') + ->setInvalidValue($entity2) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -419,7 +419,7 @@ public function testAssociatedEntity() $this->buildViolation('myMessage') ->atPath('property.path.single') - ->setParameter('{{ value }}', $entity1) + ->setParameter('{{ value }}', 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity") identified by (id => 1)') ->setInvalidValue($entity1) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); @@ -452,12 +452,12 @@ public function testValidateUniquenessNotToStringEntityWithAssociatedEntity() $this->validator->validate($associated2, $constraint); - $expectedValue = 'Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2" identified by "2"'; + $expectedValue = 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity") identified by (id => 1)'; $this->buildViolation('myMessage') ->atPath('property.path.single') - ->setParameter('{{ value }}', '"'.$expectedValue.'"') - ->setInvalidValue($expectedValue) + ->setParameter('{{ value }}', $expectedValue) + ->setInvalidValue($entity1) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -574,6 +574,11 @@ public function testValidateUniquenessWithCompositeObjectNoToStringIdEntity() $objectOne = new SingleIntIdNoToStringEntity(1, 'foo'); $objectTwo = new SingleIntIdNoToStringEntity(2, 'bar'); + + $this->em->persist($objectOne); + $this->em->persist($objectTwo); + $this->em->flush(); + $entity = new CompositeObjectNoToStringIdEntity($objectOne, $objectTwo); $this->em->persist($entity); @@ -583,12 +588,12 @@ public function testValidateUniquenessWithCompositeObjectNoToStringIdEntity() $this->validator->validate($newEntity, $constraint); - $expectedValue = 'Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity" identified by "(Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity" identified by "1"), (Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity" identified by "2")"'; + $expectedValue = 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity") identified by (id => 1)'; $this->buildViolation('myMessage') ->atPath('property.path.objectOne') - ->setParameter('{{ value }}', '"'.$expectedValue.'"') - ->setInvalidValue($expectedValue) + ->setParameter('{{ value }}', $expectedValue) + ->setInvalidValue($objectOne) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 68ea4a6709b2a..16b74b98c3dc0 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -129,36 +129,41 @@ public function validate($entity, Constraint $constraint) $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]]; - if (is_object($invalidValue) && !method_exists($invalidValue, '__toString')) { - $invalidValue = $this->buildInvalidValueString($em, $class, $entity); - } - $this->context->buildViolation($constraint->message) ->atPath($errorPath) - ->setParameter('{{ value }}', $this->formatValue($invalidValue, static::OBJECT_TO_STRING | static::PRETTY_DATE)) + ->setParameter('{{ value }}', $this->formatWithIdentifiers($em, $class, $invalidValue)) ->setInvalidValue($invalidValue) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->addViolation(); } - /** - * @param ObjectManager $em - * @param ClassMetadata $class - * @param object $entity - * - * @return string - */ - private function buildInvalidValueString(ObjectManager $em, ClassMetadata $class, $entity) + private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, $value) { - $identifiers = array_map(function ($identifier) use ($em) { - // identifiers can be objects (without any __toString method) if its a composite PK - if (is_object($identifier) && !method_exists($identifier, '__toString')) { - return sprintf('(%s)', $this->buildInvalidValueString($em, $em->getClassMetadata(get_class($identifier)), $identifier)); + if (!is_object($value) || $value instanceof \DateTimeInterface) { + return $this->formatValue($value, self::PRETTY_DATE); + } + + // non unique value is a composite PK + if ($class->getName() !== $idClass = get_class($value)) { + $identifiers = $em->getClassMetadata($idClass)->getIdentifierValues($value); + } else { + $identifiers = $class->getIdentifierValues($value); + } + + if (!$identifiers) { + return sprintf('object("%s")', $idClass); + } + + array_walk($identifiers, function (&$id, $field) { + if (!is_object($id) || $id instanceof \DateTimeInterface) { + $idAsString = $this->formatValue($id, self::PRETTY_DATE); + } else { + $idAsString = sprintf('object("%s")', get_class($id)); } - return $identifier; - }, $class->getIdentifierValues($entity)); + $id = sprintf('%s => %s', $field, $idAsString); + }); - return sprintf('Object of class "%s" identified by "%s"', get_class($entity), implode(', ', $identifiers)); + return sprintf('object("%s") identified by (%s)', $idClass, implode(', ', $identifiers)); } } From 6628e76e624612d8027d10c25b319f0a30227049 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 16 Jan 2017 14:31:45 +0100 Subject: [PATCH 25/98] simple-phpunit requires the zip extension --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 3 +++ src/Symfony/Bridge/PhpUnit/composer.json | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 49a610ed14a6e..331ff8a02c686 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -43,6 +43,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ @unlink("$PHPUNIT_VERSION.zip"); passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip"); } + if (!class_exists('ZipArchive')) { + throw new \Exception('simple-phpunit requires the "zip" PHP extension to be installed and enabled in order to uncompress the downloaded PHPUnit packages.'); + } $zip = new ZipArchive(); $zip->open("$PHPUNIT_VERSION.zip"); $zip->extractTo(getcwd()); diff --git a/src/Symfony/Bridge/PhpUnit/composer.json b/src/Symfony/Bridge/PhpUnit/composer.json index 1cf3ef04318e5..2d6a866742042 100644 --- a/src/Symfony/Bridge/PhpUnit/composer.json +++ b/src/Symfony/Bridge/PhpUnit/composer.json @@ -21,7 +21,8 @@ "php": ">=5.3.3" }, "suggest": { - "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader", + "ext-zip": "Zip support is required when using bin/simple-phpunit" }, "autoload": { "files": [ "bootstrap.php" ], From 60a0c4bf91f912b6ac17351d158091adb0c0a7a6 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 16 Jan 2017 16:44:34 +0100 Subject: [PATCH 26/98] [Serializer] Add missing conflict for property-info<3.1 --- src/Symfony/Component/Serializer/composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 01fc76bab53e0..6c2137829e019 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -30,7 +30,8 @@ "phpdocumentor/reflection-docblock": "~3.0" }, "conflict": { - "symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4" + "symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4", + "symfony/property-info": "<3.1" }, "suggest": { "psr/cache-implementation": "For using the metadata cache.", From a6527f895b7f40b66ebab2ef08f9bd76d325b512 Mon Sep 17 00:00:00 2001 From: skalpa Date: Mon, 16 Jan 2017 17:23:42 +0000 Subject: [PATCH 27/98] [Debug] Fix fatal error when changing ErrorHandler loggers if an exception is buffered --- src/Symfony/Component/Debug/ErrorHandler.php | 2 +- .../Debug/Tests/ErrorHandlerTest.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index f03a93d6826db..f5c842d2cc0ce 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -225,7 +225,7 @@ public function setLoggers(array $loggers) if ($flush) { foreach ($this->bootstrappingLogger->cleanLogs() as $log) { - $type = $log[2]['exception']->getSeverity(); + $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : E_ERROR; if (!isset($flush[$type])) { $this->bootstrappingLogger->log($log[0], $log[1], $log[2]); } elseif ($this->loggers[$type][0]) { diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index bc568fa3fa23b..3a5da7f4e26cf 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -417,6 +417,25 @@ public function testBootstrappingLogger() $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING))); } + public function testSettingLoggerWhenExceptionIsBuffered() + { + $bootLogger = new BufferingLogger(); + $handler = new ErrorHandler($bootLogger); + + $exception = new \Exception('Foo message'); + + $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $mockLogger->expects($this->once()) + ->method('log') + ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', array('exception' => $exception)); + + $handler->setExceptionHandler(function () use ($handler, $mockLogger) { + $handler->setDefaultLogger($mockLogger); + }); + + $handler->handleException($exception); + } + public function testHandleFatalError() { try { From 6fecc94103cb362a7fee522fec1b6c698ef3ca0b Mon Sep 17 00:00:00 2001 From: Arjen van der Meijden Date: Tue, 17 Jan 2017 09:49:30 +0100 Subject: [PATCH 28/98] Don't add csp-headers if none are required --- .../Csp/ContentSecurityPolicyHandler.php | 3 ++- .../Csp/ContentSecurityPolicyHandlerTest.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php b/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php index 195f3f18ff25d..52168924d3303 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php @@ -135,7 +135,8 @@ private function updateCspHeaders(Response $response, array $nonces = array()) if (isset($headers[$header]['default-src'])) { $headers[$header][$type] = $headers[$header]['default-src']; } else { - $headers[$header][$type] = array(); + // If there is no script-src/style-src and no default-src, no additional rules required. + continue; } } $ruleIsSet = true; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php index a471e3a5cd5b7..2a78b581bf6a5 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php @@ -118,6 +118,13 @@ public function provideRequestAndResponsesForOnKernelResponse() $this->createResponse($responseNonceHeaders), array('Content-Security-Policy' => null, 'X-Content-Security-Policy' => null), ), + array( + $nonce, + array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), + $this->createRequest(), + $this->createResponse(array('Content-Security-Policy' => 'frame-ancestors https: ; form-action: https:')), + array('Content-Security-Policy' => 'frame-ancestors https: ; form-action: https:', 'X-Content-Security-Policy' => null), + ), array( $nonce, array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), @@ -130,7 +137,7 @@ public function provideRequestAndResponsesForOnKernelResponse() array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), $this->createRequest(), $this->createResponse(array('Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'')), - array('Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'; style-src \'unsafe-inline\' \'nonce-'.$nonce.'\'', 'X-Content-Security-Policy' => null), + array('Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'', 'X-Content-Security-Policy' => null), ), array( $nonce, @@ -144,21 +151,21 @@ public function provideRequestAndResponsesForOnKernelResponse() array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), $this->createRequest(), $this->createResponse(array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'')), - array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'; style-src \'unsafe-inline\' \'nonce-'.$nonce.'\'', 'Content-Security-Policy' => null), + array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\'', 'Content-Security-Policy' => null), ), array( $nonce, array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), $this->createRequest(), $this->createResponse(array('X-Content-Security-Policy' => 'script-src \'self\'')), - array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\' \'nonce-'.$nonce.'\'; style-src \'unsafe-inline\' \'nonce-'.$nonce.'\'', 'Content-Security-Policy' => null), + array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\' \'nonce-'.$nonce.'\'', 'Content-Security-Policy' => null), ), array( $nonce, array('csp_script_nonce' => $nonce, 'csp_style_nonce' => $nonce), $this->createRequest(), $this->createResponse(array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\' \'sha384-LALALALALAAL\'')), - array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\' \'sha384-LALALALALAAL\' \'nonce-'.$nonce.'\'; style-src \'unsafe-inline\' \'nonce-'.$nonce.'\'', 'Content-Security-Policy' => null), + array('X-Content-Security-Policy' => 'script-src \'self\' \'unsafe-inline\' \'sha384-LALALALALAAL\' \'nonce-'.$nonce.'\'', 'Content-Security-Policy' => null), ), array( $nonce, From 677d8208747282e484be8dfc299ca962565addc2 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 30 Dec 2016 12:55:25 +0000 Subject: [PATCH 29/98] Fix the condition checking the minimum ICU version --- src/Symfony/Component/Intl/Util/IntlTestHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index 71fb4acdd72fa..c1e37a72ec8a4 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -41,7 +41,7 @@ public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minim // * the intl extension is loaded with version Intl::getIcuStubVersion() // * the intl extension is not loaded - if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) { + if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '<', 1)) { $testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.'); } From d3b5d8efdf4b936006d52bc6f6d266af1691708e Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 30 Dec 2016 13:41:01 +0000 Subject: [PATCH 30/98] Fix tests with ICU 57.1 --- ...ntegerToLocalizedStringTransformerTest.php | 4 ++-- ...NumberToLocalizedStringTransformerTest.php | 8 +++---- .../Extension/Core/Type/DateTypeTest.php | 24 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php index b38296813c574..af6443ac84054 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php @@ -108,10 +108,10 @@ public function testReverseTransformEmpty() public function testReverseTransformWithGrouping() { - // Since we test against "de_AT", we need the full implementation + // Since we test against "de_DE", we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $transformer = new IntegerToLocalizedStringTransformer(null, true); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index 90d9719a90b72..c619ca729fdf2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -54,8 +54,8 @@ public function testTransform($from, $to, $locale) public function provideTransformationsWithGrouping() { return array( - array(1234.5, '1.234,5', 'de_AT'), - array(12345.912, '12.345,912', 'de_AT'), + array(1234.5, '1.234,5', 'de_DE'), + array(12345.912, '12.345,912', 'de_DE'), array(1234.5, '1 234,5', 'fr'), array(1234.5, '1 234,5', 'ru'), array(1234.5, '1 234,5', 'fi'), @@ -410,10 +410,10 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot() */ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep() { - // Since we test against "de_AT", we need the full implementation + // Since we test against "de_DE", we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $transformer = new NumberToLocalizedStringTransformer(null, true); 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 ea302d020eec3..2b1c9bc198583 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -69,10 +69,10 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() public function testSubmitFromSingleTextDateTime() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -90,10 +90,10 @@ public function testSubmitFromSingleTextDateTime() public function testSubmitFromSingleTextString() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -111,10 +111,10 @@ public function testSubmitFromSingleTextString() public function testSubmitFromSingleTextTimestamp() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -134,10 +134,10 @@ public function testSubmitFromSingleTextTimestamp() public function testSubmitFromSingleTextRaw() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -398,10 +398,10 @@ public function testThrowExceptionIfDaysIsInvalid() public function testSetDataWithNegativeTimezoneOffsetStringInput() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -420,10 +420,10 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput() public function testSetDataWithNegativeTimezoneOffsetDateTimeInput() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, From 6641b79d582bece75e46235f414a9b1c8cb4fb57 Mon Sep 17 00:00:00 2001 From: Quentin de Longraye Date: Thu, 17 Nov 2016 22:08:11 +0100 Subject: [PATCH 31/98] [Ldap] load users with the good username case --- .../Core/Tests/User/LdapUserProviderTest.php | 47 +++++++++++++++++-- .../Security/Core/User/LdapUserProvider.php | 4 +- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php index a1ef0bbf19e8e..85d7985b8f6f9 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php @@ -119,7 +119,7 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -165,7 +165,7 @@ public function testLoadUserByUsernameFailsIfEntryHasNoPasswordAttribute() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -207,7 +207,7 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttribute() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -238,7 +238,7 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttribute() ); } - public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() + public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWrongCase() { $result = $this->getMockBuilder(CollectionInterface::class)->getMock(); $query = $this->getMockBuilder(QueryInterface::class)->getMock(); @@ -249,7 +249,46 @@ public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result + ->expects($this->exactly(2)) + ->method('offsetGet') + ->with(0) + ->will($this->returnValue(new Entry('foo', array( + 'sAMAccountName' => array('foo'), + ) + ))) + ; + $result + ->expects($this->once()) + ->method('count') + ->will($this->returnValue(1)) + ; + $ldap + ->expects($this->once()) + ->method('escape') + ->will($this->returnValue('Foo')) + ; + $ldap + ->expects($this->once()) + ->method('query') + ->will($this->returnValue($query)) + ; + + $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com'); + $this->assertSame('foo', $provider->loadUserByUsername('Foo')->getUsername()); + } + + public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() + { + $result = $this->getMock(CollectionInterface::class); + $query = $this->getMock(QueryInterface::class); + $query ->expects($this->once()) + ->method('execute') + ->will($this->returnValue($result)) + ; + $ldap = $this->getMock(LdapInterface::class); + $result + ->expects($this->exactly(2)) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index fc42419a6d1ab..ad9ad2b429e2b 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -31,6 +31,7 @@ class LdapUserProvider implements UserProviderInterface private $searchDn; private $searchPassword; private $defaultRoles; + private $uidKey; private $defaultSearch; private $passwordAttribute; @@ -51,6 +52,7 @@ public function __construct(LdapInterface $ldap, $baseDn, $searchDn = null, $sea $this->searchDn = $searchDn; $this->searchPassword = $searchPassword; $this->defaultRoles = $defaultRoles; + $this->uidKey = $uidKey; $this->defaultSearch = str_replace('{uid_key}', $uidKey, $filter); $this->passwordAttribute = $passwordAttribute; } @@ -80,7 +82,7 @@ public function loadUserByUsername($username) throw new UsernameNotFoundException('More than one user found'); } - return $this->loadUser($username, $entries[0]); + return $this->loadUser($entries[0]->getAttribute($this->uidKey)[0], $entries[0]); } /** From c91689ba2d395b9af5e5d7b07c4f22742bca3f01 Mon Sep 17 00:00:00 2001 From: Quentin de Longraye Date: Sat, 14 Jan 2017 15:53:00 +0100 Subject: [PATCH 32/98] [Ldap] Using Ldap stored username instead of form submitted one --- .../Core/Tests/User/LdapUserProviderTest.php | 52 +++++++++++++++++-- .../Security/Core/User/LdapUserProvider.php | 31 ++++++----- 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php index 85d7985b8f6f9..d39f8ad5740d7 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php @@ -119,7 +119,7 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -151,6 +151,48 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() ); } + /** + * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException + */ + public function testLoadUserByUsernameFailsIfEntryHasNoUidKeyAttribute() + { + $result = $this->getMock(CollectionInterface::class); + $query = $this->getMock(QueryInterface::class); + $query + ->expects($this->once()) + ->method('execute') + ->will($this->returnValue($result)) + ; + $ldap = $this->getMock(LdapInterface::class); + $result + ->expects($this->once()) + ->method('offsetGet') + ->with(0) + ->will($this->returnValue(new Entry('foo', array()))) + ; + $result + ->expects($this->once()) + ->method('count') + ->will($this->returnValue(1)) + ; + $ldap + ->expects($this->once()) + ->method('escape') + ->will($this->returnValue('foo')) + ; + $ldap + ->expects($this->once()) + ->method('query') + ->will($this->returnValue($query)) + ; + + $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, array(), 'sAMAccountName', '({uid_key}={username})'); + $this->assertInstanceOf( + 'Symfony\Component\Security\Core\User\User', + $provider->loadUserByUsername('foo') + ); + } + /** * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException */ @@ -165,7 +207,7 @@ public function testLoadUserByUsernameFailsIfEntryHasNoPasswordAttribute() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -207,7 +249,7 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttribute() ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -249,7 +291,7 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWro ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( @@ -288,7 +330,7 @@ public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() ; $ldap = $this->getMock(LdapInterface::class); $result - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('offsetGet') ->with(0) ->will($this->returnValue(new Entry('foo', array( diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index ad9ad2b429e2b..1edf3f764ef04 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -47,6 +47,10 @@ class LdapUserProvider implements UserProviderInterface */ public function __construct(LdapInterface $ldap, $baseDn, $searchDn = null, $searchPassword = null, array $defaultRoles = array(), $uidKey = 'sAMAccountName', $filter = '({uid_key}={username})', $passwordAttribute = null) { + if (null === $uidKey) { + $uidKey = 'uid'; + } + $this->ldap = $ldap; $this->baseDn = $baseDn; $this->searchDn = $searchDn; @@ -82,7 +86,10 @@ public function loadUserByUsername($username) throw new UsernameNotFoundException('More than one user found'); } - return $this->loadUser($entries[0]->getAttribute($this->uidKey)[0], $entries[0]); + $entry = $entries[0]; + $username = $this->getAttributeValue($entry, $this->uidKey); + + return $this->loadUser($username, $entry); } /** @@ -115,30 +122,30 @@ public function supportsClass($class) */ protected function loadUser($username, Entry $entry) { - $password = $this->getPassword($entry); + $password = null; + if (null !== $this->passwordAttribute) { + $password = $this->getAttributeValue($entry, $this->passwordAttribute); + } return new User($username, $password, $this->defaultRoles); } /** - * Fetches the password from an LDAP entry. + * Fetches a required unique attribute value from an LDAP entry. * * @param null|Entry $entry + * @param string $attribute */ - private function getPassword(Entry $entry) + private function getAttributeValue(Entry $entry, $attribute) { - if (null === $this->passwordAttribute) { - return; - } - - if (!$entry->hasAttribute($this->passwordAttribute)) { - throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $this->passwordAttribute, $entry->getDn())); + if (!$entry->hasAttribute($attribute)) { + throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $attribute, $entry->getDn())); } - $values = $entry->getAttribute($this->passwordAttribute); + $values = $entry->getAttribute($attribute); if (1 !== count($values)) { - throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $this->passwordAttribute)); + throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $attribute)); } return $values[0]; From ce29ab1d9269c3f28bff069f06b04ba7b49d1b3c Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Tue, 17 Jan 2017 19:38:11 +0100 Subject: [PATCH 33/98] [FrameworkBundle] Fix third level headers for MarkdownDescriptor --- .../Console/Descriptor/MarkdownDescriptor.php | 4 ++-- .../Tests/Fixtures/Descriptor/builder_1_public.md | 9 +++------ .../Tests/Fixtures/Descriptor/builder_1_services.md | 12 ++++-------- .../Tests/Fixtures/Descriptor/builder_1_tag1.md | 3 +-- .../Tests/Fixtures/Descriptor/builder_1_tags.md | 6 ++---- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 8f1227e7e997a..2cefe9f03a2ac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -233,7 +233,7 @@ protected function describeContainerDefinition(Definition $definition, array $op } } - $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); + $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output); } /** @@ -244,7 +244,7 @@ protected function describeContainerAlias(Alias $alias, array $options = array() $output = '- Service: `'.$alias.'`' ."\n".'- Public: '.($alias->isPublic() ? 'yes' : 'no'); - $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); + $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md index 1c3b958bd92ca..96fe55184014a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md @@ -4,8 +4,7 @@ Public services Definitions ----------- -definition_1 -~~~~~~~~~~~~ +### definition_1 - Class: `Full\Qualified\Class1` - Scope: `container` @@ -21,14 +20,12 @@ definition_1 Aliases ------- -alias_1 -~~~~~~~ +### alias_1 - Service: `service_1` - Public: yes -alias_2 -~~~~~~~ +### alias_2 - Service: `service_2` - Public: no diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md index b3018b80b7f3b..12938a6e0e123 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md @@ -4,8 +4,7 @@ Public and private services Definitions ----------- -definition_1 -~~~~~~~~~~~~ +### definition_1 - Class: `Full\Qualified\Class1` - Scope: `container` @@ -17,8 +16,7 @@ definition_1 - Factory Class: `Full\Qualified\FactoryClass` - Factory Method: `get` -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` @@ -41,14 +39,12 @@ definition_2 Aliases ------- -alias_1 -~~~~~~~ +### alias_1 - Service: `service_1` - Public: yes -alias_2 -~~~~~~~ +### alias_2 - Service: `service_2` - Public: no diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md index 56a2c390779aa..0b90618a476a2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md @@ -4,8 +4,7 @@ Public and private services with tag `tag1` Definitions ----------- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md index 6577037f9c00f..1a3ed9ca85302 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md @@ -4,8 +4,7 @@ Container tags tag1 ---- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` @@ -22,8 +21,7 @@ definition_2 tag2 ---- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` From 08c6a650b9f933ba2524b383126583d4d2fc4340 Mon Sep 17 00:00:00 2001 From: Arjan Keeman Date: Tue, 17 Jan 2017 18:02:52 +0100 Subject: [PATCH 34/98] [Cache] [PdoAdapter] Fix MySQL 1170 error (blob as primary key) --- src/Symfony/Component/Cache/Adapter/PdoAdapter.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index 24245fcf27d10..3fa3a40533d9e 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -108,9 +108,20 @@ public function createTable() $conn = $this->getConnection(); if ($conn instanceof Connection) { + $types = array( + 'mysql' => 'binary', + 'sqlite' => 'text', + 'pgsql' => 'string', + 'oci' => 'string', + 'sqlsrv' => 'string', + ); + if (!isset($types[$this->driver])) { + throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); + } + $schema = new Schema(); $table = $schema->createTable($this->table); - $table->addColumn($this->idCol, 'blob', array('length' => 255)); + $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')); From eece8adfddfc4eeb3926673a59f61c341abe4b13 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 13 Jan 2017 12:42:53 +0100 Subject: [PATCH 35/98] [Workflow] Added new validator to make sure each place has unique translation names --- .../Tests/Validator/WorkflowValidatorTest.php | 34 +++++++++++++++++++ .../Workflow/Validator/WorkflowValidator.php | 11 ++++++ 2 files changed, 45 insertions(+) diff --git a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php index 30d2551fa1b0f..e75ebaf82e233 100644 --- a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php +++ b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php @@ -2,7 +2,9 @@ namespace Symfony\Component\Workflow\Tests\Validator; +use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait; +use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Validator\WorkflowValidator; class WorkflowValidatorTest extends \PHPUnit_Framework_TestCase @@ -26,4 +28,36 @@ public function testSinglePlaceWorkflowValidatorAndSimpleWorkflow() (new WorkflowValidator(true))->validate($definition, 'foo'); } + + /** + * @expectedException \Symfony\Component\Workflow\Exception\InvalidDefinitionException + * @expectedExceptionMessage All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo". + */ + public function testWorkflowWithInvalidNames() + { + $places = range('a', 'c'); + + $transitions = array(); + $transitions[] = new Transition('t0', 'c', 'b'); + $transitions[] = new Transition('t1', 'a', 'b'); + $transitions[] = new Transition('t1', 'a', 'c'); + + $definition = new Definition($places, $transitions); + + (new WorkflowValidator())->validate($definition, 'foo'); + } + + public function testSameTransitionNameButNotSamePlace() + { + $places = range('a', 'd'); + + $transitions = array(); + $transitions[] = new Transition('t1', 'a', 'b'); + $transitions[] = new Transition('t1', 'b', 'c'); + $transitions[] = new Transition('t1', 'd', 'c'); + + $definition = new Definition($places, $transitions); + + (new WorkflowValidator())->validate($definition, 'foo'); + } } diff --git a/src/Symfony/Component/Workflow/Validator/WorkflowValidator.php b/src/Symfony/Component/Workflow/Validator/WorkflowValidator.php index cd31e1fb3e58b..27bd06f0d651b 100644 --- a/src/Symfony/Component/Workflow/Validator/WorkflowValidator.php +++ b/src/Symfony/Component/Workflow/Validator/WorkflowValidator.php @@ -31,6 +31,17 @@ public function __construct($singlePlace = false) public function validate(Definition $definition, $name) { + // Make sure all transitions for one place has unique name. + $places = array_fill_keys($definition->getPlaces(), array()); + foreach ($definition->getTransitions() as $transition) { + foreach ($transition->getFroms() as $from) { + if (in_array($transition->getName(), $places[$from])) { + throw new InvalidDefinitionException(sprintf('All transitions for a place must have an unique name. Multiple transitions named "%s" where found for place "%s" in workflow "%s".', $transition->getName(), $from, $name)); + } + $places[$from][] = $transition->getName(); + } + } + if (!$this->singlePlace) { return; } From 190c736d3c5eb5a039cb5fb35729ef07fc26fa5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 18 Jan 2017 13:05:57 +0100 Subject: [PATCH 36/98] [PropertyInfo] Exclude static methods form properties guessing --- .../Component/PropertyInfo/Extractor/ReflectionExtractor.php | 4 ++++ src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 7fefbde2536a1..86be3b3e1503b 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -68,6 +68,10 @@ public function getProperties($class, array $context = array()) } foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { + if ($reflectionMethod->isStatic()) { + continue; + } + $propertyName = $this->getPropertyName($reflectionMethod->name); if (!$propertyName || isset($properties[$propertyName])) { continue; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 41a513ac362e1..660cc3002a238 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -51,6 +51,10 @@ class Dummy extends ParentDummy */ public $B; + public static function getStatic() + { + } + /** * A. * From 3b4858fe88814d820327bba46a00859a983d089e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 18 Jan 2017 13:18:58 +0100 Subject: [PATCH 37/98] [PropertyInfo] Don't try to access a property thru a static method --- .../PropertyInfo/Extractor/PhpDocExtractor.php | 3 +++ .../PropertyInfo/Extractor/ReflectionExtractor.php | 6 ++++++ .../Tests/Extractors/PhpDocExtractorTest.php | 2 ++ .../Tests/Extractors/ReflectionExtractorTest.php | 2 ++ .../Component/PropertyInfo/Tests/Fixtures/Dummy.php | 11 +++++++++++ 5 files changed, 24 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index e60a623985d05..73e8ad3748977 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -253,6 +253,9 @@ private function getDocBlockFromMethod($class, $ucFirstProperty, $type) try { $reflectionMethod = new \ReflectionMethod($class, $methodName); + if ($reflectionMethod->isStatic()) { + continue; + } if ( (self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) || diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 7fefbde2536a1..c228134b913b9 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -258,6 +258,9 @@ private function getAccessorMethod($class, $property) foreach (self::$accessorPrefixes as $prefix) { try { $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); + if ($reflectionMethod->isStatic()) { + continue; + } if (0 === $reflectionMethod->getNumberOfRequiredParameters()) { return array($reflectionMethod, $prefix); @@ -286,6 +289,9 @@ private function getMutatorMethod($class, $property) foreach (self::$mutatorPrefixes as $prefix) { try { $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); + if ($reflectionMethod->isStatic()) { + continue; + } // Parameter can be optional to allow things like: method(array $foo = null) if ($reflectionMethod->getNumberOfParameters() >= 1) { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php index 332d1c4f8c318..b223888ede1dc 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php @@ -68,6 +68,8 @@ public function typesProvider() array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null), array('donotexist', null, null, null), + array('staticGetter', null, null, null), + array('staticSetter', null, null, null), ); } } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index 8a828c21d66be..713d9431b42a4 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -72,6 +72,8 @@ public function typesProvider() array('e', null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime')))), array('donotexist', null), + array('staticGetter', null), + array('staticSetter', null), ); } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 41a513ac362e1..f8e986fe044f3 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -51,6 +51,17 @@ class Dummy extends ParentDummy */ public $B; + /** + * @return string + */ + public static function staticGetter() + { + } + + public static function staticSetter(\DateTime $d) + { + } + /** * A. * From 3f693aeb86cc5bcc310c0807f7a53f4a47f5a895 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 18 Jan 2017 16:07:29 +0100 Subject: [PATCH 38/98] [PhpUnit] Blacklist DeprecationErrorHandler in stack traces --- src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php index 3ebe6e0839ba3..843522a0fc822 100644 --- a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php +++ b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php @@ -34,6 +34,7 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener */ public function __construct(array $mockedNamespaces = array()) { + \PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\DeprecationErrorHandler'] = 1; \PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\SymfonyTestsListener'] = 1; $warn = false; From c0022f29d61753f46731764f042076950e520846 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 18 Jan 2017 16:06:43 +0100 Subject: [PATCH 39/98] [Cache] Fix tags expiration --- .../Cache/Adapter/TagAwareAdapter.php | 42 ++++++++++++------- .../Tests/Adapter/TagAwareAdapterTest.php | 17 ++++++++ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 802c30fa92d9e..b8c4a08021b70 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -26,6 +26,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface private $deferred = array(); private $createCacheItem; private $getTagsByKey; + private $invalidateTags; private $tagsAdapter; public function __construct(AdapterInterface $itemsAdapter, AdapterInterface $tagsAdapter = null) @@ -33,17 +34,15 @@ public function __construct(AdapterInterface $itemsAdapter, AdapterInterface $ta $this->itemsAdapter = $itemsAdapter; $this->tagsAdapter = $tagsAdapter ?: $itemsAdapter; $this->createCacheItem = \Closure::bind( - function ($key, $value = null, CacheItem $protoItem = null) { + function ($key, $value, CacheItem $protoItem) { $item = new CacheItem(); $item->key = $key; $item->value = $value; $item->isHit = false; - - if (null !== $protoItem) { - $item->defaultLifetime = $protoItem->defaultLifetime; - $item->innerItem = $protoItem->innerItem; - $item->poolHash = $protoItem->poolHash; - } + $item->defaultLifetime = $protoItem->defaultLifetime; + $item->expiry = $protoItem->expiry; + $item->innerItem = $protoItem->innerItem; + $item->poolHash = $protoItem->poolHash; return $item; }, @@ -62,6 +61,20 @@ function ($deferred) { null, CacheItem::class ); + $this->invalidateTags = \Closure::bind( + function (AdapterInterface $tagsAdapter, array $tags) { + foreach ($tagsAdapter->getItems($tags) as $v) { + $v->set(1 + (int) $v->get()); + $v->defaultLifetime = 0; + $v->expiry = null; + $tagsAdapter->saveDeferred($v); + } + + return $tagsAdapter->commit(); + }, + null, + CacheItem::class + ); } /** @@ -74,13 +87,9 @@ public function invalidateTags(array $tags) $tags[$k] = $tag.static::TAGS_PREFIX; } } + $f = $this->invalidateTags; - foreach ($this->tagsAdapter->getItems($tags) as $v) { - $v->set(1 + (int) $v->get()); - $this->tagsAdapter->saveDeferred($v); - } - - return $this->tagsAdapter->commit(); + return $f($this->tagsAdapter, $tags); } /** @@ -211,7 +220,8 @@ public function commit() $ok = true; if ($this->deferred) { - foreach ($this->deferred as $key => $item) { + $items = $this->deferred; + foreach ($items as $key => $item) { if (!$this->itemsAdapter->saveDeferred($item)) { unset($this->deferred[$key]); $ok = false; @@ -219,14 +229,14 @@ public function commit() } $f = $this->getTagsByKey; - $tagsByKey = $f($this->deferred); + $tagsByKey = $f($items); $deletedTags = $this->deferred = array(); $tagVersions = $this->getTagVersions($tagsByKey); $f = $this->createCacheItem; foreach ($tagsByKey as $key => $tags) { if ($tags) { - $this->itemsAdapter->saveDeferred($f(static::TAGS_PREFIX.$key, array_intersect_key($tagVersions, $tags))); + $this->itemsAdapter->saveDeferred($f(static::TAGS_PREFIX.$key, array_intersect_key($tagVersions, $tags), $items[$key])); } else { $deletedTags[] = static::TAGS_PREFIX.$key; } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index 20b1fd7a07fe2..24586c0ca9aae 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -97,4 +97,21 @@ public function testTagsAreCleanedOnDelete() $this->assertTrue($pool->getItem('k')->isHit()); } + + public function testTagItemExpiry() + { + $pool = $this->createCachePool(10); + + $item = $pool->getItem('foo'); + $item->tag(array('baz')); + $item->expiresAfter(100); + + $pool->save($item); + $pool->invalidateTags(array('baz')); + $this->assertFalse($pool->getItem('foo')->isHit()); + + sleep(20); + + $this->assertFalse($pool->getItem('foo')->isHit()); + } } From 9edb457e44f234c4fee26ddd97ee5d7c7bb94bfc Mon Sep 17 00:00:00 2001 From: Arjan Keeman Date: Sun, 11 Dec 2016 19:52:52 +0100 Subject: [PATCH 40/98] [HttpKernel] Give higher priority to adding request formats --- .../HttpKernel/EventListener/AddRequestFormatsListener.php | 2 +- .../Tests/EventListener/AddRequestFormatsListenerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php index 14a5d435115d7..280844c18313e 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php @@ -52,6 +52,6 @@ public function onKernelRequest(GetResponseEvent $event) */ public static function getSubscribedEvents() { - return array(KernelEvents::REQUEST => 'onKernelRequest'); + return array(KernelEvents::REQUEST => array('onKernelRequest', 1)); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php index 0f3577cbdb14b..c5b2c51e40ecb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -45,7 +45,7 @@ public function testIsAnEventSubscriber() public function testRegisteredEvent() { $this->assertEquals( - array(KernelEvents::REQUEST => 'onKernelRequest'), + array(KernelEvents::REQUEST => array('onKernelRequest', 1)), AddRequestFormatsListener::getSubscribedEvents() ); } From c82aa84c26f47fc1f18bd318e0728bdc682618be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 14:34:44 +0100 Subject: [PATCH 41/98] [DependencyInjection] minor: Fix a DocBlock --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 52cc53946b16d..9d2072dfbeeab 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -130,9 +130,9 @@ private function parseDefinitions($content, $file) /** * Parses a definition. * - * @param string $id - * @param array $service - * @param string $file + * @param string $id + * @param array|string $service + * @param string $file * * @throws InvalidArgumentException When tags are invalid */ From 34330e51368f328e1ab91521d9fbdfb5a73be26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 14:51:14 +0100 Subject: [PATCH 42/98] [DependencyInjection] Add some missing typehints in YamlFileLoader --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 52cc53946b16d..61f921813b549 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -85,7 +85,7 @@ public function supports($resource, $type = null) * @param array $content * @param string $file */ - private function parseImports($content, $file) + private function parseImports(array $content, $file) { if (!isset($content['imports'])) { return; @@ -112,7 +112,7 @@ private function parseImports($content, $file) * @param array $content * @param string $file */ - private function parseDefinitions($content, $file) + private function parseDefinitions(array $content, $file) { if (!isset($content['services'])) { return; @@ -420,7 +420,7 @@ private function resolveServices($value) * * @param array $content */ - private function loadFromExtensions($content) + private function loadFromExtensions(array $content) { foreach ($content as $namespace => $values) { if (in_array($namespace, array('imports', 'parameters', 'services'))) { From d3fa8a1859b85490356b4c559b900a5256341331 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 19 Jan 2017 10:44:03 +0100 Subject: [PATCH 43/98] Avoid setting request attributes from signature arguments in AnnotationClassLoader --- .../Component/Routing/Loader/AnnotationClassLoader.php | 5 ----- .../Routing/Tests/Loader/AnnotationClassLoaderTest.php | 7 +++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index f175d341e7564..339529e5190e7 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -138,11 +138,6 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl } $defaults = array_replace($globals['defaults'], $annot->getDefaults()); - foreach ($method->getParameters() as $param) { - if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { - $defaults[$param->getName()] = $param->getDefaultValue(); - } - } $requirements = array_replace($globals['requirements'], $annot->getRequirements()); $options = array_replace($globals['options'], $annot->getOptions()); $schemes = array_merge($globals['schemes'], $annot->getSchemes()); diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index 83bf7108fb28b..44229633b5cbc 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -136,11 +136,10 @@ public function testLoad($className, $routeData = array(), $methodArgs = array() array_intersect_assoc($routeData['options'], $route->getOptions()), '->load preserves options annotation' ); - $defaults = array_replace($methodArgs, $routeData['defaults']); $this->assertCount( - count($defaults), - array_intersect_assoc($defaults, $route->getDefaults()), - '->load preserves defaults annotation and merges them with default arguments in method signature' + count($routeData['defaults']), + $route->getDefaults(), + '->load preserves defaults annotation' ); $this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation'); $this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation'); From 5176f978bfe992f40f743273da5a4271c5aa42b8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 20 Jan 2017 07:16:44 -0800 Subject: [PATCH 44/98] fixed CS --- .php_cs.dist | 2 +- .../Bridge/PhpUnit/DeprecationErrorHandler.php | 4 ++-- .../Tests/LazyProxy/Fixtures/php/lazy_service.php | 9 --------- .../Fixtures/php/lazy_service_with_hints.php | 13 ++----------- .../Twig/Tests/Extension/DumpExtensionTest.php | 2 +- .../DependencyInjection/MainConfiguration.php | 4 ++-- .../Tests/Fixtures/Namespaced/WithStrictTypes.php | 2 +- .../ClassNotFoundFatalErrorHandler.php | 2 +- src/Symfony/Component/DomCrawler/Crawler.php | 2 +- .../Component/Process/Tests/SignalListener.php | 2 +- .../Component/VarDumper/Dumper/AbstractDumper.php | 4 ++-- 11 files changed, 14 insertions(+), 32 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index bbb62c2d3cdce..e2e173ad0545e 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -12,7 +12,7 @@ return PhpCsFixer\Config::create() ->setRiskyAllowed(true) ->setFinder( PhpCsFixer\Finder::create() - ->in(__DIR__) + ->in(__DIR__.'/src') ->exclude(array( // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code 'src/Symfony/Component/DependencyInjection/Tests/Fixtures', diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 575eaa2e213b2..04abda4b9fa59 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -109,7 +109,7 @@ public static function register($mode = false) return "\x1B[{$color}m{$str}\x1B[0m"; }; } else { - $colorize = function ($str) {return $str;}; + $colorize = function ($str) { return $str; }; } register_shutdown_function(function () use ($getMode, &$deprecations, $deprecationHandler, $colorize) { $mode = $getMode(); @@ -117,7 +117,7 @@ public static function register($mode = false) restore_error_handler(); if ('weak' === $mode) { - $colorize = function ($str) {return $str;}; + $colorize = function ($str) { return $str; }; } if ($currErrorHandler !== $deprecationHandler) { echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n"; diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php index fd58c19d818db..8971f655f4e3a 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php @@ -125,9 +125,6 @@ public function __unset($name) unset($this->valueHolder5157dd96e88c0->$name); } - /** - * - */ public function __clone() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); @@ -135,9 +132,6 @@ public function __clone() $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; } - /** - * - */ public function __sleep() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); @@ -145,9 +139,6 @@ public function __sleep() return array('valueHolder5157dd96e88c0'); } - /** - * - */ public function __wakeup() { } diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php index f57c4c6360ba3..06432127750fd 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php @@ -120,9 +120,6 @@ public function __unset($name) unset($this->valueHolder5157dd96e88c0->$name); } - /** - * - */ public function __clone() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); @@ -130,9 +127,6 @@ public function __clone() $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; } - /** - * - */ public function __sleep() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); @@ -140,9 +134,6 @@ public function __sleep() return array('valueHolder5157dd96e88c0'); } - /** - * - */ public function __wakeup() { } @@ -166,7 +157,7 @@ public function getProxyInitializer() /** * {@inheritdoc} */ - public function initializeProxy() : bool + public function initializeProxy(): bool { return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array()); } @@ -174,7 +165,7 @@ public function initializeProxy() : bool /** * {@inheritdoc} */ - public function isProxyInitialized() : bool + public function isProxyInitialized(): bool { return null !== $this->valueHolder5157dd96e88c0; } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php index 0800ba8ea2608..604b0caaecc8b 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php @@ -32,7 +32,7 @@ public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped) $dumped = null; $exception = null; - $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;}); + $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) { $dumped = $var; }); try { $this->assertEquals($expectedOutput, $twig->render('template')); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index a3e5e233f9d71..df6380224cd20 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -390,11 +390,11 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode) $providerNodeBuilder ->validate() - ->ifTrue(function ($v) {return count($v) > 1;}) + ->ifTrue(function ($v) { return count($v) > 1; }) ->thenInvalid('You cannot set multiple provider types for the same provider') ->end() ->validate() - ->ifTrue(function ($v) {return count($v) === 0;}) + ->ifTrue(function ($v) { return count($v) === 0; }) ->thenInvalid('You must set a provider definition for the provider.') ->end() ; diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php index 3c7870592b3cb..846611e38bbc4 100644 --- a/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php @@ -4,7 +4,7 @@ * foo */ -declare (strict_types = 1); +declare(strict_types=1); namespace Namespaced; diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index abfe90d79262a..612bfcaf7f966 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -179,7 +179,7 @@ private function convertFileToClass($path, $file, $prefix) ); if ($prefix) { - $candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);}); + $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); } // We cannot use the autoloader here as most of them use require; but if the class diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index ea2051614f192..ed9b0b02398f5 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -156,7 +156,7 @@ public function addHtmlContent($content, $charset = 'UTF-8') $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; - set_error_handler(function () {throw new \Exception();}); + set_error_handler(function () { throw new \Exception(); }); try { // Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML() diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index 03536577c40f2..9e30ce3bbbbc6 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -pcntl_signal(SIGUSR1, function () {echo 'SIGUSR1'; exit;}); +pcntl_signal(SIGUSR1, function () { echo 'SIGUSR1'; exit; }); echo 'Caught '; diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 22c60b6e51c72..bed08bf47e0ab 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -90,7 +90,7 @@ public function setCharset($charset) } $this->charsetConverter = 'fallback'; $supported = true; - set_error_handler(function () use (&$supported) {$supported = false;}); + set_error_handler(function () use (&$supported) { $supported = false; }); if (function_exists('mb_encoding_aliases') && mb_encoding_aliases($charset)) { $this->charset = $charset; @@ -193,7 +193,7 @@ protected function utf8Encode($s) } if ('iconv' === $this->charsetConverter) { $valid = true; - set_error_handler(function () use (&$valid) {$valid = false;}); + set_error_handler(function () use (&$valid) { $valid = false; }); $c = iconv($this->charset, 'UTF-8', $s); restore_error_handler(); if ($valid) { From afbf22746a257418de2a65bf2e84db81b32b7ba7 Mon Sep 17 00:00:00 2001 From: Peter Breuls Date: Wed, 18 Jan 2017 19:17:11 +0100 Subject: [PATCH 45/98] [Validator] Improved error message for missing upload_tmp_dir --- .../Validator/Resources/translations/validators.en.xlf | 2 +- .../Validator/Resources/translations/validators.nl.xlf | 2 +- .../Validator/Resources/translations/validators.pl.xlf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index e666c793c98b4..2883213ee33e0 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - No temporary folder was configured in php.ini. + No temporary folder was configured in php.ini, or the configured folder does not exist. Cannot write temporary file to disk. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index 8cc972cc5f529..e138975667d5e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Er is geen tijdelijke map geconfigureerd in php.ini. + Er is geen tijdelijke map geconfigureerd in php.ini, of de gespecificeerde map bestaat niet. Cannot write temporary file to disk. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 87bb76b8b00d4..affbc38e813e9 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Nie skonfigurowano folderu tymczasowego w php.ini. + Nie skonfigurowano folderu tymczasowego w php.ini, lub skonfigurowany folder nie istnieje. Cannot write temporary file to disk. From 6830d9f4c904d74020d2619fae990670edb3c3de Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:33:48 -0800 Subject: [PATCH 46/98] fixed typo --- .../DeprecationErrorHandler/default.phpt | 6 +- .../Tests/DeprecationErrorHandler/weak.phpt | 2 +- .../Extension/TranslationExtensionTest.php | 12 ++-- .../Resources/views/Form/attributes.html.php | 2 +- .../views/Form/button_widget.html.php | 6 +- .../views/Form/choice_options.html.php | 2 +- .../views/Form/choice_widget_options.html.php | 2 +- .../views/Form/container_attributes.html.php | 2 +- .../views/Form/email_widget.html.php | 2 +- .../Resources/views/Form/form_label.html.php | 18 +++-- .../Resources/views/Form/form_start.html.php | 4 +- .../Resources/views/Form/hidden_row.html.php | 2 +- .../views/Form/hidden_widget.html.php | 2 +- .../views/Form/integer_widget.html.php | 2 +- .../views/Form/money_widget.html.php | 2 +- .../views/Form/number_widget.html.php | 2 +- .../views/Form/password_widget.html.php | 2 +- .../views/Form/repeated_row.html.php | 2 +- .../views/Form/reset_widget.html.php | 2 +- .../views/Form/search_widget.html.php | 2 +- .../views/Form/submit_widget.html.php | 2 +- .../Resources/views/Form/url_widget.html.php | 2 +- .../Custom/_name_c_entry_label.html.php | 4 +- .../Debug/Resources/ext/tests/001.phpt | 4 +- .../Debug/Resources/ext/tests/002.phpt | 4 +- .../Debug/Resources/ext/tests/002_1.phpt | 4 +- .../Debug/Resources/ext/tests/003.phpt | 4 +- .../Debug/Tests/DebugClassLoaderTest.php | 2 +- .../Compiler/CheckCircularReferencesPass.php | 1 - .../DependencyInjection/Container.php | 4 +- .../DependencyInjection/Definition.php | 2 +- .../Tests/Fixtures/containers/container14.php | 2 +- .../Tests/Fixtures/php/services1-1.php | 1 + .../Tests/Fixtures/php/services8.php | 2 +- .../Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 4 +- .../DataCollector/DumpDataCollector.php | 2 +- .../Component/Process/Pipes/AbstractPipes.php | 2 +- .../Component/Process/Pipes/WindowsPipes.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 68 +++++++----------- .../Tests/Fixtures/dumper/url_matcher2.php | 72 +++++++------------ .../Tests/Fixtures/dumper/url_matcher3.php | 5 +- .../Tests/Fixtures/templates/foo.php | 2 +- .../Translation/Tests/fixtures/resources.php | 2 +- .../Component/VarDumper/Dumper/CliDumper.php | 4 +- src/Symfony/Component/Yaml/Escaper.php | 4 +- 46 files changed, 134 insertions(+), 149 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index fac5c53ae7486..49a14479475a0 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -31,14 +31,14 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } public function testNonLegacyBar() { @trigger_error('silenced bar deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt index 9e78d96e70efb..d697843280f4b 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt @@ -23,7 +23,7 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index e96bd4f9a3bef..e066d537352c4 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -87,17 +87,17 @@ public function getTransTests() // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), + 'There is no apples', array('count' => 0), ), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5)), + 'There is 5 apples', array('count' => 5), ), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'), ), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5)), + 'There is 5 apples (Symfony)', array('count' => 5), ), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), + 'There is no apples', array('count' => 0), ), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples'), + 'There is 5 apples', ), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php index eb421be817691..28474797a5538 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php @@ -1 +1 @@ -block($form, 'widget_attributes') ?> +block($form, 'widget_attributes'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php index 9dac32fc994c0..32d8eeb619141 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php @@ -1,4 +1,6 @@ - $name, '%id%' => $id)) - : $view['form']->humanize($name); } ?> + : $view['form']->humanize($name); +} ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php index 211ae73f1c3d1..2463438d5aad5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php @@ -1 +1 @@ -block($form, 'choice_widget_options') ?> +block($form, 'choice_widget_options'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php index f1c6ad3b56f21..fc9846375f851 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php @@ -1,6 +1,6 @@ +$translatorHelper = $view['translator']; // outside of the loop for performance reasons!?> $choice): ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php index 302bbfcd479d9..fb6c0f2b5ed8b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php @@ -1 +1 @@ -block($form, 'widget_container_attributes') ?> +block($form, 'widget_container_attributes'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php index 0b30c5bb7ae54..7dfd085d86a6a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php index 7a51b2ce7b4ff..1b10546d979f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php @@ -1,8 +1,16 @@ - - - + + $name, '%id%' => $id)) - : $view['form']->humanize($name); } ?> - + : $view['form']->humanize($name); +} ?> + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php index e7b23d394daec..c81836eeb7e30 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php @@ -1,6 +1,8 @@ -
$v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?> enctype="multipart/form-data"> + $v) { + printf(' %s="%s"', $view->escape($k), $view->escape($v)); +} ?> enctype="multipart/form-data"> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php index 3239d8f415b12..800a8facf87f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php @@ -1 +1 @@ -widget($form) ?> +widget($form); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php index a43f7de475e7a..8763fa6d4b79a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php index 5fceb49a38953..9efb26a18ffa0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php index 644d284915371..ea12cd4a4881a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple'), $money_pattern) ?> +block($form, 'form_widget_simple'), $money_pattern); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php index bf4a4c478502b..6f2d12e19d22e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php index ec96cfb46b24c..decefacf91800 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php index d4af23d712320..04cc29bcca3e0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php @@ -1 +1 @@ -block($form, 'form_rows') ?> +block($form, 'form_rows'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php index e8fa18e488df8..0f66b4b6aecf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?> +block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php index 48a33f4aa2dbc..73ff6908d78b8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php index 6bf71f5a1e1c9..027bdc9857369 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?> +block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php index 9e26318497b3c..80329fff87d85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php index 05240035c023d..80a9c5f611a36 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php @@ -1,2 +1,4 @@ -humanize($name); } ?> +humanize($name); +} ?> diff --git a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt index 15e183a70615c..873e2569ec5a3 100644 --- a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- getId(); if (empty($this->checkedNodes[$id])) { - // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index f6c953f550993..2421b82a7ea3a 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -219,7 +219,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) */ public function has($id) { - for ($i = 2;;) { + for ($i = 2; ;) { if ('service_container' === $id || isset($this->aliases[$id]) || isset($this->services[$id]) @@ -258,7 +258,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE // available services. Service IDs are case insensitive, however since // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. - for ($i = 2;;) { + for ($i = 2; ;) { if ('service_container' === $id) { return $this; } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 72fba5acc7ce6..4f2ee304adad2 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that decorates this service. + * Gets the service that this service is decorating. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php index 56ea6c1ed23d4..191afb8cddc1f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; -/** +/* * This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer * and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped. */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index f15771172ef19..0fede650233e5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -1,4 +1,5 @@ array( 0 => true, 1 => false, - 2 => NULL, + 2 => null, 3 => 0, 4 => 1000.3, 5 => 'true', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index ce8930b8ddeba..c173b83906785 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -248,7 +248,7 @@ protected function getMethodCall1Service() if ($this->has('foobaz')) { $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 559560fa6da60..8991bd006e4f3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -253,8 +253,8 @@ protected function getMethodCall1Service() $this->services['method_call1'] = $instance = new \Bar\FooClass(); $instance->setBar($this->get('foo')); - $instance->setBar(NULL); - $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + $instance->setBar(null); + $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); return $instance; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 538d73c783ba3..3f20c4343981f 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line; }, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 1a94755bd71c1..951bbcba7e071 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -109,7 +109,7 @@ protected function write() } if ($input) { - for (;;) { + for (; ;) { $data = fread($input, self::CHUNK_SIZE); if (!isset($data[0])) { break; diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 87a781ea9204a..7712cd453d662 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -55,7 +55,7 @@ public function __construct($disableOutput, $input) $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); - for ($i = 0;; ++$i) { + for ($i = 0; ; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); if (file_exists($file) && !unlink($file)) { 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 4ea0b8a1a3e7c..4b243286bcc6f 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); } not_bar: @@ -51,10 +51,9 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); } not_barhead: - } if (0 === strpos($pathinfo, '/test')) { @@ -73,12 +72,11 @@ public function match($pathinfo) if ($pathinfo === '/test/baz3/') { return array('_route' => 'baz3'); } - } // baz4 if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); } // baz5 @@ -88,7 +86,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); } not_baz5: @@ -99,20 +97,19 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); } not_bazbaz6: - } // foofoo if ($pathinfo === '/foofoo') { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array('def' => 'test', '_route' => 'foofoo'); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); } // space @@ -124,40 +121,37 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); } - } - } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); } // overridden2 @@ -169,17 +163,16 @@ public function match($pathinfo) if ($pathinfo === '/multi/hey/') { return array('_route' => 'hey'); } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -190,9 +183,8 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); } - } $host = $this->context->getHost(); @@ -207,7 +199,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } - } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -215,7 +206,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } - } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -223,7 +213,6 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -231,7 +220,6 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } - } // route6 @@ -243,47 +231,43 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); } - } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); } - } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } - } if (0 === strpos($pathinfo, '/a')) { @@ -295,16 +279,14 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); } - } - } throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); 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 f9d3fa2d8257b..81e7e727395d5 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); } not_bar: @@ -51,10 +51,9 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); } not_barhead: - } if (0 === strpos($pathinfo, '/test')) { @@ -77,7 +76,6 @@ public function match($pathinfo) return array('_route' => 'baz3'); } - } // baz4 @@ -86,7 +84,7 @@ public function match($pathinfo) return $this->redirect($pathinfo.'/', 'baz4'); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); } // baz5 @@ -96,7 +94,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); } not_baz5: @@ -107,20 +105,19 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); } not_bazbaz6: - } // foofoo if ($pathinfo === '/foofoo') { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array('def' => 'test', '_route' => 'foofoo'); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); } // space @@ -132,40 +129,37 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); } - } - } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); } // overridden2 @@ -181,17 +175,16 @@ public function match($pathinfo) return array('_route' => 'hey'); } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -202,9 +195,8 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); } - } $host = $this->context->getHost(); @@ -219,7 +211,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } - } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -227,7 +218,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } - } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -235,7 +225,6 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -243,7 +232,6 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } - } // route6 @@ -255,47 +243,43 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); } - } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); } - } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } - } if (0 === strpos($pathinfo, '/a')) { @@ -307,21 +291,19 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); } - } - } // secure if ($pathinfo === '/secure') { - $requiredSchemes = array ( 'https' => 0,); + $requiredSchemes = array('https' => 0); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); } @@ -331,7 +313,7 @@ public function match($pathinfo) // nonsecure if ($pathinfo === '/nonsecure') { - $requiredSchemes = array ( 'http' => 0,); + $requiredSchemes = array('http' => 0); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); } 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 d9da7b02d4b43..984b2743f122c 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -35,13 +35,12 @@ public function match($pathinfo) // dynamic if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array()); } - } // with-condition - if ($pathinfo === '/with-condition' && ($context->getMethod() == "GET")) { + if ($pathinfo === '/with-condition' && ($context->getMethod() == 'GET')) { return array('_route' => 'with-condition'); } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php index 7561c34f1a211..6f5639a3d53e0 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php @@ -1 +1 @@ - + 'bar', ); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 59ba119e42914..822736abd5561 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -125,9 +125,9 @@ public function dumpScalar(Cursor $cursor, $type, $value) $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; + case INF === $value: $value = 'INF'; break; case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; + case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; if (false === strpos($value, $this->decimalPoint)) { diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index de93d7986e0a5..e5d022fd379dc 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,13 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", ); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P'); + '\\N', '\\_', '\\L', '\\P', ); /** * Determines if a PHP value would require double quoting in YAML. From 735d0a6ce7083d259c75bfee108bdf0dd23a8bbb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:37:26 -0800 Subject: [PATCH 47/98] Revert "fixed typo" This reverts commit 6830d9f4c904d74020d2619fae990670edb3c3de. --- .../DeprecationErrorHandler/default.phpt | 6 +- .../Tests/DeprecationErrorHandler/weak.phpt | 2 +- .../Extension/TranslationExtensionTest.php | 12 ++-- .../Resources/views/Form/attributes.html.php | 2 +- .../views/Form/button_widget.html.php | 6 +- .../views/Form/choice_options.html.php | 2 +- .../views/Form/choice_widget_options.html.php | 2 +- .../views/Form/container_attributes.html.php | 2 +- .../views/Form/email_widget.html.php | 2 +- .../Resources/views/Form/form_label.html.php | 18 ++--- .../Resources/views/Form/form_start.html.php | 4 +- .../Resources/views/Form/hidden_row.html.php | 2 +- .../views/Form/hidden_widget.html.php | 2 +- .../views/Form/integer_widget.html.php | 2 +- .../views/Form/money_widget.html.php | 2 +- .../views/Form/number_widget.html.php | 2 +- .../views/Form/password_widget.html.php | 2 +- .../views/Form/repeated_row.html.php | 2 +- .../views/Form/reset_widget.html.php | 2 +- .../views/Form/search_widget.html.php | 2 +- .../views/Form/submit_widget.html.php | 2 +- .../Resources/views/Form/url_widget.html.php | 2 +- .../Custom/_name_c_entry_label.html.php | 4 +- .../Debug/Resources/ext/tests/001.phpt | 4 +- .../Debug/Resources/ext/tests/002.phpt | 4 +- .../Debug/Resources/ext/tests/002_1.phpt | 4 +- .../Debug/Resources/ext/tests/003.phpt | 4 +- .../Debug/Tests/DebugClassLoaderTest.php | 2 +- .../Compiler/CheckCircularReferencesPass.php | 1 + .../DependencyInjection/Container.php | 4 +- .../DependencyInjection/Definition.php | 2 +- .../Tests/Fixtures/containers/container14.php | 2 +- .../Tests/Fixtures/php/services1-1.php | 1 - .../Tests/Fixtures/php/services8.php | 2 +- .../Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 4 +- .../DataCollector/DumpDataCollector.php | 2 +- .../Component/Process/Pipes/AbstractPipes.php | 2 +- .../Component/Process/Pipes/WindowsPipes.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 68 +++++++++++------- .../Tests/Fixtures/dumper/url_matcher2.php | 72 ++++++++++++------- .../Tests/Fixtures/dumper/url_matcher3.php | 5 +- .../Tests/Fixtures/templates/foo.php | 2 +- .../Translation/Tests/fixtures/resources.php | 2 +- .../Component/VarDumper/Dumper/CliDumper.php | 4 +- src/Symfony/Component/Yaml/Escaper.php | 4 +- 46 files changed, 149 insertions(+), 134 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index 49a14479475a0..fac5c53ae7486 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -31,14 +31,14 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } public function testNonLegacyBar() { @trigger_error('silenced bar deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt index d697843280f4b..9e78d96e70efb 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt @@ -23,7 +23,7 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index e066d537352c4..e96bd4f9a3bef 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -87,17 +87,17 @@ public function getTransTests() // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0), ), + 'There is no apples', array('count' => 0)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5), ), + 'There is 5 apples', array('count' => 5)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'), ), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5), ), + 'There is 5 apples (Symfony)', array('count' => 5)), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0), ), + 'There is no apples', array('count' => 0)), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', ), + 'There is 5 apples'), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php index 28474797a5538..eb421be817691 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php @@ -1 +1 @@ -block($form, 'widget_attributes'); +block($form, 'widget_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php index 32d8eeb619141..9dac32fc994c0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php @@ -1,6 +1,4 @@ - $name, '%id%' => $id)) - : $view['form']->humanize($name); -} ?> + : $view['form']->humanize($name); } ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php index 2463438d5aad5..211ae73f1c3d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php @@ -1 +1 @@ -block($form, 'choice_widget_options'); +block($form, 'choice_widget_options') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php index fc9846375f851..f1c6ad3b56f21 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php @@ -1,6 +1,6 @@ +$translatorHelper = $view['translator']; // outside of the loop for performance reasons! ?> $choice): ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php index fb6c0f2b5ed8b..302bbfcd479d9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php @@ -1 +1 @@ -block($form, 'widget_container_attributes'); +block($form, 'widget_container_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php index 7dfd085d86a6a..0b30c5bb7ae54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php index 1b10546d979f3..7a51b2ce7b4ff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php @@ -1,16 +1,8 @@ - - - + + $name, '%id%' => $id)) - : $view['form']->humanize($name); -} ?> - + : $view['form']->humanize($name); } ?> + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php index c81836eeb7e30..e7b23d394daec 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php @@ -1,8 +1,6 @@ - $v) { - printf(' %s="%s"', $view->escape($k), $view->escape($v)); -} ?> enctype="multipart/form-data"> + $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?> enctype="multipart/form-data"> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php index 800a8facf87f3..3239d8f415b12 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php @@ -1 +1 @@ -widget($form); +widget($form) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php index 8763fa6d4b79a..a43f7de475e7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php index 9efb26a18ffa0..5fceb49a38953 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php index ea12cd4a4881a..644d284915371 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple'), $money_pattern); +block($form, 'form_widget_simple'), $money_pattern) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php index 6f2d12e19d22e..bf4a4c478502b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php index decefacf91800..ec96cfb46b24c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php index 04cc29bcca3e0..d4af23d712320 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php @@ -1 +1 @@ -block($form, 'form_rows'); +block($form, 'form_rows') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php index 0f66b4b6aecf9..e8fa18e488df8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')); +block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php index 73ff6908d78b8..48a33f4aa2dbc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php index 027bdc9857369..6bf71f5a1e1c9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')); +block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php index 80329fff87d85..9e26318497b3c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php index 80a9c5f611a36..05240035c023d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php @@ -1,4 +1,2 @@ -humanize($name); -} ?> +humanize($name); } ?> diff --git a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt index 873e2569ec5a3..15e183a70615c 100644 --- a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt @@ -1,9 +1,7 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- getId(); if (empty($this->checkedNodes[$id])) { + // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 2421b82a7ea3a..f6c953f550993 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -219,7 +219,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) */ public function has($id) { - for ($i = 2; ;) { + for ($i = 2;;) { if ('service_container' === $id || isset($this->aliases[$id]) || isset($this->services[$id]) @@ -258,7 +258,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE // available services. Service IDs are case insensitive, however since // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. - for ($i = 2; ;) { + for ($i = 2;;) { if ('service_container' === $id) { return $this; } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 4f2ee304adad2..72fba5acc7ce6 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that this service is decorating. + * Gets the service that decorates this service. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php index 191afb8cddc1f..56ea6c1ed23d4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; -/* +/** * This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer * and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped. */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index 0fede650233e5..f15771172ef19 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -1,5 +1,4 @@ array( 0 => true, 1 => false, - 2 => null, + 2 => NULL, 3 => 0, 4 => 1000.3, 5 => 'true', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index c173b83906785..ce8930b8ddeba 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -248,7 +248,7 @@ protected function getMethodCall1Service() if ($this->has('foobaz')) { $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); + $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 8991bd006e4f3..559560fa6da60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -253,8 +253,8 @@ protected function getMethodCall1Service() $this->services['method_call1'] = $instance = new \Bar\FooClass(); $instance->setBar($this->get('foo')); - $instance->setBar(null); - $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); + $instance->setBar(NULL); + $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); return $instance; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 3f20c4343981f..538d73c783ba3 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line; }, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 951bbcba7e071..1a94755bd71c1 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -109,7 +109,7 @@ protected function write() } if ($input) { - for (; ;) { + for (;;) { $data = fread($input, self::CHUNK_SIZE); if (!isset($data[0])) { break; diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 7712cd453d662..87a781ea9204a 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -55,7 +55,7 @@ public function __construct($disableOutput, $input) $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); - for ($i = 0; ; ++$i) { + for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); if (file_exists($file) && !unlink($file)) { 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 4b243286bcc6f..4ea0b8a1a3e7c 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); } not_bar: @@ -51,9 +51,10 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); } not_barhead: + } if (0 === strpos($pathinfo, '/test')) { @@ -72,11 +73,12 @@ public function match($pathinfo) if ($pathinfo === '/test/baz3/') { return array('_route' => 'baz3'); } + } // baz4 if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); } // baz5 @@ -86,7 +88,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); } not_baz5: @@ -97,19 +99,20 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); } not_bazbaz6: + } // foofoo if ($pathinfo === '/foofoo') { - return array('def' => 'test', '_route' => 'foofoo'); + return array ( 'def' => 'test', '_route' => 'foofoo',); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); } // space @@ -121,37 +124,40 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); } + } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); } + } + } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); } // overridden2 @@ -163,16 +169,17 @@ public function match($pathinfo) if ($pathinfo === '/multi/hey/') { return array('_route' => 'hey'); } + } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); } if (0 === strpos($pathinfo, '/aba')) { @@ -183,8 +190,9 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); } + } $host = $this->context->getHost(); @@ -199,6 +207,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } + } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -206,6 +215,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } + } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -213,6 +223,7 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -220,6 +231,7 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } + } // route6 @@ -231,43 +243,47 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); } + } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); } + } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } + } if (0 === strpos($pathinfo, '/a')) { @@ -279,14 +295,16 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); } + } + } throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); 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 81e7e727395d5..f9d3fa2d8257b 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); } not_bar: @@ -51,9 +51,10 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); } not_barhead: + } if (0 === strpos($pathinfo, '/test')) { @@ -76,6 +77,7 @@ public function match($pathinfo) return array('_route' => 'baz3'); } + } // baz4 @@ -84,7 +86,7 @@ public function match($pathinfo) return $this->redirect($pathinfo.'/', 'baz4'); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); } // baz5 @@ -94,7 +96,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); } not_baz5: @@ -105,19 +107,20 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); } not_bazbaz6: + } // foofoo if ($pathinfo === '/foofoo') { - return array('def' => 'test', '_route' => 'foofoo'); + return array ( 'def' => 'test', '_route' => 'foofoo',); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); } // space @@ -129,37 +132,40 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); } + } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); } + } + } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); } // overridden2 @@ -175,16 +181,17 @@ public function match($pathinfo) return array('_route' => 'hey'); } + } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); } if (0 === strpos($pathinfo, '/aba')) { @@ -195,8 +202,9 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); } + } $host = $this->context->getHost(); @@ -211,6 +219,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } + } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -218,6 +227,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } + } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -225,6 +235,7 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -232,6 +243,7 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } + } // route6 @@ -243,43 +255,47 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); } + } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); } + } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } + } if (0 === strpos($pathinfo, '/a')) { @@ -291,19 +307,21 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); } + } + } // secure if ($pathinfo === '/secure') { - $requiredSchemes = array('https' => 0); + $requiredSchemes = array ( 'https' => 0,); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); } @@ -313,7 +331,7 @@ public function match($pathinfo) // nonsecure if ($pathinfo === '/nonsecure') { - $requiredSchemes = array('http' => 0); + $requiredSchemes = array ( 'http' => 0,); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); } 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 984b2743f122c..d9da7b02d4b43 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -35,12 +35,13 @@ public function match($pathinfo) // dynamic if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); } + } // with-condition - if ($pathinfo === '/with-condition' && ($context->getMethod() == 'GET')) { + if ($pathinfo === '/with-condition' && ($context->getMethod() == "GET")) { return array('_route' => 'with-condition'); } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php index 6f5639a3d53e0..7561c34f1a211 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php @@ -1 +1 @@ - diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources.php b/src/Symfony/Component/Translation/Tests/fixtures/resources.php index 0cc2bec1d52b5..c2913985391cb 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources.php +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources.php @@ -1,5 +1,5 @@ 'bar', ); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 822736abd5561..59ba119e42914 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -125,9 +125,9 @@ public function dumpScalar(Cursor $cursor, $type, $value) $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; + case INF === $value: $value = 'INF'; break; case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; + case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; if (false === strpos($value, $this->decimalPoint)) { diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index e5d022fd379dc..de93d7986e0a5 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,13 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", ); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P', ); + '\\N', '\\_', '\\L', '\\P'); /** * Determines if a PHP value would require double quoting in YAML. From d103b6142025bf180166ed5d5a19609c0ea38a7c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:37:56 -0800 Subject: [PATCH 48/98] fixed typo --- src/Symfony/Component/DependencyInjection/Definition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 72fba5acc7ce6..4f2ee304adad2 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that decorates this service. + * Gets the service that this service is decorating. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ From 2ff6f445bc465b1fc9a57680702e825c4d309511 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:45:58 -0800 Subject: [PATCH 49/98] fixed CS fixer config --- .php_cs.dist | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index e2e173ad0545e..f6b07d11dd6f3 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -15,24 +15,24 @@ return PhpCsFixer\Config::create() ->in(__DIR__.'/src') ->exclude(array( // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code - 'src/Symfony/Component/DependencyInjection/Tests/Fixtures', - 'src/Symfony/Component/Routing/Tests/Fixtures/dumper', + 'Symfony/Component/DependencyInjection/Tests/Fixtures', + 'Symfony/Component/Routing/Tests/Fixtures/dumper', // fixture templates - 'src/Symfony/Component/Templating/Tests/Fixtures/templates', - 'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', + 'Symfony/Component/Templating/Tests/Fixtures/templates', + 'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', // resource templates - 'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', + 'Symfony/Bundle/FrameworkBundle/Resources/views/Form', )) // file content autogenerated by `var_export` - ->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php') + ->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php') // autogenerated xmls - ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml') - ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml') + ->notPath('Symfony/Component/Console/Tests/Fixtures/application_1.xml') + ->notPath('Symfony/Component/Console/Tests/Fixtures/application_2.xml') // yml - ->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') + ->notPath('Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') // test template - ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') + ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') // explicit heredoc test - ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') + ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') ) ; From b6507c8c1ced3bcb06858414d9fc212c0d1e882a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:52:33 -0800 Subject: [PATCH 50/98] fixed CS --- .php_cs.dist | 1 + .../Compiler/CheckCircularReferencesPass.php | 1 - .../Component/HttpKernel/DataCollector/DumpDataCollector.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index f6b07d11dd6f3..140fd3265011c 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -8,6 +8,7 @@ return PhpCsFixer\Config::create() 'no_unreachable_default_argument_value' => false, 'braces' => array('allow_single_line_closure' => true), 'heredoc_to_nowdoc' => false, + 'phpdoc_annotation_without_dot' => false, )) ->setRiskyAllowed(true) ->setFinder( diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php index 156bcc0c3ab7b..f39a89af2be71 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php @@ -60,7 +60,6 @@ private function checkOutEdges(array $edges) $id = $node->getId(); if (empty($this->checkedNodes[$id])) { - // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 538d73c783ba3..78fc74f2d3f4a 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); From 4a46c6ff13ef6b1d217edb5ceb8590dc1bc9881d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:59:38 -0800 Subject: [PATCH 51/98] fixed CS --- src/Symfony/Component/Form/Extension/Core/Type/DateType.php | 2 +- src/Symfony/Component/Form/Extension/Core/Type/TimeType.php | 2 +- src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php | 2 +- .../Component/Serializer/Tests/Encoder/JsonDecodeTest.php | 2 +- .../Component/Serializer/Tests/Encoder/JsonEncodeTest.php | 2 +- .../Component/Translation/Tests/Dumper/FileDumperTest.php | 2 +- src/Symfony/Component/Translation/Util/ArrayConverter.php | 2 +- src/Symfony/Component/Validator/Constraints/BicValidator.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 209ece5cae3ed..cd21538b26823 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -221,7 +221,7 @@ public function configureOptions(OptionsResolver $resolver) array('year' => $default, 'month' => $default, 'day' => $default), $choiceTranslationDomain ); - }; + } return array( 'year' => $choiceTranslationDomain, diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 8aae516a5e2e4..6af08fb32bb0d 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -222,7 +222,7 @@ public function configureOptions(OptionsResolver $resolver) array('hour' => $default, 'minute' => $default, 'second' => $default), $choiceTranslationDomain ); - }; + } return array( 'hour' => $choiceTranslationDomain, diff --git a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php index 942318af605d8..031c8ac05e26a 100644 --- a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php +++ b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php @@ -44,7 +44,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface * @param PropertyDescriptionExtractorInterface[] $descriptionExtractors * @param PropertyAccessExtractorInterface[] $accessExtractors */ - public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array()) + public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array()) { $this->listExtractors = $listExtractors; $this->typeExtractors = $typeExtractors; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php index c87ab21b510a2..7818aeaf55df8 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php @@ -61,7 +61,7 @@ public function decodeProvider() */ public function testDecodeWithException($value) { - $this->decode->decode($value, JsonEncoder::FORMAT); + $this->decode->decode($value, JsonEncoder::FORMAT); } public function decodeProviderException() diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php index d255b21d22e7f..291c0f0965c80 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php @@ -54,6 +54,6 @@ public function encodeProvider() */ public function testEncodeWithError() { - $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); + $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); } } diff --git a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php index e98443246b20a..75aba4d5d2765 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php @@ -26,7 +26,7 @@ public function testDump() $dumper = new ConcreteFileDumper(); $dumper->dump($catalogue, array('path' => $tempDir)); - $this->assertTrue(file_exists($tempDir.'/messages.en.concrete')); + $this->assertFileExists($tempDir.'/messages.en.concrete'); } public function testDumpBackupsFileIfExisting() diff --git a/src/Symfony/Component/Translation/Util/ArrayConverter.php b/src/Symfony/Component/Translation/Util/ArrayConverter.php index 60a55e9d3709c..9c0a420a8592f 100644 --- a/src/Symfony/Component/Translation/Util/ArrayConverter.php +++ b/src/Symfony/Component/Translation/Util/ArrayConverter.php @@ -62,7 +62,7 @@ private static function &getElementByPath(array &$tree, array $parts) * $tree['foo'] was string before we found array {bar: test2}. * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; */ - $elem = &$elem[ implode('.', array_slice($parts, $i)) ]; + $elem = &$elem[implode('.', array_slice($parts, $i))]; break; } $parentOfElem = &$elem; diff --git a/src/Symfony/Component/Validator/Constraints/BicValidator.php b/src/Symfony/Component/Validator/Constraints/BicValidator.php index f476713c74d14..d2188071fabf1 100644 --- a/src/Symfony/Component/Validator/Constraints/BicValidator.php +++ b/src/Symfony/Component/Validator/Constraints/BicValidator.php @@ -17,7 +17,7 @@ /** * @author Michael Hirschler * - * @link https://en.wikipedia.org/wiki/ISO_9362#Structure + * @see https://en.wikipedia.org/wiki/ISO_9362#Structure */ class BicValidator extends ConstraintValidator { From e3dcde7b8a122123cfd67fc2286f21bfd8b9e04a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 09:13:55 -0800 Subject: [PATCH 52/98] fixed CS --- .../CompilerPass/RegisterMappingsPassTest.php | 1 - src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php | 4 ++-- src/Symfony/Component/Process/Tests/ProcessTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php index c86ef117753eb..85e35f9b1fc7c 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php @@ -15,7 +15,6 @@ class RegisterMappingsPassTest extends \PHPUnit_Framework_TestCase public function testNoDriverParmeterException() { $container = $this->createBuilder(array( - )); $this->process($container, array( 'manager.param.one', diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index e729a27526fff..6e2c3fab038cf 100755 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -30,14 +30,14 @@ public function testConstructor() public function testGetUri() { $uri = 'http://symfony.com'; - $crawler = new Crawler(null, $uri); + $crawler = new Crawler(null, $uri); $this->assertEquals($uri, $crawler->getUri()); } public function testGetBaseHref() { $baseHref = 'http://symfony.com'; - $crawler = new Crawler(null, null, $baseHref); + $crawler = new Crawler(null, null, $baseHref); $this->assertEquals($baseHref, $crawler->getBaseHref()); } diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index f317fc7d72938..223c8c9871f40 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1281,7 +1281,7 @@ public function testInputStreamOnEmpty() { $i = 0; $input = new InputStream(); - $input->onEmpty(function () use (&$i) {++$i;}); + $input->onEmpty(function () use (&$i) { ++$i; }); $process = $this->getProcess(self::$phpBin.' -r '.escapeshellarg('echo 123; echo fread(STDIN, 1); echo 456;')); $process->setInput($input); From 2106e94f34030d16626dd4500cb0e5de49ccd930 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 09:18:54 -0800 Subject: [PATCH 53/98] fixed CS --- src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php | 1 - src/Symfony/Component/Console/Tester/CommandTester.php | 2 +- .../Style/SymfonyStyle/command/interactive_command_1.php | 2 +- src/Symfony/Component/Debug/Exception/FlattenException.php | 2 +- .../Component/Debug/Tests/Exception/FlattenExceptionTest.php | 2 +- .../Validator/Tests/Constraints/EmailValidatorTest.php | 2 +- src/Symfony/Component/VarDumper/Cloner/Data.php | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php b/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php index 34ed20e6d2660..156fc5c1fb63a 100644 --- a/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php +++ b/src/Symfony/Component/Cache/Adapter/FilesystemAdapterTrait.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Adapter; -use Symfony\Component\Cache\Exception\CacheException; use Symfony\Component\Cache\Exception\InvalidArgumentException; /** diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index 2c547a8f667ea..080ace5c95911 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -155,7 +155,7 @@ private static function createStream(array $inputs) { $stream = fopen('php://memory', 'r+', false); - fputs($stream, implode(PHP_EOL, $inputs)); + fwrite($stream, implode(PHP_EOL, $inputs)); rewind($stream); return $stream; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php index c370c00106b25..3c9c744050185 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php @@ -9,7 +9,7 @@ $output = new SymfonyStyle($input, $output); $stream = fopen('php://memory', 'r+', false); - fputs($stream, "Foo\nBar\nBaz"); + fwrite($stream, "Foo\nBar\nBaz"); rewind($stream); $input->setStream($stream); diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php index 51baeb9be8b75..286a71ec143c6 100644 --- a/src/Symfony/Component/Debug/Exception/FlattenException.php +++ b/src/Symfony/Component/Debug/Exception/FlattenException.php @@ -237,7 +237,7 @@ private function flattenArgs($args, $level = 0, &$count = 0) $result[$key] = array('null', null); } elseif (is_bool($value)) { $result[$key] = array('boolean', $value); - } elseif (is_integer($value)) { + } elseif (is_int($value)) { $result[$key] = array('integer', $value); } elseif (is_float($value)) { $result[$key] = array('float', $value); diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index aa4c2d0d15d72..1903459e8ff66 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -249,7 +249,7 @@ function () {}, // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); - $this->assertTrue(is_nan($array[$i++][1])); + $this->assertNan($array[$i++][1]); } public function testRecursionInArguments() diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index d8b1e3d6adb61..30ec8f22a1e8c 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -123,7 +123,7 @@ public function testStrictWithInvalidEmails($email) } /** - * @link https://github.com/egulias/EmailValidator/blob/1.2.8/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php + * @see https://github.com/egulias/EmailValidator/blob/1.2.8/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php */ public function getInvalidEmailsForStrictChecks() { diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index 1c6dd0df86b60..22fd2fd1a4a28 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -256,7 +256,7 @@ private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCu $cursor->hashCut = $hashCut; foreach ($children as $key => $child) { $cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key); - $cursor->hashKey = $dumpKeys ? $key : null; + $cursor->hashKey = $dumpKeys ? $key : null; $this->dumpItem($dumper, $cursor, $refs, $child); if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) { $parentCursor->stop = true; From f920e61d3502b9f3d2d5ed8c1df14428c2b46fdf Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 22 Jan 2017 08:38:04 +0100 Subject: [PATCH 54/98] update German translation --- .../Validator/Resources/translations/validators.de.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 105f2fb2a1941..8948f8e423a42 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Es wurde kein temporärer Ordner in der php.ini konfiguriert. + Es wurde kein temporärer Ordner in der php.ini konfiguriert oder der temporäre Ordner existiert nicht. Cannot write temporary file to disk. From a7f63de4149023f0b457339fefd51d8763229bae Mon Sep 17 00:00:00 2001 From: matze Date: Sun, 22 Jan 2017 15:49:28 +0100 Subject: [PATCH 55/98] [DependencyInjection] Fixed variadic method parameter in autowired classes --- .../Compiler/AutowirePass.php | 3 ++- .../Tests/Compiler/AutowirePassTest.php | 18 ++++++++++++++++++ .../Tests/Fixtures/includes/FooVariadic.php | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/FooVariadic.php diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 01c114e54014f..8549a3139a353 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -338,10 +338,11 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method) $class = false; } + $isVariadic = method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); $methodArgumentsMetadata[] = array( 'class' => $class, 'isOptional' => $parameter->isOptional(), - 'defaultValue' => $parameter->isOptional() ? $parameter->getDefaultValue() : null, + 'defaultValue' => ($parameter->isOptional() && !$isVariadic) ? $parameter->getDefaultValue() : null, ); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index 16c8130cd5cad..8fca41b603724 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\Compiler\AutowirePass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic; /** * @author Kévin Dunglas @@ -35,6 +36,23 @@ public function testProcess() $this->assertEquals('foo', (string) $container->getDefinition('bar')->getArgument(0)); } + /** + * @requires PHP 5.6 + */ + public function testProcessVariadic() + { + $container = new ContainerBuilder(); + $container->register('foo', Foo::class); + $definition = $container->register('fooVariadic', FooVariadic::class); + $definition->setAutowired(true); + + $pass = new AutowirePass(); + $pass->process($container); + + $this->assertCount(1, $container->getDefinition('fooVariadic')->getArguments()); + $this->assertEquals('foo', (string) $container->getDefinition('fooVariadic')->getArgument(0)); + } + public function testProcessAutowireParent() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/FooVariadic.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/FooVariadic.php new file mode 100644 index 0000000000000..12861c5611735 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/FooVariadic.php @@ -0,0 +1,16 @@ + Date: Mon, 23 Jan 2017 09:24:07 +0100 Subject: [PATCH 56/98] fix merge --- .../Tests/DependencyInjection/Compiler/ExtensionPassTest.php | 5 +++++ .../Component/Debug/Tests/Exception/FlattenExceptionTest.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php index 587801d8db622..e6ab0159fdadd 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php @@ -21,15 +21,20 @@ public function testProcessDoesNotDropExistingFileLoaderMethodCalls() { $container = new ContainerBuilder(); $container->setParameter('kernel.debug', false); + $container->setParameter('kernel.root_dir', __DIR__); $container->register('twig.app_variable', '\Symfony\Bridge\Twig\AppVariable'); $container->register('templating', '\Symfony\Bundle\TwigBundle\TwigEngine'); + $container->register('twig.extension.yaml'); + $container->register('twig.extension.debug.stopwatch'); + $container->register('twig.extension.expression'); $nativeTwigLoader = new Definition('\Twig_Loader_Filesystem'); $nativeTwigLoader->addMethodCall('addPath', array()); $container->setDefinition('twig.loader.native_filesystem', $nativeTwigLoader); $filesystemLoader = new Definition('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader'); + $filesystemLoader->setArguments(array(null, null, null)); $filesystemLoader->addMethodCall('addPath', array()); $container->setDefinition('twig.loader.filesystem', $filesystemLoader); diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 1903459e8ff66..aa4c2d0d15d72 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -249,7 +249,7 @@ function () {}, // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); - $this->assertNan($array[$i++][1]); + $this->assertTrue(is_nan($array[$i++][1])); } public function testRecursionInArguments() From e95fc09b3ce5a3fbd5bf643cbc5f220e63e94525 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 23 Jan 2017 09:24:39 +0100 Subject: [PATCH 57/98] fix getMock usage --- .../Core/Tests/User/LdapUserProviderTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php index d39f8ad5740d7..06baeae7d118f 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php @@ -156,14 +156,14 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() */ public function testLoadUserByUsernameFailsIfEntryHasNoUidKeyAttribute() { - $result = $this->getMock(CollectionInterface::class); - $query = $this->getMock(QueryInterface::class); + $result = $this->getMockBuilder(CollectionInterface::class)->getMock(); + $query = $this->getMockBuilder(QueryInterface::class)->getMock(); $query ->expects($this->once()) ->method('execute') ->will($this->returnValue($result)) ; - $ldap = $this->getMock(LdapInterface::class); + $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') @@ -321,14 +321,14 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWro public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() { - $result = $this->getMock(CollectionInterface::class); - $query = $this->getMock(QueryInterface::class); + $result = $this->getMockBuilder(CollectionInterface::class)->getMock(); + $query = $this->getMockBuilder(QueryInterface::class)->getMock(); $query ->expects($this->once()) ->method('execute') ->will($this->returnValue($result)) ; - $ldap = $this->getMock(LdapInterface::class); + $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') From 1d298f0417652ce5dac2e0e4756d5c244be57046 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 23 Jan 2017 17:37:56 +0100 Subject: [PATCH 58/98] [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling --- composer.json | 3 +- .../Functional/AnnotatedControllerTest.php | 39 ++++++++++++++ .../Controller/AnnotatedController.php | 51 +++++++++++++++++++ .../app/AnnotatedController/bundles.php | 20 ++++++++ .../app/AnnotatedController/config.yml | 2 + .../app/AnnotatedController/routing.yml | 4 ++ .../Bundle/FrameworkBundle/composer.json | 5 +- .../Routing/Loader/AnnotationClassLoader.php | 5 ++ 8 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml diff --git a/composer.json b/composer.json index 34dfa896e3b45..2d7b451159758 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,8 @@ "ircmaxell/password-compat": "~1.0", "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "symfony/phpunit-bridge": "~3.2", - "egulias/email-validator": "~1.2,>=1.2.1" + "egulias/email-validator": "~1.2,>=1.2.1", + "sensio/framework-extra-bundle": "^3.0.2" }, "autoload": { "psr-4": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php new file mode 100644 index 0000000000000..2fdbef8839496 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; + +class AnnotatedControllerTest extends WebTestCase +{ + /** + * @dataProvider getRoutes + */ + public function testAnnotatedController($path, $expectedValue) + { + $client = $this->createClient(array('test_case' => 'AnnotatedController', 'root_config' => 'config.yml')); + $client->request('GET', '/annotated'.$path); + + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame($expectedValue, $client->getResponse()->getContent()); + } + + public function getRoutes() + { + return array( + array('/null_request', 'Symfony\Component\HttpFoundation\Request'), + array('/null_argument', ''), + array('/null_argument_with_route_param', ''), + array('/null_argument_with_route_param/value', 'value'), + array('/argument_with_route_param_and_default', 'value'), + array('/argument_with_route_param_and_default/custom', 'custom'), + ); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php new file mode 100644 index 0000000000000..98a3ace982e33 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +class AnnotatedController +{ + /** + * @Route("/null_request", name="null_request") + */ + public function requestDefaultNullAction(Request $request = null) + { + return new Response($request ? get_class($request) : null); + } + + /** + * @Route("/null_argument", name="null_argument") + */ + public function argumentDefaultNullWithoutRouteParamAction($value = null) + { + return new Response($value); + } + + /** + * @Route("/null_argument_with_route_param/{value}", name="null_argument_with_route_param") + */ + public function argumentDefaultNullWithRouteParamAction($value = null) + { + return new Response($value); + } + + /** + * @Route("/argument_with_route_param_and_default/{value}", defaults={"value": "value"}, name="argument_with_route_param_and_default") + */ + public function argumentWithoutDefaultWithRouteParamAndDefaultAction($value) + { + return new Response($value); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php new file mode 100644 index 0000000000000..f3290d7728541 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; +use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle; + +return array( + new FrameworkBundle(), + new TestBundle(), + new SensioFrameworkExtraBundle(), +); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml new file mode 100644 index 0000000000000..377d3e7852064 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../config/default.yml } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml new file mode 100644 index 0000000000000..ebd18a0a4c282 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml @@ -0,0 +1,4 @@ +annotated_controller: + prefix: /annotated + resource: "@TestBundle/Controller/AnnotatedController.php" + type: annotation diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 63c43e003506b..5f0c6ce2e1462 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -25,7 +25,7 @@ "symfony/http-foundation": "~2.7", "symfony/http-kernel": "~2.7.23|~2.8.16", "symfony/filesystem": "~2.3", - "symfony/routing": "~2.6,>2.6.4", + "symfony/routing": "~2.7.24|~2.8.17", "symfony/security-core": "~2.6.13|~2.7.9|~2.8", "symfony/security-csrf": "~2.6", "symfony/stopwatch": "~2.3", @@ -45,7 +45,8 @@ "symfony/expression-language": "~2.6", "symfony/process": "~2.0,>=2.0.5", "symfony/validator": "~2.5", - "symfony/yaml": "~2.0,>=2.0.5" + "symfony/yaml": "~2.0,>=2.0.5", + "sensio/framework-extra-bundle": "^3.0.2" }, "suggest": { "symfony/console": "For using the console commands", diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 339529e5190e7..62ad9c3f9fae0 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -138,6 +138,11 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl } $defaults = array_replace($globals['defaults'], $annot->getDefaults()); + foreach ($method->getParameters() as $param) { + if (false !== strpos($globals['path'].$annot->getPath(), sprintf('{%s}', $param->getName())) && !isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { + $defaults[$param->getName()] = $param->getDefaultValue(); + } + } $requirements = array_replace($globals['requirements'], $annot->getRequirements()); $options = array_replace($globals['options'], $annot->getOptions()); $schemes = array_merge($globals['schemes'], $annot->getSchemes()); From e59f0e0fd7323902fa025e2eae96ce9eb91b24c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 23 Jan 2017 21:50:14 +0100 Subject: [PATCH 59/98] [FrameworkBundle] Dont wire "annotations.cached_reader" before removing passes --- .../AddAnnotationsCachedReaderPass.php | 33 +++++++++++++++++++ .../Compiler/CachePoolClearerPass.php | 18 ---------- .../FrameworkExtension.php | 3 +- .../FrameworkBundle/FrameworkBundle.php | 2 ++ .../Resources/config/cache.xml | 9 ++--- .../FrameworkExtensionTest.php | 1 - .../AnnotationReaderPass.php | 24 ++++++++++++++ .../Bundle/TestBundle/TestBundle.php | 3 ++ 8 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php new file mode 100644 index 0000000000000..4b75738b2fd1a --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * @internal + */ +class AddAnnotationsCachedReaderPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + // "annotations.cached_reader" is wired late so that any passes using + // "annotation_reader" at build time don't get any cache + if ($container->hasDefinition('annotations.cached_reader')) { + $container->setAlias('annotation_reader', 'annotations.cached_reader'); + } + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php index c859a6ba900a4..901722756bd4a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; @@ -39,22 +38,5 @@ public function process(ContainerBuilder $container) } } } - - if (!$container->has('cache.annotations')) { - return; - } - $factory = array(AbstractAdapter::class, 'createSystemCache'); - $annotationsPool = $container->getDefinition('cache.annotations'); - if ($factory !== $annotationsPool->getFactory() || 4 !== count($annotationsPool->getArguments())) { - return; - } - if ($container->has('monolog.logger.cache')) { - $annotationsPool->addArgument(new Reference('monolog.logger.cache')); - } elseif ($container->has('cache.system')) { - $systemPool = $container->getDefinition('cache.system'); - if ($factory === $systemPool->getFactory() && 5 <= count($systemArgs = $systemPool->getArguments())) { - $annotationsPool->addArgument($systemArgs[4]); - } - } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index e6eb049e2ce83..7429eed2f27a0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1043,7 +1043,8 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde ->replaceArgument(2, $config['debug']) ->addAutowiringType(Reader::class) ; - $container->setAlias('annotation_reader', 'annotations.cached_reader'); + } else { + $container->removeDefinition('annotations.cached_reader'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 4c20d146cb4bf..853e1f22e7b3e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass; @@ -79,6 +80,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->addCompilerPass(new TemplatingPass()); $container->addCompilerPass(new AddConstraintValidatorsPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->addCompilerPass(new AddValidatorInitializersPass()); $container->addCompilerPass(new AddConsoleCommandPass()); $container->addCompilerPass(new FormPass()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 80cb00ada9652..461b40455a8c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -22,13 +22,8 @@ - - - - - 0 - - %kernel.cache_dir%/pools + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 9e70046f34d8c..fec9b4be16ab2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -440,7 +440,6 @@ public function testAnnotations() $container = $this->createContainerFromFile('full'); $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.filesystem_cache')->getArgument(0)); - $this->assertSame('annotations.cached_reader', (string) $container->getAlias('annotation_reader')); $this->assertSame('annotations.filesystem_cache', (string) $container->getDefinition('annotations.cached_reader')->getArgument(1)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php new file mode 100644 index 0000000000000..2de08632fa144 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class AnnotationReaderPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + // simulate using "annotation_reader" in a compiler pass + $container->get('annotation_reader'); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php index e7982cfaab7cc..d63658bacf021 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\AnnotationReaderPass; use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig; class TestBundle extends Bundle @@ -25,5 +26,7 @@ public function build(ContainerBuilder $container) $extension = $container->getExtension('test'); $extension->setCustomConfig(new CustomConfig()); + + $container->addCompilerPass(new AnnotationReaderPass()); } } From bc1f084c4bd58798c11312cb55a98c9181960406 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 24 Jan 2017 10:22:35 +0100 Subject: [PATCH 60/98] Fix double escaping of the decision attributes in the profiler A ternary operator is considered safe by the Twig auto-escaping only when both branches are safe. But this ternary was safe only in the ELSE branch, causing it to be unsafe. This triggered a double-escaping of the value (escaping the output of the dump). The fix is to use a {% if %} and 2 separate output statements, allowing them to be auto-escaped separately. --- .../Resources/views/Collector/security.html.twig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig index 3830e924a190b..073d0d869d8f0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig +++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig @@ -257,7 +257,13 @@ : 'DENIED' }} - {{ decision.attributes|length == 1 ? decision.attributes|first : profiler_dump(decision.attributes) }} + + {% if decision.attributes|length == 1 %} + {{ decision.attributes|first }} + {% else %} + {{ profiler_dump(decision.attributes) }} + {% endif %} + {{ profiler_dump(decision.object) }} {% endfor %} From c56f547c7d9d81829bf85bfb4826992558e08556 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 24 Jan 2017 14:02:12 +0100 Subject: [PATCH 61/98] fix test --- src/Symfony/Component/VarDumper/Tests/CliDumperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 58dbffaa63bd5..90045958ae38b 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -289,7 +289,7 @@ public function testThrowingCaster() %sTemplate.php:%d: """ try {\\n \$this->display(\$context);\\n - } catch (Exception \$e) {\\n + } catch (%s \$e) {\\n """ } } From 83cad14612b39ee53a6e72f947770f68b6fc8d56 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 24 Jan 2017 11:10:56 +0100 Subject: [PATCH 62/98] [Debug] Remove $context arg from handleError(), preparing for PHP 7.2 --- src/Symfony/Component/Debug/ErrorHandler.php | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 8c664c54f9104..1e415604c9cc5 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -349,12 +349,10 @@ private function reRegister($prev) /** * Handles errors by filtering then logging them according to the configured bit fields. * - * @param int $type One of the E_* constants + * @param int $type One of the E_* constants * @param string $message * @param string $file * @param int $line - * @param array $context - * @param array $backtrace * * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself * @@ -362,7 +360,7 @@ private function reRegister($prev) * * @internal */ - public function handleError($type, $message, $file, $line, array $context, array $backtrace = null) + public function handleError($type, $message, $file, $line) { $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; $log = $this->loggedErrors & $type; @@ -372,8 +370,17 @@ public function handleError($type, $message, $file, $line, array $context, array if (!$type || (!$log && !$throw)) { return $type && $log; } + $scope = $this->scopedErrors & $type; - if (isset($context['GLOBALS']) && ($this->scopedErrors & $type)) { + if (4 < $numArgs = func_num_args()) { + $context = $scope ? func_get_arg(4) : array(); + $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM + } else { + $context = array(); + $backtrace = null; + } + + if (isset($context['GLOBALS']) && $scope) { $e = $context; // Whatever the signature of the method, unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 $context = $e; @@ -389,7 +396,7 @@ public function handleError($type, $message, $file, $line, array $context, array } if ($throw) { - if (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { + if ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { // Checking for class existence is a work around for https://bugs.php.net/42098 $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context); } else { @@ -420,7 +427,7 @@ public function handleError($type, $message, $file, $line, array $context, array $e = compact('type', 'file', 'line', 'level'); if ($type & $level) { - if ($this->scopedErrors & $type) { + if ($scope) { $e['scope_vars'] = $context; if ($trace) { $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT); From 2555f3151d2d8fd452d30ad5815b0e8c0bfd3372 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Jan 2017 13:11:45 +0100 Subject: [PATCH 63/98] [Debug] Workaround "null" $context --- src/Symfony/Component/Debug/ErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 1e415604c9cc5..78dfba19b1f2c 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -373,7 +373,7 @@ public function handleError($type, $message, $file, $line) $scope = $this->scopedErrors & $type; if (4 < $numArgs = func_num_args()) { - $context = $scope ? func_get_arg(4) : array(); + $context = $scope ? (func_get_arg(4) ?: array()) : array(); $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM } else { $context = array(); From 89e27240ab9a95ddc3d26280e7d480ea50d77b35 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Jan 2017 13:10:29 +0100 Subject: [PATCH 64/98] [DI] Fix defaults overriding empty strings in AutowirePass --- .../Compiler/AutowirePass.php | 6 ++++-- .../Tests/Compiler/AutowirePassTest.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index cd5b61b29052b..09a237caad099 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -95,8 +95,10 @@ private function completeDefinition($id, Definition $definition) throw new RuntimeException(sprintf('Unable to autowire argument index %d ($%s) for the service "%s". If this is an object, give it a type-hint. Otherwise, specify this argument\'s value explicitly.', $index, $parameter->name, $id)); } - // specifically pass the default value - $arguments[$index] = $parameter->getDefaultValue(); + if (!array_key_exists($index, $arguments)) { + // specifically pass the default value + $arguments[$index] = $parameter->getDefaultValue(); + } continue; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index c9445c01dc1b1..2d34cbff1d7c0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -443,6 +443,22 @@ public function testIgnoreServiceWithClassNotExisting() $this->assertTrue($container->hasDefinition('bar')); } + + public function testEmptyStringIsKept() + { + $container = new ContainerBuilder(); + + $container->register('a', __NAMESPACE__.'\A'); + $container->register('lille', __NAMESPACE__.'\Lille'); + $container->register('foo', __NAMESPACE__.'\MultipleArgumentsOptionalScalar') + ->setAutowired(true) + ->setArguments(array('', '')); + + $pass = new AutowirePass(); + $pass->process($container); + + $this->assertEquals(array(new Reference('a'), '', new Reference('lille')), $container->getDefinition('foo')->getArguments()); + } } class Foo From be52b390315e62787179b30a5d95f82519744309 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 20 Jan 2017 15:18:09 +0100 Subject: [PATCH 65/98] [PropertyAccess] Handle interfaces in the invalid argument exception --- .../PropertyAccess/PropertyAccessor.php | 2 +- .../Tests/Fixtures/TypeHinted.php | 21 +++++++++++++++++++ .../Tests/PropertyAccessorTest.php | 11 ++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index da0c5da93cdef..d7ccc46438675 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -246,7 +246,7 @@ public static function handleError($type, $message, $file, $line, $context) private static function throwInvalidArgumentException($message, $trace, $i) { if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file']) { - $pos = strpos($message, $delim = 'must be of the type ') ?: strpos($message, $delim = 'must be an instance of '); + $pos = strpos($message, $delim = 'must be of the type ') ?: (strpos($message, $delim = 'must be an instance of ') ?: strpos($message, $delim = 'must implement interface ')); $pos += strlen($delim); $type = $trace[$i]['args'][0]; $type = is_object($type) ? get_class($type) : gettype($type); diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php index ca4c5745ae06c..ce0f3d89aaa30 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php @@ -18,6 +18,11 @@ class TypeHinted { private $date; + /** + * @var \Countable + */ + private $countable; + public function setDate(\DateTime $date) { $this->date = $date; @@ -27,4 +32,20 @@ public function getDate() { return $this->date; } + + /** + * @return \Countable + */ + public function getCountable() + { + return $this->countable; + } + + /** + * @param \Countable $countable + */ + public function setCountable(\Countable $countable) + { + $this->countable = $countable; + } } diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 3f1ef1c040a6a..a7e142e878e86 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -554,4 +554,15 @@ public function testArrayNotBeeingOverwritten() $this->assertSame('baz', $this->propertyAccessor->getValue($object, 'publicAccessor[value2]')); $this->assertSame(array('value1' => 'foo', 'value2' => 'baz'), $object->getPublicAccessor()); } + + /** + * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException + * @expectedExceptionMessage Expected argument of type "Countable", "string" given + */ + public function testThrowTypeErrorWithInterface() + { + $object = new TypeHinted(); + + $this->propertyAccessor->setValue($object, 'countable', 'This is a string, \Countable expected.'); + } } From 428814b25ddd7b0bfbf56d0f4cc3879c3e9bc793 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 26 Jan 2017 11:48:39 +0100 Subject: [PATCH 66/98] clarify exception when no args are configured --- .../Component/DependencyInjection/Definition.php | 4 ++++ .../DependencyInjection/Tests/DefinitionTest.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 4f2ee304adad2..49e4e1b0e29c4 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -302,6 +302,10 @@ public function addArgument($argument) */ public function replaceArgument($index, $argument) { + if (0 === count($this->arguments)) { + throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); + } + if ($index < 0 || $index > count($this->arguments) - 1) { throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index 3439a5912384a..0d3cb8a000bfd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -232,6 +232,7 @@ public function testGetArgumentShouldCheckBounds() /** * @expectedException \OutOfBoundsException + * @expectedExceptionMessage The index "1" is not in the range [0, 0]. */ public function testReplaceArgumentShouldCheckBounds() { @@ -241,6 +242,16 @@ public function testReplaceArgumentShouldCheckBounds() $def->replaceArgument(1, 'bar'); } + /** + * @expectedException \OutOfBoundsException + * @expectedExceptionMessage Cannot replace arguments if none have been configured yet. + */ + public function testReplaceArgumentWithoutExistingArgumentsShouldCheckBounds() + { + $def = new Definition('stdClass'); + $def->replaceArgument(0, 'bar'); + } + public function testSetGetProperties() { $def = new Definition('stdClass'); From 1e3421d6f03325ef805f5d11c714982b70d6c06f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 27 Jan 2017 10:10:43 +0100 Subject: [PATCH 67/98] always check for all fields to be mapped --- .../Constraints/UniqueEntityValidatorTest.php | 17 +++++++++++++++++ .../Constraints/UniqueEntityValidator.php | 14 +++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 348b46ddaa75e..39a251c33d7bb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -244,6 +244,23 @@ public function testValidateUniquenessWithIgnoreNull() ->assertRaised(); } + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgnoreNullEnabled() + { + $constraint = new UniqueEntity(array( + 'message' => 'myMessage', + 'fields' => array('name', 'name2'), + 'em' => self::EM_NAME, + 'ignoreNull' => true, + )); + + $entity1 = new SingleIntIdEntity(1, null); + + $this->validator->validate($entity1, $constraint); + } + public function testValidateUniquenessWithValidCustomErrorPath() { $constraint = new UniqueEntity(array( diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index f4c8671abae9a..61aef64ed8059 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -85,12 +85,14 @@ public function validate($entity, Constraint $constraint) throw new ConstraintDefinitionException(sprintf('The field "%s" is not mapped by Doctrine, so it cannot be validated for uniqueness.', $fieldName)); } - $criteria[$fieldName] = $class->reflFields[$fieldName]->getValue($entity); + $fieldValue = $class->reflFields[$fieldName]->getValue($entity); - if ($constraint->ignoreNull && null === $criteria[$fieldName]) { - return; + if ($constraint->ignoreNull && null === $fieldValue) { + continue; } + $criteria[$fieldName] = $fieldValue; + if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) { /* Ensure the Proxy is initialized before using reflection to * read its identifiers. This is necessary because the wrapped @@ -100,6 +102,12 @@ public function validate($entity, Constraint $constraint) } } + // skip validation if there are no criteria (this can happen when the + // "ignoreNull" option is enabled and fields to be checked are null + if (empty($criteria)) { + return; + } + $repository = $em->getRepository(get_class($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); From bd0c206a32d6c4951c8bf02c23a1f3a1842797e6 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Fri, 27 Jan 2017 15:42:16 +0100 Subject: [PATCH 68/98] Add missing pieces in the upgrade guide to 3.0 --- UPGRADE-3.0.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 467c13e6448ca..7e48c1f98748e 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1,6 +1,35 @@ UPGRADE FROM 2.x to 3.0 ======================= +# Table of Contents + +- [ClassLoader](#classloader) +- [Config](#config) +- [Console](#console) +- [DependencyInjection](#dependencyinjection) +- [DoctrineBridge](#doctrinebridge) +- [DomCrawler](#domcrawler) +- [EventDispatcher](#eventdispatcher) +- [Form](#form) +- [FrameworkBundle](#frameworkbundle) +- [HttpFoundation](#httpfoundation) +- [HttpKernel](#httpkernel) +- [Locale](#locale) +- [Monolog Bridge](#monolog-bridge) +- [Process](#process) +- [PropertyAccess](#propertyaccess) +- [Routing](#routing) +- [Security](#security) +- [SecurityBundle](#securitybundle) +- [Serializer](#serializer) +- [Swiftmailer Bridge](#swiftmailer-bridge) +- [Translator](#translator) +- [Twig Bridge](#twig-bridge) +- [TwigBundle](#twigbundle) +- [Validator](#validator) +- [WebProfiler](#webprofiler) +- [Yaml](#yaml) + ### ClassLoader * The `UniversalClassLoader` class has been removed in favor of @@ -1131,3 +1160,10 @@ UPGRADE FROM 2.x to 3.0 * `Process::setStdin()` and `Process::getStdin()` have been removed. Use `Process::setInput()` and `Process::getInput()` that works the same way. * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types. + +### Monolog Bridge + + * `Symfony\Bridge\Monolog\Logger::emerg()` was removed. Use `emergency()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::crit()` was removed. Use `critical()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. From 531c6cc5ff6c32ac06e01b5f9b75dd79732f1f9b Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 15 Dec 2016 19:45:08 +0100 Subject: [PATCH 69/98] [HttpKernel] Fix Bundle name regression --- .../Component/HttpKernel/Bundle/Bundle.php | 4 ++- .../HttpKernel/Tests/Bundle/BundleTest.php | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 68e1157e4510b..8505bbbddd3f0 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -223,6 +223,8 @@ private function parseClassName() { $pos = strrpos(static::class, '\\'); $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos); - $this->name = false === $pos ? static::class : substr(static::class, $pos + 1); + if (null === $this->name) { + $this->name = false === $pos ? static::class : substr(static::class, $pos + 1); + } } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index 0b11f8253c8b6..a8b91453c672e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle; use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle; use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle; @@ -66,4 +67,33 @@ public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAs $bundle->setContainer($container); $bundle->registerCommands($application); } + + public function testBundleNameIsGuessedFromClass() + { + $bundle = new GuessedNameBundle(); + + $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); + $this->assertSame('GuessedNameBundle', $bundle->getName()); + } + + public function testBundleNameCanBeExplicitlyProvided() + { + $bundle = new NamedBundle(); + + $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); + $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); + $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); + } +} + +class NamedBundle extends Bundle +{ + public function __construct() + { + $this->name = 'ExplicitlyNamedBundle'; + } +} + +class GuessedNameBundle extends Bundle +{ } From 50373f3530e302f04508d4567f02cb968cad26a4 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 27 Jan 2017 19:52:37 +0100 Subject: [PATCH 70/98] [Console] Fix TableCell issues with decoration --- .../Component/Console/Helper/Table.php | 2 +- .../Console/Tests/Helper/TableTest.php | 45 +++++++++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 904c04b6822a7..289d1a11da457 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -518,7 +518,7 @@ private function getColumnWidth($column) foreach ($row as $i => $cell) { if ($cell instanceof TableCell) { - $textLength = strlen($cell); + $textLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); if ($textLength > 0) { $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan())); foreach ($contentColumns as $position => $content) { diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index a691405c6b30f..583777b3ca7f8 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -35,9 +35,9 @@ protected function tearDown() /** * @dataProvider testRenderProvider */ - public function testRender($headers, $rows, $style, $expected) + public function testRender($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setRows($rows) @@ -51,9 +51,9 @@ public function testRender($headers, $rows, $style, $expected) /** * @dataProvider testRenderProvider */ - public function testRenderAddRows($headers, $rows, $style, $expected) + public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->addRows($rows) @@ -67,9 +67,9 @@ public function testRenderAddRows($headers, $rows, $style, $expected) /** * @dataProvider testRenderProvider */ - public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected) + public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setStyle($style) @@ -485,6 +485,35 @@ public function testRenderProvider() TABLE ), + 'Coslpan and table cells with comment style' => array( + array( + new TableCell('Long Title', array('colspan' => 3)), + ), + array( + array( + new TableCell('9971-5-0210-0', array('colspan' => 3)), + ), + new TableSeparator(), + array( + 'Dante Alighieri', + 'J. R. R. Tolkien', + 'J. R. R', + ), + ), + 'default', + <<stream, StreamOutput::VERBOSITY_NORMAL, false); + return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); } protected function getOutputContent(StreamOutput $output) From 4b5930ca442a68434432de28bc6d1a83224a55e1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 16:19:36 -0800 Subject: [PATCH 71/98] fixed composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cdb4f684f4ace..d661f1b03e6ef 100644 --- a/composer.json +++ b/composer.json @@ -87,11 +87,11 @@ "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "symfony/phpunit-bridge": "~3.2", "egulias/email-validator": "~1.2,>=1.2.1", - "phpdocumentor/reflection": "^1.0.7" + "phpdocumentor/reflection": "^1.0.7", + "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { "phpdocumentor/reflection": "<1.0.7", - "sensio/framework-extra-bundle": "^3.0.2" }, "autoload": { "psr-4": { From 537b932302603865dd74aa18fa997338c7ed99c9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 16:27:58 -0800 Subject: [PATCH 72/98] fixed typo --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6e3588482abcf..cf80b321acf41 100644 --- a/composer.json +++ b/composer.json @@ -94,7 +94,7 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0", - "phpdocumentor/type-resolver": "<0.2.0", + "phpdocumentor/type-resolver": "<0.2.0" }, "provide": { "psr/cache-implementation": "1.0" From 137a7748d6b45ebd5b1e6b9e794e8cd4e746713f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 17:00:17 -0800 Subject: [PATCH 73/98] fixed typo --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d661f1b03e6ef..e1e29ddbbfe0d 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { - "phpdocumentor/reflection": "<1.0.7", + "phpdocumentor/reflection": "<1.0.7" }, "autoload": { "psr-4": { From dba3e75fb283e02ca4c0f8dae9c740d7c3b224ee Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 18:42:42 -0800 Subject: [PATCH 74/98] fixed composer dep --- src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index e0d0dbe5e8b51..b5a67e7669b9d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -28,7 +28,7 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/filesystem": "~2.8|~3.0", "symfony/finder": "~2.8|~3.0", - "symfony/routing": "~3.0.11|~3.1", + "symfony/routing": "~3.1.10", "symfony/security-core": "~2.8|~3.0", "symfony/security-csrf": "~2.8|~3.0", "symfony/stopwatch": "~2.8|~3.0", From c7593457816db80980b9f6234dd74edbfe3a0b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 10:04:09 +0100 Subject: [PATCH 75/98] [FrameworkBundle] Remove useless checks in descriptors --- .../Console/Descriptor/JsonDescriptor.php | 35 +++++----------- .../Console/Descriptor/MarkdownDescriptor.php | 24 ++++------- .../Console/Descriptor/TextDescriptor.php | 23 +++------- .../Console/Descriptor/XmlDescriptor.php | 42 +++++++------------ 4 files changed, 38 insertions(+), 86 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index d22ebcd181785..a6167b9a48aa9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -217,29 +217,18 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = 'public' => $definition->isPublic(), 'synthetic' => $definition->isSynthetic(), 'lazy' => $definition->isLazy(), + 'shared' => $definition->isShared(), + 'synchronized' => $definition->isSynchronized(false), + 'abstract' => $definition->isAbstract(), + 'autowire' => $definition->isAutowired(), + 'autowiring_types' => array(), + 'file' => $definition->getFile(), ); - if (method_exists($definition, 'isShared')) { - $data['shared'] = $definition->isShared(); + foreach ($definition->getAutowiringTypes() as $autowiringType) { + $data['autowiring_types'][] = $autowiringType; } - if (method_exists($definition, 'isSynchronized')) { - $data['synchronized'] = $definition->isSynchronized(false); - } - - $data['abstract'] = $definition->isAbstract(); - - if (method_exists($definition, 'isAutowired')) { - $data['autowire'] = $definition->isAutowired(); - - $data['autowiring_types'] = array(); - foreach ($definition->getAutowiringTypes() as $autowiringType) { - $data['autowiring_types'][] = $autowiringType; - } - } - - $data['file'] = $definition->getFile(); - if ($definition->getFactoryClass(false)) { $data['factory_class'] = $definition->getFactoryClass(false); } @@ -269,11 +258,9 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = if (!$omitTags) { $data['tags'] = array(); - if (count($definition->getTags())) { - foreach ($definition->getTags() as $tagName => $tagData) { - foreach ($tagData as $parameters) { - $data['tags'][] = array('name' => $tagName, 'parameters' => $parameters); - } + foreach ($definition->getTags() as $tagName => $tagData) { + foreach ($tagData as $parameters) { + $data['tags'][] = array('name' => $tagName, 'parameters' => $parameters); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 4795331d0f653..d9d3278842eff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -183,24 +183,14 @@ protected function describeContainerDefinition(Definition $definition, array $op ."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no') ."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no') ."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no') + ."\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no') + ."\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no') + ."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no') + ."\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no') ; - if (method_exists($definition, 'isShared')) { - $output .= "\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no'); - } - - if (method_exists($definition, 'isSynchronized')) { - $output .= "\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no'); - } - - $output .= "\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no'); - - if (method_exists($definition, 'isAutowired')) { - $output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no'); - - foreach ($definition->getAutowiringTypes() as $autowiringType) { - $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; - } + foreach ($definition->getAutowiringTypes() as $autowiringType) { + $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; } if ($definition->getFile()) { @@ -371,7 +361,7 @@ protected function describeCallable($callable, array $options = array()) */ private function formatRouterConfig(array $array) { - if (!count($array)) { + if (!$array) { return 'NONE'; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 4aa00a85dbb17..1b35f8c565fff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -255,8 +255,7 @@ protected function describeContainerDefinition(Definition $definition, array $op $tableRows[] = array('Service ID', isset($options['id']) ? $options['id'] : '-'); $tableRows[] = array('Class', $definition->getClass() ?: '-'); - $tags = $definition->getTags(); - if (count($tags)) { + if ($tags = $definition->getTags()) { $tagInformation = ''; foreach ($tags as $tagName => $tagData) { foreach ($tagData as $tagParameters) { @@ -281,24 +280,12 @@ protected function describeContainerDefinition(Definition $definition, array $op $tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no'); $tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no'); $tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no'); - - if (method_exists($definition, 'isSynchronized')) { - $tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no'); - } + $tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no'); $tableRows[] = array('Abstract', $definition->isAbstract() ? 'yes' : 'no'); + $tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no'); - if (method_exists($definition, 'isAutowired')) { - $tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no'); - - $autowiringTypes = $definition->getAutowiringTypes(); - if (count($autowiringTypes)) { - $autowiringTypesInformation = implode(', ', $autowiringTypes); - } else { - $autowiringTypesInformation = '-'; - } - - $tableRows[] = array('Autowiring Types', $autowiringTypesInformation); - } + $autowiringTypes = $definition->getAutowiringTypes(); + $tableRows[] = array('Autowiring Types', $autowiringTypes ? implode(', ', $autowiringTypes) : '-'); if ($definition->getFile()) { $tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 62fb688e3c06f..0f0533573d4c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -187,7 +187,7 @@ private function getRouteDocument(Route $route, $name = null) $methodXML->appendChild(new \DOMText($method)); } - if (count($route->getDefaults())) { + if ($route->getDefaults()) { $routeXML->appendChild($defaultsXML = $dom->createElement('defaults')); foreach ($route->getDefaults() as $attribute => $value) { $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); @@ -198,7 +198,7 @@ private function getRouteDocument(Route $route, $name = null) $requirements = $route->getRequirements(); unset($requirements['_scheme'], $requirements['_method']); - if (count($requirements)) { + if ($requirements) { $routeXML->appendChild($requirementsXML = $dom->createElement('requirements')); foreach ($requirements as $attribute => $pattern) { $requirementsXML->appendChild($requirementXML = $dom->createElement('requirement')); @@ -207,7 +207,7 @@ private function getRouteDocument(Route $route, $name = null) } } - if (count($route->getOptions())) { + if ($route->getOptions()) { $routeXML->appendChild($optionsXML = $dom->createElement('options')); foreach ($route->getOptions() as $name => $value) { $optionsXML->appendChild($optionXML = $dom->createElement('option')); @@ -331,18 +331,16 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('class', $definition->getClass()); - if (method_exists($definition, 'getFactoryMethod')) { - if ($definition->getFactoryClass(false)) { - $serviceXML->setAttribute('factory-class', $definition->getFactoryClass(false)); - } + if ($definition->getFactoryClass(false)) { + $serviceXML->setAttribute('factory-class', $definition->getFactoryClass(false)); + } - if ($definition->getFactoryService(false)) { - $serviceXML->setAttribute('factory-service', $definition->getFactoryService(false)); - } + if ($definition->getFactoryService(false)) { + $serviceXML->setAttribute('factory-service', $definition->getFactoryService(false)); + } - if ($definition->getFactoryMethod(false)) { - $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod(false)); - } + if ($definition->getFactoryMethod(false)) { + $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod(false)); } if ($factory = $definition->getFactory()) { @@ -366,24 +364,14 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false'); $serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false'); $serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false'); - if (method_exists($definition, 'isShared')) { - $serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false'); - } - if (method_exists($definition, 'isSynchronized')) { - $serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false'); - } + $serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false'); + $serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false'); $serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false'); - - if (method_exists($definition, 'isAutowired')) { - $serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false'); - } - + $serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false'); $serviceXML->setAttribute('file', $definition->getFile()); if (!$omitTags) { - $tags = $definition->getTags(); - - if (count($tags) > 0) { + if ($tags = $definition->getTags()) { $serviceXML->appendChild($tagsXML = $dom->createElement('tags')); foreach ($tags as $tagName => $tagData) { foreach ($tagData as $parameters) { From 2bc4d3b2c17d53a1f8db6945109811373151250c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 28 Jan 2017 17:23:55 +0100 Subject: [PATCH 76/98] [TwigBundle] Fix the name of the cache warming test class --- .../Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index b51e619a9d285..5c4126cfe7233 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -17,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\TwigBundle\TwigBundle; -class NewCacheWamingTest extends \PHPUnit_Framework_TestCase +class CacheWarmingTest extends \PHPUnit_Framework_TestCase { public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable() { From b715a36932eb687d7025708a46ce2ef643db486b Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sun, 29 Jan 2017 20:47:08 +0100 Subject: [PATCH 77/98] [Console] SfStyleTest: Remove COLUMN env on tearDown --- src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php index 3338f4b055cc4..92d9d92c7a089 100644 --- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php @@ -31,6 +31,7 @@ protected function setUp() protected function tearDown() { + putenv('COLUMNS'); $this->command = null; $this->tester = null; } From f19788dd2ec1581beefec8c5d25a75f0e8c083c5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Jan 2017 15:00:07 +0100 Subject: [PATCH 78/98] ignore invalid cookies expires date format --- src/Symfony/Component/BrowserKit/Cookie.php | 2 -- src/Symfony/Component/BrowserKit/Tests/CookieTest.php | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 7e855bf351dad..42f184d532e02 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -213,8 +213,6 @@ private static function parseDate($dateValue) if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) { return $date->format('U'); } - - throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue)); } /** diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 5a724333d350f..4722de6d7b04c 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -88,10 +88,11 @@ public function testFromStringThrowsAnExceptionIfCookieIsNotValid() Cookie::fromString('foo'); } - public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid() + public function testFromStringIgnoresInvalidExpiresDate() { - $this->setExpectedException('InvalidArgumentException'); - Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + $cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + + $this->assertFalse($cookie->isExpired()); } public function testFromStringThrowsAnExceptionIfUrlIsNotValid() From f9f862f6af2cd46279751d39b2571dae2ef49545 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Mon, 30 Jan 2017 15:13:32 +0100 Subject: [PATCH 79/98] Update DebugHandlersListener.php --- .../HttpKernel/EventListener/DebugHandlersListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index ef2b17ff63ec1..29e1725adc672 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -137,7 +137,7 @@ public static function getSubscribedEvents() { $events = array(KernelEvents::REQUEST => array('configure', 2048)); - if ('cli' === php_sapi_name() && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { + if ('cli' === PHP_SAPI && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { $events[ConsoleEvents::COMMAND] = array('configure', 2048); } From 5cd7931c24ad9ad0794440c106271a5bb8d4551b Mon Sep 17 00:00:00 2001 From: Josip Kruslin Date: Sun, 29 Jan 2017 12:09:34 +0100 Subject: [PATCH 80/98] [validator] Updated croatian translation --- .../Resources/translations/validators.hr.xlf | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index a11e825ccadad..8c62d899fdaec 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -278,6 +278,42 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Ova vrijednost ne bi trebala biti {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer slike je prevelik ({{ ratio }}). Dozvoljeni maksimalni omjer je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer slike je premali ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je orijentirana horizontalno ({{ width }}x{{ height }}px). Horizontalno orijentirane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je orijentirana vertikalno ({{ width }}x{{ height }}px). Vertikalno orijentirane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Poslužitelj nije mogao biti razriješen. + + + This value does not match the expected {{ charset }} charset. + Znakovne oznake vrijednosti ne odgovaraju očekivanom {{ charset }} skupu. + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan poslovni identifikacijski broj (BIC). + From 0425e0549bbea67714b48218b615516253db065c Mon Sep 17 00:00:00 2001 From: Guilhem N Date: Sat, 21 Jan 2017 21:06:56 +0100 Subject: [PATCH 81/98] [FrameworkBundle] Execute the PhpDocExtractor earlier --- .../Resources/config/property_info.xml | 2 +- .../Tests/Functional/PropertyInfoTest.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml index 33a0a661f8991..8f6a7c9e31bed 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml @@ -15,7 +15,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php new file mode 100644 index 0000000000000..899de60ca0b1c --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; + +use Symfony\Component\PropertyInfo\Type; + +class PropertyInfoTest extends WebTestCase +{ + public function testPhpDocPriority() + { + static::bootKernel(array('test_case' => 'Serializer')); + $container = static::$kernel->getContainer(); + + $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes(Dummy::class, 'codes')); + } +} + +class Dummy +{ + /** + * @param int[] $codes + */ + public function setCodes(array $codes) + { + } +} From ee4b3e2712c5eeb456f9697b8c9e27309c3d8b18 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 31 Jan 2017 16:58:35 +0100 Subject: [PATCH 82/98] [Console] Fix too strict test --- .../Component/Console/Tests/Helper/ProcessHelperTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php index 1dcddf8badd49..b0d7f9c2f6f4c 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Process\Process; +use Symfony\Component\Process\ProcessBuilder; class ProcessHelperTest extends \PHPUnit_Framework_TestCase { @@ -83,9 +84,9 @@ public function provideCommandsAndOutput() EOT; $errorMessage = 'An error occurred'; - if ('\\' === DIRECTORY_SEPARATOR) { - $successOutputProcessDebug = str_replace("'", '"', $successOutputProcessDebug); - } + $args = new ProcessBuilder(array('php', '-r', 'echo 42;')); + $args = $args->getProcess()->getCommandLine(); + $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); return array( array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null), From 24243ace895933b2342f4f1bb85befa23ce05893 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 1 Feb 2017 10:44:58 +0100 Subject: [PATCH 83/98] add missing functional Serializer test case --- .../Tests/Functional/PropertyInfoTest.php | 2 +- .../Tests/Functional/app/Serializer/bundles.php | 16 ++++++++++++++++ .../Tests/Functional/app/Serializer/config.yml | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php index 899de60ca0b1c..c02a6b84e519c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -20,7 +20,7 @@ public function testPhpDocPriority() static::bootKernel(array('test_case' => 'Serializer')); $container = static::$kernel->getContainer(); - $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes(Dummy::class, 'codes')); + $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes('Symfony\Bundle\FrameworkBundle\Tests\Functional\Dummy', 'codes')); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php new file mode 100644 index 0000000000000..144db90236034 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; + +return array( + new FrameworkBundle(), +); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml new file mode 100644 index 0000000000000..cac135c315d00 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml @@ -0,0 +1,6 @@ +imports: + - { resource: ../config/default.yml } + +framework: + serializer: { enabled: true } + property_info: { enabled: true } From 89e0088c577a0891b7c623e369644afd41246f46 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 1 Feb 2017 13:47:47 +0100 Subject: [PATCH 84/98] Enable dump() in autoload-dev --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 2d7b451159758..c88ca4563c73e 100644 --- a/composer.json +++ b/composer.json @@ -101,6 +101,9 @@ "**/Tests/" ] }, + "autoload-dev": { + "files": [ "src/Symfony/Component/VarDumper/Resources/functions/dump.php" ] + }, "minimum-stability": "dev", "extra": { "branch-alias": { From 0cd8bf82bcfa7520aceebd2a5643ae652c51a008 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Tue, 31 Jan 2017 20:08:13 -0500 Subject: [PATCH 85/98] Remove dead code --- .../Doctrine/Form/DoctrineOrmExtension.php | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php index ed8e0a793444c..fe86b103cbb34 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php @@ -14,38 +14,20 @@ use Doctrine\Common\Persistence\ManagerRegistry; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractExtension; -use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; -use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; -use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory; -use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator; -use Symfony\Component\PropertyAccess\PropertyAccess; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; class DoctrineOrmExtension extends AbstractExtension { protected $registry; - /** - * @var PropertyAccessorInterface - */ - private $propertyAccessor; - - /** - * @var ChoiceListFactoryInterface - */ - private $choiceListFactory; - - public function __construct(ManagerRegistry $registry, PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null) + public function __construct(ManagerRegistry $registry) { $this->registry = $registry; - $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); - $this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor)); } protected function loadTypes() { return array( - new EntityType($this->registry, $this->propertyAccessor, $this->choiceListFactory), + new EntityType($this->registry), ); } From 08dd70b507837e9071e245d95c2c50e3dab9849a Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Wed, 1 Feb 2017 19:43:31 +0100 Subject: [PATCH 86/98] [FrameworkBundle][Console] JsonDescriptor: Respect original output --- .../Tests/Fixtures/Descriptor/builder_1_public.json | 4 +--- .../Fixtures/Descriptor/builder_1_services.json | 8 ++------ .../Tests/Fixtures/Descriptor/builder_1_tag1.json | 12 +++--------- .../Tests/Fixtures/Descriptor/definition_1.json | 4 +--- .../Tests/Fixtures/Descriptor/definition_2.json | 4 +--- .../Tests/Fixtures/Descriptor/route_2.json | 4 +--- .../Fixtures/Descriptor/route_collection_1.json | 4 +--- 7 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 047f4e8c16a48..5c2038df42c91 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -11,9 +11,7 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index 3397fd67acd6e..6dc56b3e2335b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -11,9 +11,7 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] }, "definition_2": { "class": "Full\\Qualified\\Class2", @@ -42,9 +40,7 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index 53bf114e81e04..af2c1044d0ed0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -27,17 +27,11 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } }, - "aliases": [ - - ], - "services": [ - - ] + "aliases": [], + "services": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json index 8de781dfc45a5..c15b4a6d29060 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json @@ -9,7 +9,5 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json index 9d58434c17e1b..62bcac9031f60 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json @@ -25,9 +25,7 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json index d34b3a77aec6e..58caf26d537e7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json @@ -6,9 +6,7 @@ "scheme": "http|https", "method": "PUT|POST", "class": "Symfony\\Component\\Routing\\Route", - "defaults": [ - - ], + "defaults": [], "requirements": "NO CUSTOM", "options": { "compiler_class": "Symfony\\Component\\Routing\\RouteCompiler", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json index 7170953f5fee7..350bffdb3a9c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json @@ -27,9 +27,7 @@ "scheme": "http|https", "method": "PUT|POST", "class": "Symfony\\Component\\Routing\\Route", - "defaults": [ - - ], + "defaults": [], "requirements": "NO CUSTOM", "options": { "compiler_class": "Symfony\\Component\\Routing\\RouteCompiler", From 8e6cfa0cefb5aa575206371cee9a86e0f129b136 Mon Sep 17 00:00:00 2001 From: Pavel Batanov Date: Thu, 2 Feb 2017 08:03:53 +0300 Subject: [PATCH 87/98] Fix phpDoc typo --- src/Symfony/Component/PropertyAccess/PropertyAccess.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccess.php b/src/Symfony/Component/PropertyAccess/PropertyAccess.php index 21b926e8282d4..8d36db2666539 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccess.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccess.php @@ -31,7 +31,7 @@ public static function createPropertyAccessor() /** * Creates a property accessor builder. * - * @return PropertyAccessor + * @return PropertyAccessorBuilder */ public static function createPropertyAccessorBuilder() { From b46276e9b240acd510a04db7fea27dca921e679a Mon Sep 17 00:00:00 2001 From: Pascal Hofmann Date: Wed, 1 Feb 2017 16:02:20 +0100 Subject: [PATCH 88/98] Add HEADER_FORWARDED to setTrustedHeaderName docs --- src/Symfony/Component/HttpFoundation/Request.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index e63ee755bb87f..697bc6c3c3e13 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -596,6 +596,7 @@ public static function getTrustedHosts() * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost()) * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort()) * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure()) + * * Request::HEADER_FORWARDED: defaults to Forwarded (see RFC 7239) * * Setting an empty value allows to disable the trusted header for the given key. * From 3779f3fbb98db5fd1647fa8e2af84a05adb1c7a0 Mon Sep 17 00:00:00 2001 From: GuillaumeVerdon Date: Wed, 1 Feb 2017 10:32:26 +0100 Subject: [PATCH 89/98] [Process] Non ASCII characters disappearing during the escapeshellarg --- src/Symfony/Component/Process/ProcessUtils.php | 2 +- src/Symfony/Component/Process/Tests/ProcessUtilsTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/ProcessUtils.php b/src/Symfony/Component/Process/ProcessUtils.php index 0bd2f6b772f6f..c0fd9c12dba5a 100644 --- a/src/Symfony/Component/Process/ProcessUtils.php +++ b/src/Symfony/Component/Process/ProcessUtils.php @@ -71,7 +71,7 @@ public static function escapeArgument($argument) return $escapedArgument; } - return escapeshellarg($argument); + return "'".str_replace("'", "'\\''", $argument)."'"; } /** diff --git a/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php b/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php index e6564cde5ba6d..0f554b6151801 100644 --- a/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php @@ -43,6 +43,7 @@ public function dataArguments() array("'<|>\" \"'\\''f'", '<|>" "\'f'), array("''", ''), array("'with\\trailingbs\\'", 'with\trailingbs\\'), + array("'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'), ); } } From bf71776e20dc85dd148904a1c319dbf9d6f8ec59 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 2 Feb 2017 18:43:33 +0100 Subject: [PATCH 90/98] [FrameworkBundle][Console] JsonDescriptor: Respect original output --- .../Fixtures/Descriptor/builder_1_public.json | 6 +- .../Descriptor/builder_1_services.json | 12 ++-- .../Fixtures/Descriptor/builder_1_tag1.json | 6 +- .../Fixtures/Descriptor/builder_1_tags.json | 12 ++-- .../Fixtures/Descriptor/definition_1.json | 6 +- .../Fixtures/Descriptor/definition_2.json | 6 +- ...acy_synchronized_service_definition_1.json | 28 ++++---- ...acy_synchronized_service_definition_2.json | 64 +++++++++---------- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 571afc2d16f6e..4ce716e640d2e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -9,12 +9,12 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index df9c767c2c7ea..e979c42f041cc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -9,12 +9,12 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] }, "definition_2": { "class": "Full\\Qualified\\Class2", @@ -25,6 +25,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -46,9 +48,7 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index 766f6be6d1114..e0aa26b6708c6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -9,6 +9,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -30,9 +32,7 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } }, "aliases": [], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json index b1b1fa81485a9..736b099f7d430 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json @@ -9,11 +9,11 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", - "factory_method": "get", - "autowire": false, - "autowiring_types": [] + "factory_method": "get" } ], "tag2": [ @@ -26,11 +26,11 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", - "factory_method": "get", - "autowire": false, - "autowiring_types": [] + "factory_method": "get" } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json index d25bf1d7f4b81..0056b4353abf3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json @@ -7,10 +7,10 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json index 127614f071ec0..1b465f270e2e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json @@ -7,6 +7,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -28,7 +30,5 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json index 06292f2c2f89f..730b81f3a87d0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json @@ -1,16 +1,16 @@ { - "class": "Full\\Qualified\\Class1", - "scope": "container", - "public": true, - "synthetic": false, - "lazy": true, - "shared": true, - "synchronized": true, - "abstract": true, - "file": null, - "factory_class": "Full\\Qualified\\FactoryClass", - "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "class": "Full\\Qualified\\Class1", + "scope": "container", + "public": true, + "synthetic": false, + "lazy": true, + "shared": true, + "synchronized": true, + "abstract": true, + "autowire": false, + "autowiring_types": [], + "file": null, + "factory_class": "Full\\Qualified\\FactoryClass", + "factory_method": "get", + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json index 9e98bdd2183aa..1b465f270e2e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json @@ -1,34 +1,34 @@ { - "class": "Full\\Qualified\\Class2", - "scope": "container", - "public": false, - "synthetic": true, - "lazy": false, - "shared": true, - "synchronized": false, - "abstract": false, - "file": "\/path\/to\/file", - "factory_service": "factory.service", - "factory_method": "get", - "tags": [ - { - "name": "tag1", - "parameters": { - "attr1": "val1", - "attr2": "val2" - } - }, - { - "name": "tag1", - "parameters": { - "attr3": "val3" - } - }, - { - "name": "tag2", - "parameters": [] - } - ], - "autowire": false, - "autowiring_types": [] + "class": "Full\\Qualified\\Class2", + "scope": "container", + "public": false, + "synthetic": true, + "lazy": false, + "shared": true, + "synchronized": false, + "abstract": false, + "autowire": false, + "autowiring_types": [], + "file": "\/path\/to\/file", + "factory_service": "factory.service", + "factory_method": "get", + "tags": [ + { + "name": "tag1", + "parameters": { + "attr1": "val1", + "attr2": "val2" + } + }, + { + "name": "tag1", + "parameters": { + "attr3": "val3" + } + }, + { + "name": "tag2", + "parameters": [] + } + ] } From 78c0ec5c136e7a7a4b905256910f71e9312207f7 Mon Sep 17 00:00:00 2001 From: Robin Lehrmann Date: Fri, 20 Jan 2017 14:40:15 +0100 Subject: [PATCH 91/98] [FrameworkBundle] fixed custom domain for translations in php templates --- .../Resources/views/translation.html.php | 16 +++++ .../Tests/Translation/PhpExtractorTest.php | 37 ++++++---- .../Translation/PhpExtractor.php | 67 +++++++++++++++++-- 3 files changed, 102 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php index c0ae6ec5c6604..cb3c763f8f3c8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php @@ -31,3 +31,19 @@ 10, array('%count%' => 10) ) ?> + +trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?> + +trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?> + +trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?> + +trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?> + +transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> + +transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> + +trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> +transChoice('msg1', 10 + 1, [], 'not_messages'); ?> +transChoice('msg2', intval(4.5), [], 'not_messages'); ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php index 420d2f2d71dd3..e8c56ee4d5e52 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php @@ -39,18 +39,31 @@ public function testExtraction($resource) nowdoc key with whitespace and nonescaped \$\n sequences EOF; // Assert - $expectedCatalogue = array('messages' => array( - 'single-quoted key' => 'prefixsingle-quoted key', - 'double-quoted key' => 'prefixdouble-quoted key', - 'heredoc key' => 'prefixheredoc key', - 'nowdoc key' => 'prefixnowdoc key', - "double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences", - 'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences', - 'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"', - $expectedHeredoc => 'prefix'.$expectedHeredoc, - $expectedNowdoc => 'prefix'.$expectedNowdoc, - '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - )); + $expectedCatalogue = array( + 'messages' => array( + 'single-quoted key' => 'prefixsingle-quoted key', + 'double-quoted key' => 'prefixdouble-quoted key', + 'heredoc key' => 'prefixheredoc key', + 'nowdoc key' => 'prefixnowdoc key', + "double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences", + 'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences', + 'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"', + $expectedHeredoc => 'prefix'.$expectedHeredoc, + $expectedNowdoc => 'prefix'.$expectedNowdoc, + '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', + ), + 'not_messages' => array( + 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', + 'other-domain-test-no-params-long-array' => 'prefixother-domain-test-no-params-long-array', + 'other-domain-test-params-short-array' => 'prefixother-domain-test-params-short-array', + 'other-domain-test-params-long-array' => 'prefixother-domain-test-params-long-array', + 'other-domain-test-trans-choice-short-array-%count%' => 'prefixother-domain-test-trans-choice-short-array-%count%', + 'other-domain-test-trans-choice-long-array-%count%' => 'prefixother-domain-test-trans-choice-long-array-%count%', + 'typecast' => 'prefixtypecast', + 'msg1' => 'prefixmsg1', + 'msg2' => 'prefixmsg2', + ), + ); $actualCatalogue = $catalogue->all(); $this->assertEquals($expectedCatalogue, $actualCatalogue); diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index cf7f3c5769bf2..97c94fdd14bf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -24,6 +24,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { const MESSAGE_TOKEN = 300; + const METHOD_ARGUMENTS_TOKEN = 1000; + const DOMAIN_TOKEN = 1001; /** * Prefix for new found message. @@ -38,6 +40,28 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface * @var array */ protected $sequences = array( + array( + '->', + 'trans', + '(', + self::MESSAGE_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::DOMAIN_TOKEN, + ), + array( + '->', + 'transChoice', + '(', + self::MESSAGE_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::DOMAIN_TOKEN, + ), array( '->', 'trans', @@ -105,11 +129,32 @@ private function seekToNextRelevantToken(\Iterator $tokenIterator) } } + private function skipMethodArgument(\Iterator $tokenIterator) + { + $openBraces = 0; + + for (; $tokenIterator->valid(); $tokenIterator->next()) { + $t = $tokenIterator->current(); + + if ('[' === $t[0] || '(' === $t[0]) { + ++$openBraces; + } + + if (']' === $t[0] || ')' === $t[0]) { + --$openBraces; + } + + if ((0 === $openBraces && ',' === $t[0]) || (-1 === $openBraces && ')' === $t[0])) { + break; + } + } + } + /** * Extracts the message from the iterator while the tokens * match allowed message tokens. */ - private function getMessage(\Iterator $tokenIterator) + private function getValue(\Iterator $tokenIterator) { $message = ''; $docToken = ''; @@ -155,16 +200,26 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) for ($key = 0; $key < $tokenIterator->count(); ++$key) { foreach ($this->sequences as $sequence) { $message = ''; + $domain = 'messages'; $tokenIterator->seek($key); - foreach ($sequence as $item) { + foreach ($sequence as $sequenceKey => $item) { $this->seekToNextRelevantToken($tokenIterator); - if ($this->normalizeToken($tokenIterator->current()) == $item) { + if ($this->normalizeToken($tokenIterator->current()) === $item) { $tokenIterator->next(); continue; - } elseif (self::MESSAGE_TOKEN == $item) { - $message = $this->getMessage($tokenIterator); + } elseif (self::MESSAGE_TOKEN === $item) { + $message = $this->getValue($tokenIterator); + + if (count($sequence) === ($sequenceKey + 1)) { + break; + } + } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) { + $this->skipMethodArgument($tokenIterator); + } elseif (self::DOMAIN_TOKEN === $item) { + $domain = $this->getValue($tokenIterator); + break; } else { break; @@ -172,7 +227,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) } if ($message) { - $catalog->set($message, $this->prefix.$message); + $catalog->set($message, $this->prefix.$message, $domain); break; } } From 1e5707fed398ea972268823fcc2cb04e0847de39 Mon Sep 17 00:00:00 2001 From: Jay Klehr Date: Thu, 26 Jan 2017 23:50:33 -0700 Subject: [PATCH 92/98] Casting TableCell value to string. --- .../Component/Console/Helper/TableCell.php | 4 +++ .../Console/Tests/Helper/TableTest.php | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/Symfony/Component/Console/Helper/TableCell.php b/src/Symfony/Component/Console/Helper/TableCell.php index aa0d3180799ff..1b34774f26516 100644 --- a/src/Symfony/Component/Console/Helper/TableCell.php +++ b/src/Symfony/Component/Console/Helper/TableCell.php @@ -35,6 +35,10 @@ class TableCell */ public function __construct($value = '', array $options = array()) { + if (is_numeric($value) && !is_string($value)) { + $value = (string) $value; + } + $this->value = $value; // check option names diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index a691405c6b30f..4f37b8e21d110 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -509,6 +509,42 @@ public function testRenderMultiByte() | 1234 | +------+ +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericIntValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345)))); + $table->render(); + + $expected = +<<<'TABLE' ++-------+ +| 12345 | ++-------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericFloatValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345.01)))); + $table->render(); + + $expected = +<<<'TABLE' ++----------+ +| 12345.01 | ++----------+ + TABLE; $this->assertEquals($expected, $this->getOutputContent($output)); From 44e598985006cb1c13b1d5f7778aeaae7ba795a2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 4 Feb 2017 09:30:23 +0100 Subject: [PATCH 93/98] [Cache] Fix class exists checks in PhpArrayAdapter --- src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index e4d8ad5eea318..c272ad0a4ae5f 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -373,15 +373,15 @@ private function generateItems(array $keys) */ public static function throwOnRequiredClass($class) { - $e = new \ReflectionException(sprintf('Class %s does not exist', $class)); + $e = new \ReflectionException("Class $class does not exist"); $trace = $e->getTrace(); $autoloadFrame = array( 'function' => 'spl_autoload_call', 'args' => array($class), ); - $i = array_search($autoloadFrame, $trace); + $i = 1 + array_search($autoloadFrame, $trace, true); - if (false !== $i++ && isset($trace[$i]['function']) && !isset($trace[$i]['class'])) { + if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) { switch ($trace[$i]['function']) { case 'get_class_methods': case 'get_class_vars': From ad8f18963ee92c0908806834c0cc466fcd8bd825 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 4 Feb 2017 08:36:32 -0800 Subject: [PATCH 94/98] fixed test name --- .../Component/Form/Tests/Extension/Core/Type/DateTypeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 282f43ee67358..aee6da34781fe 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -367,7 +367,7 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException * @expectedExceptionMessage The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong". */ - public function testThrowExceptionIfFormatDoesNotContainYearMonthOrDay() + public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTextWidget() { $this->factory->create('date', null, array( 'widget' => 'single_text', From 57f67e834bcef115a94f0910768c4fe2576d1cfc Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 4 Feb 2017 19:24:41 +0100 Subject: [PATCH 95/98] Remove 3.1 from PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 216a2ba4e5625..c9c3b75340557 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master / 2.7, 2.8, 3.1 or 3.2 +| Branch? | master / 2.7, 2.8 or 3.2 | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no From 9650b50436faa981f8d292d166b6874a3eea9317 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2017 13:27:13 +0100 Subject: [PATCH 96/98] [Form] fixed tests --- .../Component/Form/Tests/Extension/Core/Type/DateTypeTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 50636386b7343..8fcb06d1fb309 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -79,7 +79,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() public function testSubmitFromSingleTextDateTimeWithCustomFormat() { - $form = $this->factory->create('date', null, array( + $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array( 'model_timezone' => 'UTC', 'view_timezone' => 'UTC', 'widget' => 'single_text', @@ -379,7 +379,7 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() */ public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTextWidget() { - $this->factory->create('date', null, array( + $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array( 'widget' => 'single_text', 'format' => 'wrong', )); From 563a86356c5843efa238af9214ec8b3d3bdef474 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2017 14:15:13 +0100 Subject: [PATCH 97/98] updated CHANGELOG for 3.2.3 --- CHANGELOG-3.2.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CHANGELOG-3.2.md b/CHANGELOG-3.2.md index cea91c29475e1..2d191a0eadb05 100644 --- a/CHANGELOG-3.2.md +++ b/CHANGELOG-3.2.md @@ -7,6 +7,42 @@ in 3.2 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.2.0...v3.2.1 +* 3.2.3 (2017-02-06) + + * bug #21528 [Cache] Fix class exists checks in PhpArrayAdapter (nicolas-grekas) + * bug #20844 [Config] Fix checking cache for non existing meta file (hason) + * bug #21063 [Form] Fixed DateType format option for single text widget (HeahDude) + * bug #21430 Casting TableCell value to string. (jaydiablo) + * bug #21359 [FrameworkBundle] fixed custom domain for translations in php templates (robinlehrmann) + * bug #21485 [Process] Non ASCII characters disappearing during the escapeshellarg (GuillaumeVerdon) + * bug #21370 [FrameworkBundle] Execute the PhpDocExtractor earlier (GuilhemN) + * bug #21462 [BrowserKit] ignore invalid cookies expires date format (xabbuh) + * bug #21438 [Console] Fix TableCell issues with decoration (ogizanagi) + * bug #21431 [DoctrineBridge] always check for all fields to be mapped (xabbuh) + * bug #21360 [PropertyAccess] Handle interfaces in the invalid argument exception (fancyweb) + * bug #21403 [DI] Fix defaults overriding empty strings in AutowirePass (nicolas-grekas) + * bug #21401 [Debug] Workaround "null" $context (nicolas-grekas) + * bug #21381 [FrameworkBundle] Dont wire "annotations.cached_reader" before removing passes (nicolas-grekas) + * bug #21387 Fix double escaping of the decision attributes in the profiler (stof) + * bug #21372 [DependencyInjection] Fixed variadic method parameter in autowired classes (brainexe) + * bug #21338 [Cache] Fix tags expiration (nicolas-grekas) + * bug #21333 [HttpKernel] Fix ArgumentValueResolver for arguments default null (chalasr) + * bug #20871 [HttpKernel] Give higher priority to adding request formats (akeeman) + * bug #21332 [PropertyInfo] Don't try to access a property thru a static method (dunglas) + * bug #21336 [PhpUnit] Blacklist DeprecationErrorHandler in stack traces (nicolas-grekas) + * bug #21331 [PropertyInfo] Exclude static methods form properties guessing (dunglas) + * bug #21280 [Workflow] Fixed support of multiple transitions with the same name. (lyrixx) + * bug #21271 [Workflow] Added new validator to make sure each place has unique translation names (Nyholm) + * bug #21323 [Cache] [PdoAdapter] Fix MySQL 1170 error (blob as primary key) (akeeman) + * bug #21318 Don't add csp-headers if none are required (arjenm) + * bug #21291 [Ldap] Ldap username case fix (quentinus95) + * bug #21311 [Debug] Fix fatal error when changing ErrorHandler loggers if an exception is buffered (skalpa) + * bug #21288 [Doctrine Bridge] fix UniqueEntityValidator for composite object primary keys (dmaicher, HeahDude) + * bug #21285 [TwigBundle] do not lose already set method calls (xabbuh) + * bug #21279 #20411 fix Yaml parsing for very long quoted strings (RichardBradley) + * bug #21276 [Cache] Fix missing use statement in FilesystemAdapter (Lctrs) + * bug #21269 [Cache] Using strpbrk() instead of strcspn() is faster (nicolas-grekas) + * 3.2.2 (2017-01-12) * bug #21257 [Profiler][Form] Fix form profiler errors profiler_dump (ogizanagi) From d66d98eeb766735279701781537433f8e19f8553 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2017 14:15:19 +0100 Subject: [PATCH 98/98] updated VERSION for 3.2.3 --- 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 d5362b29ff0ef..6bc132aa2d3c7 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 = '3.2.3-DEV'; + const VERSION = '3.2.3'; const VERSION_ID = 30203; const MAJOR_VERSION = 3; const MINOR_VERSION = 2; const RELEASE_VERSION = 3; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2017'; const END_OF_LIFE = '01/2018';