From b36de366973e17bfe0bd132f6f6a88cf196cda3d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 30 Jun 2016 10:21:10 +0100 Subject: [PATCH 01/62] Fixed typos in the expectedException annotations --- src/Symfony/Component/Asset/Tests/PackagesTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Asset/Tests/PackagesTest.php b/src/Symfony/Component/Asset/Tests/PackagesTest.php index 81db37b996f2c..0a78a8b4fa6e4 100644 --- a/src/Symfony/Component/Asset/Tests/PackagesTest.php +++ b/src/Symfony/Component/Asset/Tests/PackagesTest.php @@ -14,8 +14,6 @@ use Symfony\Component\Asset\Package; use Symfony\Component\Asset\Packages; use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy; -use Symfony\Component\Asset\Exception\InvalidArgumentException; -use Symfony\Component\Asset\Exception\LogicException; class PackagesTest extends \PHPUnit_Framework_TestCase { @@ -57,7 +55,7 @@ public function testGetUrl() } /** - * @expectedException LogicException + * @expectedException \Symfony\Component\Asset\Exception\LogicException */ public function testNoDefaultPackage() { @@ -66,7 +64,7 @@ public function testNoDefaultPackage() } /** - * @expectedException InvalidArgumentException + * @expectedException \Symfony\Component\Asset\Exception\InvalidArgumentException */ public function testUndefinedPackage() { From f5749df2259b9885bbaef30c037004ff13f8f1bc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 Jun 2016 17:14:07 +0200 Subject: [PATCH 02/62] updated CHANGELOG for 2.7.15 --- CHANGELOG-2.7.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index 235f166764c2d..b4ec507066540 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,36 @@ 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.15 (2016-06-30) + + * bug #19217 [HttpKernel] Inline ValidateRequestListener logic into HttpKernel (nicolas-grekas) + * bug #18688 [HttpFoundation] Warning when request has both Forwarded and X-Forwarded-For (magnusnordlander) + * bug #19173 [Console] Decouple SymfonyStyle from TableCell (ro0NL) + * bug #17822 [WIP] [Form] fix `empty_data` option in expanded `ChoiceType` (HeahDude) + * bug #19134 Distinguish between first and subsequent progress bar displays (rquadling) + * bug #19061 [FORM] fix post_max_size_message translation (alt. 2) (David Badura) + * bug #19100 [Console] Fixed SymfonyQuestionHelper multi-choice with defaults (sstok) + * bug #18924 [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure (webmozart) + * bug #19138 [DomCrawler] No more exception on field name with strange format (guiled, fabpot) + * bug #18935 [Form] Consider a violation even if the form is not submitted (egeloen) + * bug #19127 [Form] Add exception to FormRenderer about non-unique block names (enumag) + * bug #19118 [Process] Fix pipes cleaning on Windows (nicolas-grekas) + * bug #19128 Avoid phpunit 5.4 warnings on getMock (2.7+) (iltar) + * bug #19114 [HttpKernel] Dont close the reponse stream in debug (nicolas-grekas) + * bug #19101 [Session] fix PDO transaction aborted under PostgreSQL (Tobion) + * bug #18501 [HttpFoundation] changed MERGE queries (hjkl) + * bug #19062 [HttpFoundation] Fix UPSERT for PgSql >= 9.5 (nicolas-grekas) + * bug #18548 [Form] minor fixes in DateTime transformers (HeahDude) + * bug #18732 [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't (nykopol) + * bug #19048 [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 (nicolas-grekas) + * bug #19038 Fix feature detection for IE (Alsciende) + * bug #18915 [DependencyInjection] force enabling the external XML entity loaders (xabbuh) + * bug #19020 [Form] Fixed collapsed choice attributes (HeahDude) + * bug #19028 [Yaml] properly count skipped comment lines (xabbuh) + * bug #17733 [Yaml] Fix wrong line number when comments are inserted in the middle of a block. (paradajozsef) + * bug #18911 Fixed singular of committee (peterrehm) + * bug #18971 Do not inject web debug toolbar on attachments (peterrehm) + * 2.7.14 (2016-06-06) * bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh) From 0d28ce434e7bbf5d68d09cb95dc878a6a0cb623e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 Jun 2016 17:14:17 +0200 Subject: [PATCH 03/62] update CONTRIBUTORS for 2.7.15 --- CONTRIBUTORS.md | 96 ++++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 37 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5fc732e26ff90..6f73ccb150471 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,8 +8,8 @@ Symfony is the result of the work of many people who made the code better - Nicolas Grekas (nicolas-grekas) - Bernhard Schussek (bschussek) - Tobias Schultze (tobion) - - Christophe Coevoet (stof) - Christian Flothmann (xabbuh) + - Christophe Coevoet (stof) - Jordi Boggiano (seldaek) - Victor Berchet (victor) - Johannes S (johannes) @@ -17,12 +17,12 @@ Symfony is the result of the work of many people who made the code better - Jakub Zalas (jakubzalas) - Ryan Weaver (weaverryan) - Javier Eguiluz (javier.eguiluz) - - Hugo Hamon (hhamon) - Kévin Dunglas (dunglas) + - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) - Pascal Borreli (pborreli) - - Joseph Bielawski (stloyd) - Wouter De Jong (wouterj) + - Joseph Bielawski (stloyd) - Romain Neutron (romain) - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) @@ -34,16 +34,16 @@ Symfony is the result of the work of many people who made the code better - Grégoire Pineau (lyrixx) - Eriksen Costa (eriksencosta) - Sarah Khalil (saro0h) + - Jules Pietri (heah) - Jonathan Wage (jwage) - - Diego Saint Esteben (dosten) - Maxime Steinhausser (ogizanagi) + - Diego Saint Esteben (dosten) - Alexandre Salomé (alexandresalome) - William Durand (couac) - - Jules Pietri (heah) - ornicar + - Francis Besset (francisbesset) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - - Francis Besset (francisbesset) - Bulat Shakirzyanov (avalanche123) - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) @@ -52,21 +52,21 @@ Symfony is the result of the work of many people who made the code better - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - - Kevin Bond (kbond) - Peter Rehm (rpet) + - Kevin Bond (kbond) - Gábor Egyed (1ed) + - Ener-Getick (energetick) - Michel Weimerskirch (mweimerskirch) - Eric Clemmons (ericclemmons) + - Iltar van der Berg (kjarli) - Andrej Hudec (pulzarraider) - Christian Raue + - Charles Sarrazin (csarrazi) - Matthias Pigulla (mpdude) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - Arnout Boks (aboks) - - Iltar van der Berg (kjarli) - - Charles Sarrazin (csarrazi) - - Ener-Getick (energetick) - Douglas Greenshields (shieldo) - Lee McDermott - Brandon Turner @@ -82,49 +82,50 @@ Symfony is the result of the work of many people who made the code better - Antoine Hérault (herzult) - Arnaud Le Blanc (arnaud-lb) - Jérôme Tamarelle (gromnan) + - Paráda József (paradajozsef) - Michal Piotrowski (eventhorizon) - Tim Nagel (merk) - - Paráda József (paradajozsef) - Brice BERNARD (brikou) + - Robin Chalas (chalas_r) - Alexander M. Turek (derrabus) - Dariusz Ruminski - marc.weistroff - Issei Murasawa (issei_m) - lenar - Włodzimierz Gajda (gajdaw) + - Konstantin Myakshin (koc) + - Baptiste Clavié (talus) - Alexander Schwenn (xelaris) - Florian Voutzinos (florianv) - - Konstantin Myakshin (koc) - Colin Frei - Adrien Brault (adrienbrault) - Joshua Thijssen - - Baptiste Clavié (talus) - Peter Kokot (maastermedia) - excelwebzone - Jacob Dreesen (jdreesen) + - Jáchym Toušek (enumag) - Jérémy DERUSSÉ (jderusse) - Vladimir Reznichenko (kalessil) + - Tomáš Votruba (tomas_votruba) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) + - Eric GELOEN (gelo) - David Buchmann (dbu) - - Tomáš Votruba (tomas_votruba) - - Jáchym Toušek - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) - - Eric GELOEN (gelo) - Stefano Sala (stefano.sala) - Juti Noppornpitak (shiroyuki) + - Titouan Galopin (tgalopin) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) + - Sebastiaan Stok (sstok) - Evgeniy (ewgraf) + - Tugdual Saunier (tucksaun) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - - Titouan Galopin (tgalopin) - Jérémie Augustin (jaugustin) - - Sebastiaan Stok (sstok) - - Tugdual Saunier (tucksaun) - Andréia Bohner (andreia) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) @@ -141,6 +142,7 @@ Symfony is the result of the work of many people who made the code better - Richard van Laak (rvanlaak) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) + - Javier Spagnoletti (phansys) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba @@ -150,7 +152,6 @@ Symfony is the result of the work of many people who made the code better - Daniel Wehner - Possum - Dorian Villet (gnutix) - - Javier Spagnoletti (phansys) - Richard Miller (mr_r_miller) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) @@ -179,6 +180,7 @@ Symfony is the result of the work of many people who made the code better - Sven Paulus (subsven) - Lars Strojny (lstrojny) - Rui Marinho (ruimarinho) + - Daniel Espendiller - Eugene Wissner - Julien Brochet (mewt) - Sergey Linnik (linniksa) @@ -212,9 +214,7 @@ Symfony is the result of the work of many people who made the code better - Kristen Gilden (kgilden) - Dawid Nowak - Pierre-Yves LEBECQ (pylebecq) - - Daniel Espendiller - Jakub Kucharovic (jkucharovic) - - Robin Chalas (chalas_r) - Eugene Leonovich (rybakit) - Filippo Tessarotto - Joseph Rouff (rouffj) @@ -238,6 +238,7 @@ Symfony is the result of the work of many people who made the code better - Roumen Damianoff (roumen) - Antonio J. García Lagar (ajgarlag) - Kim Hemsø Rasmussen (kimhemsoe) + - Christian Schmidt - Wouter Van Hecke - Peter Kruithof (pkruithof) - Michael Holm (hollo) @@ -245,6 +246,7 @@ Symfony is the result of the work of many people who made the code better - Hidde Wieringa (hiddewie) - Chris Smith (cs278) - Florian Klein (docteurklein) + - Oleg Voronkovich - Manuel Kiessling (manuelkiessling) - Daniel Wehner - Atsuhiro KUBO (iteman) @@ -294,7 +296,6 @@ Symfony is the result of the work of many people who made the code better - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) - - Christian Schmidt - François-Xavier de Guillebon (de-gui_f) - Damien Alexandre (damienalexandre) - Felix Labrecque @@ -322,6 +323,7 @@ Symfony is the result of the work of many people who made the code better - Endre Fejes - Tobias Naumann (tna) - Daniel Beyer + - Jhonny Lidfors (jhonne) - Shein Alexey - Baptiste Lafontaine - Joe Lencioni @@ -335,7 +337,6 @@ Symfony is the result of the work of many people who made the code better - Ivan Kurnosov - Xavier HAUSHERR - Albert Jessurum (ajessu) - - Oleg Voronkovich - Laszlo Korte - Pavel Batanov (scaytrase) - Miha Vrhovnik @@ -355,6 +356,7 @@ Symfony is the result of the work of many people who made the code better - Brian King - Michel Salib (michelsalib) - geoffrey + - Steffen Roßkamp - Valentin Jonovs (valentins-jonovs) - Jeanmonod David (jeanmonod) - Jan Schumann @@ -364,6 +366,7 @@ Symfony is the result of the work of many people who made the code better - Mihai Stancu - Olivier Dolbeau (odolbeau) - Jan Rosier (rosier) + - Magnus Nordlander (magnusnordlander) - vagrant - EdgarPE - Florian Pfitzer (marmelatze) @@ -379,6 +382,7 @@ Symfony is the result of the work of many people who made the code better - Christian Schmidt - Marek Štípek (maryo) - Marcin Sikoń (marphi) + - Roland Franssen (ro0) - Dominik Zogg (dominik.zogg) - Marek Pietrzak - Chad Sikorra (chadsikorra) @@ -390,6 +394,7 @@ Symfony is the result of the work of many people who made the code better - Zander Baldwin - Adam Harvey - Alex Bakhturin + - Alexander Obuhovich (aik099) - boombatower - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) @@ -412,10 +417,12 @@ Symfony is the result of the work of many people who made the code better - ondrowan - Barry vd. Heuvel (barryvdh) - Jerzy Zawadzki (jzawadzki) + - Théo FIDRY (theofidry) - Evan S Kaufman (evanskaufman) - mcben - Jérôme Vieilledent (lolautruche) - Maks Slesarenko + - Filip Procházka (fprochazka) - mmoreram - Markus Lanthaler (lanthaler) - Vicent Soria Durá (vicentgodella) @@ -440,7 +447,6 @@ Symfony is the result of the work of many people who made the code better - Benjamin Leveque (benji07) - Nate (frickenate) - jhonnyL - - Jhonny Lidfors (jhonne) - sasezaki - Dawid Pakuła (zulusx) - Florian Rey (nervo) @@ -503,6 +509,7 @@ Symfony is the result of the work of many people who made the code better - Maxime Douailin - Javier López (loalf) - Reinier Kip + - Geoffrey Brier (geoffrey-brier) - Dustin Dobervich (dustin10) - dantleech - Anne-Sophie Bachelard (annesophie) @@ -535,9 +542,11 @@ Symfony is the result of the work of many people who made the code better - Arturs Vonda - Sascha Grossenbacher - Szijarto Tamas + - David Badura (davidbadura) - Catalin Dan - Stephan Vock - Benjamin Zikarsky (bzikarsky) + - Anton Bakai - Simon Schick (simonsimcity) - redstar504 - Tristan Roussel @@ -556,7 +565,7 @@ Symfony is the result of the work of many people who made the code better - Richard van den Brand (ricbra) - develop - Mark Sonnabaum - - Alexander Obuhovich (aik099) + - Richard Quadling - jochenvdv - Arturas Smorgun (asarturas) - Alexander Volochnev (exelenz) @@ -573,6 +582,7 @@ Symfony is the result of the work of many people who made the code better - Baldur Rensch (brensch) - Vladyslav Petrovych - Alex Xandra Albert Sim + - Carson Full - Trent Steel (trsteel88) - Yuen-Chi Lian - Besnik Br @@ -589,6 +599,7 @@ Symfony is the result of the work of many people who made the code better - Leevi Graham (leevigraham) - Casper Valdemar Poulsen - Josiah (josiah) + - Joschi Kuphal - John Bohn (jbohn) - Marc Morera (mmoreram) - Andrew Hilobok (hilobok) @@ -618,7 +629,6 @@ Symfony is the result of the work of many people who made the code better - Adrien Lucas (adrienlucas) - James Michael DuPont - Tom Klingenberg - - Filip Procházka (fprochazka) - Christopher Hall (mythmakr) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) @@ -637,7 +647,6 @@ Symfony is the result of the work of many people who made the code better - Neil Ferreira - Nathanael Noblet (gnat) - Dmitry Parnas (parnas) - - Théo FIDRY (theofidry) - Paul LE CORRE - DQNEO - Emanuele Iannone @@ -652,7 +661,6 @@ Symfony is the result of the work of many people who made the code better - Matt Robinson (inanimatt) - Aleksey Podskrebyshev - Calin Mihai Pristavu - - Steffen Roßkamp - David Marín Carreño (davefx) - Jörn Lang (j.lang) - Omar Yepez (oyepez003) @@ -677,6 +685,7 @@ Symfony is the result of the work of many people who made the code better - Don Pinkster - Maksim Muruev - Emil Einarsson + - Thomas Landauer - Thibault Duplessis - Marc Abramowitz - Martijn Evers @@ -697,7 +706,6 @@ Symfony is the result of the work of many people who made the code better - David Lima - Jérôme Vasseur - Brunet Laurent (lbrunet) - - Magnus Nordlander (magnusnordlander) - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) @@ -709,6 +717,7 @@ Symfony is the result of the work of many people who made the code better - Raul Fraile (raulfraile) - sensio - Patrick Kaufmann + - Piotr Stankowski - Reece Fowell (reecefowell) - Mátyás Somfai (smatyas) - stefan.r @@ -728,6 +737,7 @@ Symfony is the result of the work of many people who made the code better - Pieter - Michael Tibben - Sander Marechal + - Andre Rømcke (andrerom) - Radosław Benkel - ttomor - Mei Gwilym (meigwilym) @@ -743,6 +753,7 @@ Symfony is the result of the work of many people who made the code better - Danilo Silva - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk + - Dennis Fridrich (dfridrich) - mcfedr (mcfedr) - hamza - dantleech @@ -752,6 +763,7 @@ Symfony is the result of the work of many people who made the code better - Guillaume Royer - Artem (digi) - boite + - MGDSoft - Vadim Tyukov (vatson) - Sortex - chispita @@ -804,10 +816,12 @@ Symfony is the result of the work of many people who made the code better - Benoit Garret - Thomas Royer (cydonia7) - DerManoMann + - Olaf Klischat - Jhonny Lidfors (jhonny) - Julien Bianchi (jubianchi) + - Robert Meijers - Marcin Chwedziak - - Roland Franssen (ro0) + - hjkl - Tony Cosentino (tony-co) - Rodrigo Díez Villamuera (rodrigodiez) - e-ivanov @@ -815,6 +829,7 @@ Symfony is the result of the work of many people who made the code better - Jeremy Bush - wizhippo - Viacheslav Sychov + - Carlos Ortega Huetos - rpg600 - Péter Buri (burci) - Davide Borsatto (davide.borsatto) @@ -834,6 +849,7 @@ Symfony is the result of the work of many people who made the code better - spdionis - Eduardo García Sanz (coma) - James Gilliland + - Rhodri Pugh (rodnaph) - David de Boer (ddeboer) - Gilles Doge (gido) - abulford @@ -855,7 +871,6 @@ Symfony is the result of the work of many people who made the code better - Juan Traverso - Philipp Strube - Christian Sciberras - - Anton Bakai - Clement Herreman (clemherreman) - Dan Ionut Dumitriu (danionut90) - Nyro (nyro) @@ -893,7 +908,6 @@ Symfony is the result of the work of many people who made the code better - azine - Dawid Sajdak - Ludek Stepan - - Geoffrey Brier - Aaron Stephens (astephens) - Craig Menning (cmenning) - Balázs Benyó (duplabe) @@ -917,6 +931,7 @@ Symfony is the result of the work of many people who made the code better - Cédric Lahouste (rapotor) - Samuel Vogel (samuelvogel) - Berat Doğan + - Juanmi Rodriguez Cerón - Anthony Ferrara - Klaas Cuvelier (kcuvelier) - Steve Frécinaux @@ -934,6 +949,7 @@ Symfony is the result of the work of many people who made the code better - Philip Frank - Lance McNearney - Giorgio Premi + - Ian Carroll - caponica - Matt Daum (daum) - Alberto Pirovano (geezmo) @@ -945,6 +961,7 @@ Symfony is the result of the work of many people who made the code better - Max Summe - WedgeSama - Felds Liscia + - Ahmed TAILOULOUTE (ahmedtai) - James Halsall (jaitsu) - Maxime Veber (nek-) - Sullivan SENECHAL @@ -968,6 +985,7 @@ Symfony is the result of the work of many people who made the code better - Max Romanovsky (maxromanovsky) - Mathieu Morlon - Daniel Tschinder + - Nykopol (nykopol) - Rafał Muszyński (rafmus90) - Timothy Anido (xanido) - Rick Prent @@ -1006,6 +1024,7 @@ Symfony is the result of the work of many people who made the code better - Konrad Mohrfeldt - Lance Chen - Andrey Astakhov (aast) + - Nikolay Labinskiy (e-moe) - kor3k kor3k (kor3k) - Stelian Mocanita (stelian) - Flavian (2much) @@ -1015,6 +1034,7 @@ Symfony is the result of the work of many people who made the code better - Hoffmann András - Olivier - pscheit + - Zdeněk Drahoš - Dan Harper - moldcraft - Ramon Kleiss (akathos) @@ -1137,6 +1157,7 @@ Symfony is the result of the work of many people who made the code better - Daan van Renterghem - Nicole Cordes - Bram Van der Sype (brammm) + - Guile (guile) - Julien Moulin (lizjulien) - Nikita Nefedov (nikita2206) - Mauro Foti (skler) @@ -1209,7 +1230,6 @@ Symfony is the result of the work of many people who made the code better - Haritz - Matthieu Prat - Grummfy - - Thomas Landauer - Filipe Guerra - Gerben Wijnja - Rowan Manning @@ -1260,6 +1280,7 @@ Symfony is the result of the work of many people who made the code better - Muriel (metalmumu) - Michael Pohlers (mick_the_big) - Cayetano Soriano Gallego (neoshadybeat) + - Jean Pasdeloup (pasdeloup) - Patrick McDougle (patrick-mcdougle) - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) @@ -1298,7 +1319,6 @@ Symfony is the result of the work of many people who made the code better - Mantas Urnieža - Cas - Dusan Kasan - - Carson Full - Myke79 - Brian Debuire - Piers Warmers @@ -1332,6 +1352,7 @@ Symfony is the result of the work of many people who made the code better - Andras Ratz - andreabreu98 - Michael Schneider + - Cédric Bertolini - n-aleha - Şəhriyar İmanov - Kaipi Yann @@ -1358,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better - Jon Cave - Sébastien HOUZE - Abdulkadir N. A. + - Ivan Menshykov - Yevgen Kovalienia - Lebnik - Sema @@ -1385,8 +1407,8 @@ Symfony is the result of the work of many people who made the code better - Oncle Tom - Christian Stocker - Dawid Nowak - - Richard Quadling - Karolis Daužickas + - Sergio Santoro - tirnanog06 - phc - Дмитрий Пацура @@ -1412,7 +1434,6 @@ Symfony is the result of the work of many people who made the code better - Loïc Vernet (coil) - Christoph Schaefer (cvschaefer) - Damon Jones (damon__jones) - - David Badura (davidbadura) - Daniel Londero (dlondero) - Sebastian Landwehr (dword123) - Adel ELHAIBA (eadel) @@ -1420,6 +1441,7 @@ Symfony is the result of the work of many people who made the code better - Elliot Anderson (elliot) - Sergey Zolotov (enleur) - Fabien D. (fabd) + - Carsten Eilers (fnc) - Sorin Gitlan (forapathy) - Yohan Giarelli (frequence-web) - Gerry Vandermaesen (gerryvdm) From ec1ff36e58b8809efd67bb03c40e39cdb7a80b13 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 Jun 2016 17:14:22 +0200 Subject: [PATCH 04/62] updated VERSION for 2.7.15 --- 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 26a6813e49dcb..e9e973260964b 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.15-DEV'; + const VERSION = '2.7.15'; const VERSION_ID = 20715; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 15; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 6cdb090dd05cd3f992ffdc64b34dee0d1e55ef68 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 Jun 2016 17:39:56 +0200 Subject: [PATCH 05/62] bumped Symfony version to 2.7.16 --- 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 e9e973260964b..6e4ca26219ee7 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.15'; - const VERSION_ID = 20715; + const VERSION = '2.7.16-DEV'; + const VERSION_ID = 20716; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 15; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 16; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From e0f1476bfe020b50bfb6d12d5df223d0b0c51e87 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 30 Jun 2016 18:28:54 +0200 Subject: [PATCH 06/62] bumped Symfony version to 2.8.9 --- 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 2032b56120a58..cd3b372388fe7 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.8'; - const VERSION_ID = 20808; + const VERSION = '2.8.9-DEV'; + const VERSION_ID = 20809; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 8; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 9; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From a3f75100bfe30d0584e89235c7b5cac2dcfa40be Mon Sep 17 00:00:00 2001 From: Jean Pasdeloup Date: Wed, 29 Jun 2016 10:49:46 +0200 Subject: [PATCH 07/62] [Security][Guard] check if session exist before using it --- .../AbstractFormLoginAuthenticator.php | 12 +- .../FormLoginAuthenticatorTest.php | 212 ++++++++++++++++++ 2 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index b3c6bd73a0a9b..6d6d14edb5d1d 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Guard\Authenticator; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -52,7 +53,10 @@ abstract protected function getDefaultSuccessRedirectUrl(); */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); + if ($request->getSession() instanceof SessionInterface) { + $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); + } + $url = $this->getLoginUrl(); return new RedirectResponse($url); @@ -69,9 +73,13 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { + $targetPath = null; + // if the user hit a secure page and start() was called, this was // the URL they were on, and probably where you want to redirect to - $targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path'); + if ($request->getSession() instanceof SessionInterface) { + $targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path'); + } if (!$targetPath) { $targetPath = $this->getDefaultSuccessRedirectUrl(); diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php new file mode 100644 index 0000000000000..3dbbf845c5226 --- /dev/null +++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -0,0 +1,212 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Tests\Authenticator; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator; + +/** + * @author Jean Pasdeloup + */ +class FormLoginAuthenticatorTest extends \PHPUnit_Framework_TestCase +{ + private $requestWithoutSession; + private $requestWithSession; + private $authenticator; + + const LOGIN_URL = 'http://login'; + const DEFAULT_SUCCESS_URL = 'http://defaultsuccess'; + const CUSTOM_SUCCESS_URL = 'http://customsuccess'; + + public function testAuthenticationFailureWithoutSession() + { + $failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithoutSession, new AuthenticationException()); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse); + $this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl()); + } + + public function testAuthenticationFailureWithSession() + { + $this->requestWithSession->getSession() + ->expects($this->once()) + ->method('set'); + + $failureResponse = $this->authenticator->onAuthenticationFailure($this->requestWithSession, new AuthenticationException()); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse); + $this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl()); + } + + public function testAuthenticationSuccessWithoutSession() + { + $token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface') + ->disableOriginalConstructor() + ->getMock(); + + $redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithoutSession, $token, 'providerkey'); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse); + $this->assertEquals(self::DEFAULT_SUCCESS_URL, $redirectResponse->getTargetUrl()); + } + + public function testAuthenticationSuccessWithSessionButEmpty() + { + $token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->requestWithSession->getSession() + ->expects($this->once()) + ->method('get') + ->will($this->returnValue(null)); + + $redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey'); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse); + $this->assertEquals(self::DEFAULT_SUCCESS_URL, $redirectResponse->getTargetUrl()); + } + + public function testAuthenticationSuccessWithSessionAndTarget() + { + $token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->requestWithSession->getSession() + ->expects($this->once()) + ->method('get') + ->will($this->returnValue(self::CUSTOM_SUCCESS_URL)); + + $redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey'); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $redirectResponse); + $this->assertEquals(self::CUSTOM_SUCCESS_URL, $redirectResponse->getTargetUrl()); + } + + public function testRememberMe() + { + $doSupport = $this->authenticator->supportsRememberMe(); + + $this->assertTrue($doSupport); + } + + public function testStartWithoutSession() + { + $failureResponse = $this->authenticator->start($this->requestWithoutSession, new AuthenticationException()); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse); + $this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl()); + } + + public function testStartWithSession() + { + $failureResponse = $this->authenticator->start($this->requestWithSession, new AuthenticationException()); + + $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $failureResponse); + $this->assertEquals(self::LOGIN_URL, $failureResponse->getTargetUrl()); + } + + protected function setUp() + { + $this->requestWithoutSession = new Request(array(), array(), array(), array(), array(), array()); + $this->requestWithSession = new Request(array(), array(), array(), array(), array(), array()); + + $session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->requestWithSession->setSession($session); + + $this->authenticator = new TestFormLoginAuthenticator(); + $this->authenticator + ->setLoginUrl(self::LOGIN_URL) + ->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL) + ; + } + + protected function tearDown() + { + $this->request = null; + $this->requestWithSession = null; + } +} + +class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator +{ + private $loginUrl; + private $defaultSuccessRedirectUrl; + + /** + * @param mixed $defaultSuccessRedirectUrl + * + * @return TestFormLoginAuthenticator + */ + public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl) + { + $this->defaultSuccessRedirectUrl = $defaultSuccessRedirectUrl; + + return $this; + } + + /** + * @param mixed $loginUrl + * + * @return TestFormLoginAuthenticator + */ + public function setLoginUrl($loginUrl) + { + $this->loginUrl = $loginUrl; + + return $this; + } + + /** + * {@inheritdoc} + */ + protected function getLoginUrl() + { + return $this->loginUrl; + } + + /** + * {@inheritdoc} + */ + protected function getDefaultSuccessRedirectUrl() + { + return $this->defaultSuccessRedirectUrl; + } + + /** + * {@inheritdoc} + */ + public function getCredentials(Request $request) + { + return 'credentials'; + } + + /** + * {@inheritdoc} + */ + public function getUser($credentials, UserProviderInterface $userProvider) + { + return $userProvider->loadUserByUsername($credentials); + } + + /** + * {@inheritdoc} + */ + public function checkCredentials($credentials, UserInterface $user) + { + return true; + } +} From dc130be43c76d2ab286a0e397f67f678dfb39dce Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 30 Jun 2016 20:05:08 +0200 Subject: [PATCH 08/62] [Console] Fix for block() padding formatting after #19189 Prevent future regression --- .../Component/Console/Style/SymfonyStyle.php | 14 ++++++++------ .../Style/SymfonyStyle/command/command_16.php | 15 +++++++++++++++ .../Style/SymfonyStyle/output/output_16.txt | 8 ++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 59c5bbf87ed9c..a9c57443427b3 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -410,9 +410,16 @@ private function createBlock($messages, $type = null, $style = null, $prefix = ' } } + $firstLineIndex = 0; + if ($padding && $this->isDecorated()) { + $firstLineIndex = 1; + array_unshift($lines, ''); + $lines[] = ''; + } + foreach ($lines as $i => &$line) { if (null !== $type) { - $line = 0 === $i ? $type.$line : $lineIndentation.$line; + $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line; } $line = $prefix.$line; @@ -423,11 +430,6 @@ private function createBlock($messages, $type = null, $style = null, $prefix = ' } } - if ($padding && $this->isDecorated()) { - array_unshift($lines, ''); - $lines[] = ''; - } - return $lines; } } diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php new file mode 100644 index 0000000000000..f21fc10d9c71d --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php @@ -0,0 +1,15 @@ +setDecorated(true); + $output = new SymfonyStyleWithForcedLineLength($input, $output); + $output->success( + 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', + 'TEST' + ); +}; diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt new file mode 100644 index 0000000000000..a0d180165b879 --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt @@ -0,0 +1,8 @@ + +  + [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore  + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo  + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.  + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum  +  + From ebbc7068f95a6cb0c8c8d6dc1397fa6c333911d1 Mon Sep 17 00:00:00 2001 From: Ben Oman Date: Sat, 25 Jun 2016 17:51:43 -0600 Subject: [PATCH 09/62] Fix for #19183 to add support for new PHP MongoDB extension in sessions. --- .../Storage/Handler/MongoDbSessionHandler.php | 68 +++++++-- .../Handler/MongoDbSessionHandlerTest.php | 132 ++++++++++++++---- 2 files changed, 162 insertions(+), 38 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index f1df25d0a629b..23bca61e6068b 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -61,15 +61,15 @@ class MongoDbSessionHandler implements \SessionHandlerInterface * If you use such an index, you can drop `gc_probability` to 0 since * no garbage-collection is required. * - * @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance - * @param array $options An associative array of field options + * @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance + * @param array $options An associative array of field options * * @throws \InvalidArgumentException When MongoClient or Mongo instance not provided * @throws \InvalidArgumentException When "database" or "collection" not provided */ public function __construct($mongo, array $options) { - if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { + if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { throw new \InvalidArgumentException('MongoClient or Mongo instance required'); } @@ -108,7 +108,9 @@ public function close() */ public function destroy($sessionId) { - $this->getCollection()->remove(array( + $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'deleteOne' : 'remove'; + + $this->getCollection()->$methodName(array( $this->options['id_field'] => $sessionId, )); @@ -120,8 +122,10 @@ public function destroy($sessionId) */ public function gc($maxlifetime) { - $this->getCollection()->remove(array( - $this->options['expiry_field'] => array('$lt' => new \MongoDate()), + $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'deleteOne' : 'remove'; + + $this->getCollection()->$methodName(array( + $this->options['expiry_field'] => array('$lt' => $this->createDateTime()), )); return true; @@ -132,18 +136,28 @@ public function gc($maxlifetime) */ public function write($sessionId, $data) { - $expiry = new \MongoDate(time() + (int) ini_get('session.gc_maxlifetime')); + $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); $fields = array( - $this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY), - $this->options['time_field'] => new \MongoDate(), + $this->options['time_field'] => $this->createDateTime(), $this->options['expiry_field'] => $expiry, ); - $this->getCollection()->update( + $options = array('upsert' => true); + + if ($this->mongo instanceof \MongoDB\Client) { + $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY); + } else { + $fields[$this->options['data_field']] = new \MongoBinData($data, \MongoBinData::BYTE_ARRAY); + $options['multiple'] = false; + } + + $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'updateOne' : 'update'; + + $this->getCollection()->$methodName( array($this->options['id_field'] => $sessionId), array('$set' => $fields), - array('upsert' => true, 'multiple' => false) + $options ); return true; @@ -156,10 +170,18 @@ public function read($sessionId) { $dbData = $this->getCollection()->findOne(array( $this->options['id_field'] => $sessionId, - $this->options['expiry_field'] => array('$gte' => new \MongoDate()), + $this->options['expiry_field'] => array('$gte' => $this->createDateTime()), )); - return null === $dbData ? '' : $dbData[$this->options['data_field']]->bin; + if (null === $dbData) { + return ''; + } + + if ($dbData[$this->options['data_field']] instanceof \MongoDB\BSON\Binary) { + return $dbData[$this->options['data_field']]->getData(); + } + + return $dbData[$this->options['data_field']]->bin; } /** @@ -185,4 +207,24 @@ protected function getMongo() { return $this->mongo; } + + /** + * Create a date object using the class appropriate for the current mongo connection. + * + * Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime + * + * @param int $seconds An integer representing UTC seconds since Jan 1 1970. Defaults to now. + */ + private function createDateTime($seconds = null) + { + if (is_null($seconds)) { + $seconds = time(); + } + + if ($this->mongo instanceof \MongoDB\Client) { + return new \MongoDB\BSON\UTCDateTime($seconds * 1000); + } + + return new \MongoDate($seconds); + } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 556f26a33c403..0ae0d4b2f7366 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -15,7 +15,6 @@ /** * @author Markus Bachmann - * @requires extension mongo * @group time-sensitive */ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase @@ -31,7 +30,15 @@ protected function setUp() { parent::setUp(); - $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; + if (!extension_loaded('mongo') && !extension_loaded('mongodb')) { + $this->markTestSkipped('The Mongo or MongoDB extension is required.'); + } + + if (phpversion('mongodb')) { + $mongoClass = 'MongoDB\Client'; + } else { + $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; + } $this->mongo = $this->getMockBuilder($mongoClass) ->disableOriginalConstructor() @@ -98,14 +105,28 @@ public function testRead() $that->assertArrayHasKey($that->options['expiry_field'], $criteria); $that->assertArrayHasKey('$gte', $criteria[$that->options['expiry_field']]); - $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$gte']); - $that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec, $testTimeout); - return array( + if (phpversion('mongodb')) { + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$gte']); + $that->assertGreaterThanOrEqual(round(intval((string) $criteria[$that->options['expiry_field']]['$gte']) / 1000), $testTimeout); + } else { + $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$gte']); + $that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec, $testTimeout); + } + + $fields = array( $that->options['id_field'] => 'foo', - $that->options['data_field'] => new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY), - $that->options['id_field'] => new \MongoDate(), ); + + if (phpversion('mongodb')) { + $fields[$that->options['data_field']] = new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY); + $fields[$that->options['id_field']] = new \MongoDB\BSON\UTCDateTime(time() * 1000); + } else { + $fields[$that->options['data_field']] = new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY); + $fields[$that->options['id_field']] = new \MongoDate(); + } + + return $fields; })); $this->assertEquals('bar', $this->storage->read('foo')); @@ -123,11 +144,18 @@ public function testWrite() $that = $this; $data = array(); + $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; + $collection->expects($this->once()) - ->method('update') + ->method($methodName) ->will($this->returnCallback(function ($criteria, $updateData, $options) use ($that, &$data) { $that->assertEquals(array($that->options['id_field'] => 'foo'), $criteria); - $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + + if (phpversion('mongodb')) { + $that->assertEquals(array('upsert' => true), $options); + } else { + $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + } $data = $updateData['$set']; })); @@ -135,10 +163,17 @@ public function testWrite() $expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime'); $this->assertTrue($this->storage->write('foo', 'bar')); - $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); - $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); - $this->assertGreaterThanOrEqual($expectedExpiry, $data[$this->options['expiry_field']]->sec); + if (phpversion('mongodb')) { + $that->assertEquals('bar', $data[$that->options['data_field']]->getData()); + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['time_field']]); + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['expiry_field']]); + $that->assertGreaterThanOrEqual($expectedExpiry, round(intval((string) $data[$that->options['expiry_field']]) / 1000)); + } else { + $that->assertEquals('bar', $data[$that->options['data_field']]->bin); + $that->assertInstanceOf('MongoDate', $data[$that->options['time_field']]); + $that->assertInstanceOf('MongoDate', $data[$that->options['expiry_field']]); + $that->assertGreaterThanOrEqual($expectedExpiry, $data[$that->options['expiry_field']]->sec); + } } public function testWriteWhenUsingExpiresField() @@ -164,20 +199,33 @@ public function testWriteWhenUsingExpiresField() $that = $this; $data = array(); + $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; + $collection->expects($this->once()) - ->method('update') + ->method($methodName) ->will($this->returnCallback(function ($criteria, $updateData, $options) use ($that, &$data) { $that->assertEquals(array($that->options['id_field'] => 'foo'), $criteria); - $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + + if (phpversion('mongodb')) { + $that->assertEquals(array('upsert' => true), $options); + } else { + $that->assertEquals(array('upsert' => true, 'multiple' => false), $options); + } $data = $updateData['$set']; })); $this->assertTrue($this->storage->write('foo', 'bar')); - $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); - $that->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); + if (phpversion('mongodb')) { + $that->assertEquals('bar', $data[$that->options['data_field']]->getData()); + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['time_field']]); + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['expiry_field']]); + } else { + $that->assertEquals('bar', $data[$that->options['data_field']]->bin); + $that->assertInstanceOf('MongoDate', $data[$that->options['time_field']]); + $that->assertInstanceOf('MongoDate', $data[$that->options['expiry_field']]); + } } public function testReplaceSessionData() @@ -191,8 +239,10 @@ public function testReplaceSessionData() $data = array(); + $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; + $collection->expects($this->exactly(2)) - ->method('update') + ->method($methodName) ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { $data = $updateData; })); @@ -200,7 +250,11 @@ public function testReplaceSessionData() $this->storage->write('foo', 'bar'); $this->storage->write('foo', 'foobar'); - $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin); + if (phpversion('mongodb')) { + $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->getData()); + } else { + $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin); + } } public function testDestroy() @@ -212,8 +266,10 @@ public function testDestroy() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); + $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove'; + $collection->expects($this->once()) - ->method('remove') + ->method($methodName) ->with(array($this->options['id_field'] => 'foo')); $this->assertTrue($this->storage->destroy('foo')); @@ -230,19 +286,45 @@ public function testGc() $that = $this; + $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove'; + $collection->expects($this->once()) - ->method('remove') + ->method($methodName) ->will($this->returnCallback(function ($criteria) use ($that) { - $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$lt']); - $that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec); + if (phpversion('mongodb')) { + $that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$lt']); + $that->assertGreaterThanOrEqual(time() - 1, round(intval((string) $criteria[$that->options['expiry_field']]['$lt']) / 1000)); + } else { + $that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$lt']); + $that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec); + } })); $this->assertTrue($this->storage->gc(1)); } + public function testGetConnection() + { + $method = new \ReflectionMethod($this->storage, 'getMongo'); + $method->setAccessible(true); + + if (phpversion('mongodb')) { + $mongoClass = 'MongoDB\Client'; + } else { + $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; + } + + $this->assertInstanceOf($mongoClass, $method->invoke($this->storage)); + } + private function createMongoCollectionMock() { - $collection = $this->getMockBuilder('MongoCollection') + $collectionClass = 'MongoCollection'; + if (phpversion('mongodb')) { + $collectionClass = 'MongoDB\Collection'; + } + + $collection = $this->getMockBuilder($collectionClass) ->disableOriginalConstructor() ->getMock(); From 7696c95b17a7391fc6a1d48ff9d46512dd5e9d46 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 1 Jul 2016 08:55:04 +0200 Subject: [PATCH 10/62] skip test with current phpunit bridge --- .../DependencyInjection/Tests/ContainerBuilderTest.php | 3 +++ src/Symfony/Component/Yaml/Tests/ParserTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index f9f6aabe73282..ac66d48b3af4a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -60,6 +60,9 @@ public function testDefinitions() } } + /** + * @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered + */ public function testCreateDeprecatedService() { ErrorAssert::assertDeprecationsAreTriggered('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', function () { diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 7b3681953558b..9e9a715ad167c 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -928,6 +928,7 @@ public function testFloatKeys() /** * @group legacy * throw ParseException in Symfony 3.0 + * @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered */ public function testColonInMappingValueException() { From 81b0cc7c7289f969fb477b939a8496152d26d931 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 1 Jul 2016 09:20:22 +0200 Subject: [PATCH 11/62] fixed CS --- .../Storage/Handler/MongoDbSessionHandler.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 23bca61e6068b..7efc1348c8027 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -19,7 +19,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface { /** - * @var \Mongo + * @var \Mongo|\MongoClient|\MongoDB\Client */ private $mongo; @@ -108,7 +108,7 @@ public function close() */ public function destroy($sessionId) { - $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'deleteOne' : 'remove'; + $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; $this->getCollection()->$methodName(array( $this->options['id_field'] => $sessionId, @@ -122,7 +122,7 @@ public function destroy($sessionId) */ public function gc($maxlifetime) { - $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'deleteOne' : 'remove'; + $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; $this->getCollection()->$methodName(array( $this->options['expiry_field'] => array('$lt' => $this->createDateTime()), @@ -152,7 +152,7 @@ public function write($sessionId, $data) $options['multiple'] = false; } - $methodName = ($this->mongo instanceof \MongoDB\Client) ? 'updateOne' : 'update'; + $methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' : 'update'; $this->getCollection()->$methodName( array($this->options['id_field'] => $sessionId), @@ -201,7 +201,7 @@ private function getCollection() /** * Return a Mongo instance. * - * @return \Mongo + * @return \Mongo|\MongoClient|\MongoDB\Client */ protected function getMongo() { @@ -217,7 +217,7 @@ protected function getMongo() */ private function createDateTime($seconds = null) { - if (is_null($seconds)) { + if (null === $seconds) { $seconds = time(); } From 72fd0b82c5157975ebdb034b457f087a5a7d36e5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 1 Jul 2016 16:56:05 +0200 Subject: [PATCH 12/62] [travis] Fix deps=low/high builds --- .github/travis.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/travis.php b/.github/travis.php index 1d036d4f4295c..695c69604fe67 100644 --- a/.github/travis.php +++ b/.github/travis.php @@ -46,8 +46,8 @@ $versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json'); $versions = json_decode($versions); - foreach ($versions->package->versions as $version => $package) { - $packages[$package->name] += array($version => $package); + foreach ($versions->package->versions as $v => $package) { + $packages[$package->name] += array($v => $package); } } From 3cc2f1054118727e94c1d9916d25a0bcc86b661a Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Fri, 1 Jul 2016 20:46:12 +0200 Subject: [PATCH 13/62] =?UTF-8?q?[Validator]=C2=A0make=20UuidValidator=20c?= =?UTF-8?q?lass=20formatting=20consistent.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Validator/Constraints/UuidValidator.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/UuidValidator.php b/src/Symfony/Component/Validator/Constraints/UuidValidator.php index 08f9e27b736c8..d4f71a187a846 100644 --- a/src/Symfony/Component/Validator/Constraints/UuidValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UuidValidator.php @@ -232,20 +232,14 @@ private function validateStrict($value, Uuid $constraint) if ($i !== $h) { if ($this->context instanceof ExecutionContextInterface) { $this->context->buildViolation($constraint->message) - ->setParameter( - '{{ value }}', - $this->formatValue($value) - ) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); } else { $this->buildViolation($constraint->message) - ->setParameter( - '{{ value }}', - $this->formatValue($value) - ) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); } return; From ff8bb4b5f27c5af85dba6ac2d26223490e8191c7 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Fri, 1 Jul 2016 21:10:03 +0200 Subject: [PATCH 14/62] [Validator] UuidValidator must accept a Uuid constraint. --- .../Component/Validator/Constraints/UuidValidator.php | 4 ++++ .../Validator/Tests/Constraints/UuidValidatorTest.php | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Symfony/Component/Validator/Constraints/UuidValidator.php b/src/Symfony/Component/Validator/Constraints/UuidValidator.php index 08f9e27b736c8..6ef9178f7e81f 100644 --- a/src/Symfony/Component/Validator/Constraints/UuidValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UuidValidator.php @@ -81,6 +81,10 @@ public function validate($value, Constraint $constraint) return; } + if (!$constraint instanceof Uuid) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid'); + } + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedTypeException($value, 'string'); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php index 0abda39f02942..05a60684c2589 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php @@ -44,6 +44,16 @@ public function testEmptyStringIsValid() $this->assertNoViolation(); } + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsUuidConstraintCompatibleType() + { + $constraint = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\Constraint'); + + $this->validator->validate('216fff40-98d9-11e3-a5e2-0800200c9a66', $constraint); + } + /** * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException */ From 2cec4a61efe2e17073522ea8fdbec978577510a2 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Fri, 1 Jul 2016 21:54:14 +0200 Subject: [PATCH 15/62] Remove and change unrelevant comments in Validator and Security components. --- .../Security/Csrf/TokenStorage/SessionTokenStorage.php | 2 +- .../Validator/Violation/ConstraintViolationBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php index a6a6ea389426e..a3ee0a13c98d5 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php @@ -15,7 +15,7 @@ use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException; /** - * Token storage that uses a Symfony2 Session object. + * Token storage that uses a Symfony Session object. * * @since 2.4 * diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php index d7d3877aed283..cceb6dea980b8 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php @@ -199,7 +199,7 @@ public function addViolation() $this->message, $this->plural, $this->parameters, - $this->translationDomain# + $this->translationDomain ); } catch (\InvalidArgumentException $e) { $translatedMessage = $this->translator->trans( From 5d6f6aa7c7b0d4a1da9e3836c1c134bf241da4ef Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Jul 2016 07:27:33 +0200 Subject: [PATCH 16/62] removed @since --- .../CompilerPass/RegisterMappingsPass.php | 2 -- .../Doctrine/Form/ChoiceList/IdReader.php | 2 -- ...gacyUniqueEntityValidatorLegacyApiTest.php | 2 -- .../Csrf/CsrfProvider/CsrfProviderAdapter.php | 2 -- .../CsrfProvider/CsrfTokenManagerAdapter.php | 2 -- .../DataCollector/DataCollectorExtension.php | 2 -- .../EventListener/DataCollectorListener.php | 2 -- .../DataCollector/FormDataCollector.php | 2 -- .../FormDataCollectorInterface.php | 2 -- .../DataCollector/FormDataExtractor.php | 2 -- .../FormDataExtractorInterface.php | 2 -- .../Proxy/ResolvedTypeDataCollectorProxy.php | 2 -- .../ResolvedTypeFactoryDataCollectorProxy.php | 2 -- .../Type/DataCollectorTypeExtension.php | 2 -- .../Component/Form/FormErrorIterator.php | 2 -- src/Symfony/Component/Form/FormInterface.php | 3 --- .../Form/Test/FormPerformanceTestCase.php | 2 -- .../LegacyFormValidatorLegacyApiTest.php | 2 -- .../Component/Form/Util/OrderedHashMap.php | 16 ------------- .../Form/Util/OrderedHashMapIterator.php | 24 ++++--------------- .../LegacyUserPasswordValidatorTest.php | 2 -- .../Csrf/CsrfTokenManagerInterface.php | 2 -- .../TokenGeneratorInterface.php | 2 -- .../TokenGenerator/UriSafeTokenGenerator.php | 2 -- .../NativeSessionTokenStorage.php | 2 -- .../Csrf/TokenStorage/SessionTokenStorage.php | 2 -- .../TokenStorage/TokenStorageInterface.php | 2 -- .../Component/Validator/Constraint.php | 4 ---- .../Validator/Constraints/Callback.php | 2 -- .../Validator/Constraints/Composite.php | 2 -- .../Validator/Constraints/Traverse.php | 2 -- .../Validator/Context/ExecutionContext.php | 2 -- .../Context/ExecutionContextFactory.php | 2 -- .../ExecutionContextFactoryInterface.php | 2 -- .../Context/ExecutionContextInterface.php | 2 -- .../Context/LegacyExecutionContext.php | 2 -- .../Context/LegacyExecutionContextFactory.php | 2 -- .../UnsupportedMetadataException.php | 2 -- .../Validator/Mapping/CascadingStrategy.php | 2 -- .../Mapping/ClassMetadataInterface.php | 2 -- .../Factory/MetadataFactoryInterface.php | 2 -- .../Validator/Mapping/GenericMetadata.php | 2 -- .../Validator/Mapping/MetadataInterface.php | 2 -- .../Mapping/PropertyMetadataInterface.php | 2 -- .../Validator/Mapping/TraversalStrategy.php | 2 -- .../AbstractConstraintValidatorTest.php | 2 -- .../Tests/Constraints/CompositeTest.php | 2 -- .../Fixtures/StubGlobalExecutionContext.php | 2 -- .../Tests/Validator/Abstract2Dot5ApiTest.php | 2 -- .../Tests/Validator/AbstractLegacyApiTest.php | 2 -- .../Tests/Validator/AbstractValidatorTest.php | 2 -- .../Component/Validator/Util/PropertyPath.php | 2 -- .../ContextualValidatorInterface.php | 2 -- .../Validator/Validator/LegacyValidator.php | 2 -- .../RecursiveContextualValidator.php | 2 -- .../Validator/RecursiveValidator.php | 2 -- .../Validator/ValidatorInterface.php | 2 -- .../Violation/ConstraintViolationBuilder.php | 2 -- .../ConstraintViolationBuilderInterface.php | 2 -- 59 files changed, 4 insertions(+), 153 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php index 5620740a52082..9a4756ff9eac7 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -118,8 +118,6 @@ abstract class RegisterMappingsPass implements CompilerPassInterface * @param string $registerAliasMethodName Name of Configuration class method to * register alias. * @param string[] $aliasMap Map of alias to namespace - * - * @since Support for bundle alias was added in Symfony 2.6 */ public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false, $configurationPattern = '', $registerAliasMethodName = '', array $aliasMap = array()) { diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php index 1f2d1e9e1ed73..cd966ea986f79 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php @@ -18,8 +18,6 @@ /** * A utility for reading object IDs. * - * @since 1.0 - * * @author Bernhard Schussek * * @internal This class is meant for internal use only. diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php index cde865cc1d87a..91c57118d91a7 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php @@ -14,8 +14,6 @@ use Symfony\Component\Validator\Validation; /** - * @since 2.5.4 - * * @author Bernhard Schussek * @group legacy */ diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php index 2a55069692f8a..011d34a680111 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php @@ -21,8 +21,6 @@ * Adapter for using old CSRF providers where the new {@link CsrfTokenManagerInterface} * is expected. * - * @since 2.4 - * * @author Bernhard Schussek * * @deprecated since version 2.4, to be removed in 3.0. diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php index b246a616b03ed..93ed3147143d2 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php @@ -17,8 +17,6 @@ /** * Adapter for using the new token generator with the old interface. * - * @since 2.4 - * * @author Bernhard Schussek * * @deprecated since version 2.4, to be removed in 3.0. diff --git a/src/Symfony/Component/Form/Extension/DataCollector/DataCollectorExtension.php b/src/Symfony/Component/Form/Extension/DataCollector/DataCollectorExtension.php index 70b347fa9af3a..2f2e51c0901c7 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/DataCollectorExtension.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/DataCollectorExtension.php @@ -17,8 +17,6 @@ /** * Extension for collecting data of the forms on a page. * - * @since 2.4 - * * @author Robert Schönthal * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php b/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php index 8fd70f09b1796..0bd33d36a5d1f 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php @@ -20,8 +20,6 @@ * Listener that invokes a data collector for the {@link FormEvents::POST_SET_DATA} * and {@link FormEvents::POST_SUBMIT} events. * - * @since 2.4 - * * @author Bernhard Schussek */ class DataCollectorListener implements EventSubscriberInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php index d1375df8894b8..a408dde2306c9 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php @@ -20,8 +20,6 @@ /** * Data collector for {@link FormInterface} instances. * - * @since 2.4 - * * @author Robert Schönthal * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php index a57693a995241..ee004a09f30b4 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollectorInterface.php @@ -18,8 +18,6 @@ /** * Collects and structures information about forms. * - * @since 2.4 - * * @author Bernhard Schussek */ interface FormDataCollectorInterface extends DataCollectorInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php index 1c678ac665d09..71f07b5fe069f 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php @@ -19,8 +19,6 @@ /** * Default implementation of {@link FormDataExtractorInterface}. * - * @since 2.4 - * * @author Bernhard Schussek */ class FormDataExtractor implements FormDataExtractorInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php index a5bb7d0ef30a1..e0bc6dc0caccc 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractorInterface.php @@ -17,8 +17,6 @@ /** * Extracts arrays of information out of forms. * - * @since 2.4 - * * @author Bernhard Schussek */ interface FormDataExtractorInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php index 61caf60a3f823..4c1d6f0beac0d 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php @@ -21,8 +21,6 @@ /** * Proxy that invokes a data collector when creating a form and its view. * - * @since 2.4 - * * @author Bernhard Schussek */ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php index f5f4ed2e2095c..5051d0bb6390a 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php @@ -20,8 +20,6 @@ * Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy} * instances. * - * @since 2.4 - * * @author Bernhard Schussek */ class ResolvedTypeFactoryDataCollectorProxy implements ResolvedFormTypeFactoryInterface diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Type/DataCollectorTypeExtension.php b/src/Symfony/Component/Form/Extension/DataCollector/Type/DataCollectorTypeExtension.php index 55918d7c1e2f6..6aa33b589efb4 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/Type/DataCollectorTypeExtension.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/Type/DataCollectorTypeExtension.php @@ -19,8 +19,6 @@ /** * Type extension for collecting data of a form with this type. * - * @since 2.4 - * * @author Robert Schönthal * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/FormErrorIterator.php b/src/Symfony/Component/Form/FormErrorIterator.php index 113de435d5ede..41a1297d30f57 100644 --- a/src/Symfony/Component/Form/FormErrorIterator.php +++ b/src/Symfony/Component/Form/FormErrorIterator.php @@ -27,8 +27,6 @@ * flatten the recursive structure into a flat list of errors. * * @author Bernhard Schussek - * - * @since 2.5 */ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable { diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 13b03f5118c1c..9de802847ee8e 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -102,9 +102,6 @@ public function all(); * * @return FormErrorIterator An iterator over the {@link FormError} * instances that where added to this form - * - * @since 2.5 Since version 2.5 this method returns a - * {@link FormErrorIterator} instance instead of an array */ public function getErrors($deep = false, $flatten = true); diff --git a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php index 090eb8bc4f5a9..75ddba621278f 100644 --- a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php +++ b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php @@ -62,8 +62,6 @@ public function setMaxRunningTime($maxRunningTime) } /** - * @since Method available since Release 2.3.0 - * * @return int */ public function getMaxRunningTime() diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidatorLegacyApiTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidatorLegacyApiTest.php index 7ea58b7cef2fc..b756a92b49f04 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidatorLegacyApiTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidatorLegacyApiTest.php @@ -14,8 +14,6 @@ use Symfony\Component\Validator\Validation; /** - * @since 2.5.3 - * * @author Bernhard Schussek * @group legacy */ diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index 3aaa7d0451f1f..a25df3214f63e 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -63,8 +63,6 @@ * } * * @author Bernhard Schussek - * - * @since 2.2.6 */ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable { @@ -93,8 +91,6 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable * Creates a new map. * * @param array $elements The elements to insert initially - * - * @since 2.2.6 */ public function __construct(array $elements = array()) { @@ -104,8 +100,6 @@ public function __construct(array $elements = array()) /** * {@inheritdoc} - * - * @since 2.2.6 */ public function offsetExists($key) { @@ -114,8 +108,6 @@ public function offsetExists($key) /** * {@inheritdoc} - * - * @since 2.2.6 */ public function offsetGet($key) { @@ -128,8 +120,6 @@ public function offsetGet($key) /** * {@inheritdoc} - * - * @since 2.2.6 */ public function offsetSet($key, $value) { @@ -151,8 +141,6 @@ public function offsetSet($key, $value) /** * {@inheritdoc} - * - * @since 2.2.6 */ public function offsetUnset($key) { @@ -170,8 +158,6 @@ public function offsetUnset($key) /** * {@inheritdoc} - * - * @since 2.2.6 */ public function getIterator() { @@ -180,8 +166,6 @@ public function getIterator() /** * {@inheritdoc} - * - * @since 2.2.6 */ public function count() { diff --git a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php index f606626814895..32f591c860698 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php @@ -17,8 +17,6 @@ * This class is internal and should not be used. * * @author Bernhard Schussek - * - * @since 2.2.6 */ class OrderedHashMapIterator implements \Iterator { @@ -69,8 +67,6 @@ class OrderedHashMapIterator implements \Iterator * This array is managed by the corresponding * {@link OrderedHashMap} instance to support * recognizing the deletion of elements. - * - * @since 2.2.6 */ public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors) { @@ -85,8 +81,6 @@ public function __construct(array &$elements, array &$orderedKeys, array &$manag /** * Removes the iterator's cursors from the managed cursors of the * corresponding {@link OrderedHashMap} instance. - * - * @since 2.2.6 */ public function __destruct() { @@ -96,9 +90,7 @@ public function __destruct() } /** - *{@inheritdoc} - * - * @since 2.2.6 + * {@inheritdoc} */ public function current() { @@ -107,8 +99,6 @@ public function current() /** * {@inheritdoc} - * - * @since 2.2.6 */ public function next() { @@ -124,9 +114,7 @@ public function next() } /** - *{@inheritdoc} - * - * @since 2.2.6 + * {@inheritdoc} */ public function key() { @@ -134,9 +122,7 @@ public function key() } /** - *{@inheritdoc} - * - * @since 2.2.6 + * {@inheritdoc} */ public function valid() { @@ -144,9 +130,7 @@ public function valid() } /** - *{@inheritdoc} - * - * @since 2.2.6 + * {@inheritdoc} */ public function rewind() { diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php index 8053732beecad..f7da8c0bf672b 100644 --- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php @@ -14,8 +14,6 @@ use Symfony\Component\Validator\Validation; /** - * @since 2.5.4 - * * @author Bernhard Schussek * @group legacy */ diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php b/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php index bccabe6c9c0f1..5936b6440e4d0 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.php @@ -14,8 +14,6 @@ /** * Manages CSRF tokens. * - * @since 2.4 - * * @author Bernhard Schussek */ interface CsrfTokenManagerInterface diff --git a/src/Symfony/Component/Security/Csrf/TokenGenerator/TokenGeneratorInterface.php b/src/Symfony/Component/Security/Csrf/TokenGenerator/TokenGeneratorInterface.php index 1405b84f03322..0ec2881774b93 100644 --- a/src/Symfony/Component/Security/Csrf/TokenGenerator/TokenGeneratorInterface.php +++ b/src/Symfony/Component/Security/Csrf/TokenGenerator/TokenGeneratorInterface.php @@ -14,8 +14,6 @@ /** * Generates CSRF tokens. * - * @since 2.4 - * * @author Bernhard Schussek */ interface TokenGeneratorInterface diff --git a/src/Symfony/Component/Security/Csrf/TokenGenerator/UriSafeTokenGenerator.php b/src/Symfony/Component/Security/Csrf/TokenGenerator/UriSafeTokenGenerator.php index edeb435138f21..31e82ee5ecf62 100644 --- a/src/Symfony/Component/Security/Csrf/TokenGenerator/UriSafeTokenGenerator.php +++ b/src/Symfony/Component/Security/Csrf/TokenGenerator/UriSafeTokenGenerator.php @@ -17,8 +17,6 @@ /** * Generates CSRF tokens. * - * @since 2.4 - * * @author Bernhard Schussek */ class UriSafeTokenGenerator implements TokenGeneratorInterface diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php index 2620156f369a6..71151fa831813 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php @@ -16,8 +16,6 @@ /** * Token storage that uses PHP's native session handling. * - * @since 2.4 - * * @author Bernhard Schussek */ class NativeSessionTokenStorage implements TokenStorageInterface diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php index a3ee0a13c98d5..37b33e6f2161b 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php @@ -17,8 +17,6 @@ /** * Token storage that uses a Symfony Session object. * - * @since 2.4 - * * @author Bernhard Schussek */ class SessionTokenStorage implements TokenStorageInterface diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/TokenStorageInterface.php b/src/Symfony/Component/Security/Csrf/TokenStorage/TokenStorageInterface.php index 5efe72f694d4b..92386fbbda34f 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/TokenStorageInterface.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/TokenStorageInterface.php @@ -14,8 +14,6 @@ /** * Stores CSRF tokens. * - * @since 2.4 - * * @author Bernhard Schussek */ interface TokenStorageInterface diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 75b1e4ded036f..a6d06472c2cf3 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -207,8 +207,6 @@ public function __set($option, $value) * @throws InvalidOptionsException If an invalid option name is given * * @internal This method should not be used or overwritten in userland code. - * - * @since 2.6 */ public function __get($option) { @@ -296,8 +294,6 @@ public function getTargets() * @internal This method may be replaced by an implementation of * {@link \Serializable} in the future. Please don't use or * overwrite it. - * - * @since 2.6 */ public function __sleep() { diff --git a/src/Symfony/Component/Validator/Constraints/Callback.php b/src/Symfony/Component/Validator/Constraints/Callback.php index 7e4ccd47b540c..36e6087e1e98e 100644 --- a/src/Symfony/Component/Validator/Constraints/Callback.php +++ b/src/Symfony/Component/Validator/Constraints/Callback.php @@ -23,8 +23,6 @@ class Callback extends Constraint { /** * @var string|callable - * - * @since 2.4 */ public $callback; diff --git a/src/Symfony/Component/Validator/Constraints/Composite.php b/src/Symfony/Component/Validator/Constraints/Composite.php index 90c98620f0055..ab8466bcfcbc4 100644 --- a/src/Symfony/Component/Validator/Constraints/Composite.php +++ b/src/Symfony/Component/Validator/Constraints/Composite.php @@ -24,8 +24,6 @@ * let {@link getCompositeOption()} return the name of the property which * contains the nested constraints. * - * @since 2.6 - * * @author Bernhard Schussek */ abstract class Composite extends Constraint diff --git a/src/Symfony/Component/Validator/Constraints/Traverse.php b/src/Symfony/Component/Validator/Constraints/Traverse.php index 5811ad770ad6f..9d8bc126d1888 100644 --- a/src/Symfony/Component/Validator/Constraints/Traverse.php +++ b/src/Symfony/Component/Validator/Constraints/Traverse.php @@ -17,8 +17,6 @@ /** * @Annotation * - * @since 2.5 - * * @author Bernhard Schussek */ class Traverse extends Constraint diff --git a/src/Symfony/Component/Validator/Context/ExecutionContext.php b/src/Symfony/Component/Validator/Context/ExecutionContext.php index 722bcc947d2f4..dce975c2038e6 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContext.php @@ -27,8 +27,6 @@ /** * The context used and created by {@link ExecutionContextFactory}. * - * @since 2.5 - * * @author Bernhard Schussek * * @see ExecutionContextInterface diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextFactory.php b/src/Symfony/Component/Validator/Context/ExecutionContextFactory.php index f4f01d926e0f7..8182c41f8c1ca 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextFactory.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextFactory.php @@ -17,8 +17,6 @@ /** * Creates new {@link ExecutionContext} instances. * - * @since 2.5 - * * @author Bernhard Schussek * * @internal You should not instantiate or use this class. Code against diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php index e4af667d2da6a..f3ab3dd68a740 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php @@ -19,8 +19,6 @@ * You can use a custom factory if you want to customize the execution context * that is passed through the validation run. * - * @since 2.5 - * * @author Bernhard Schussek */ interface ExecutionContextFactoryInterface diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php index 9c28bde9ea631..d38d33747a752 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php @@ -56,8 +56,6 @@ * cannot store a context and expect that the methods still return the same * results later on. * - * @since 2.5 - * * @author Bernhard Schussek */ interface ExecutionContextInterface extends LegacyExecutionContextInterface diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php index f52b359fb39ca..37ca2a1d102b3 100644 --- a/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContext.php @@ -20,8 +20,6 @@ /** * An execution context that is compatible with the legacy API (< 2.5). * - * @since 2.5 - * * @author Bernhard Schussek * * @deprecated since version 2.5, to be removed in 3.0. diff --git a/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php b/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php index c110644e99c1b..757eb72a5bda2 100644 --- a/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php +++ b/src/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php @@ -22,8 +22,6 @@ * * Implemented for backward compatibility with Symfony < 2.5. * - * @since 2.5 - * * @author Bernhard Schussek * * @deprecated since version 2.5, to be removed in 3.0. diff --git a/src/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php b/src/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php index 97cc5ffe5d92a..aff569b957502 100644 --- a/src/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php +++ b/src/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php @@ -12,8 +12,6 @@ namespace Symfony\Component\Validator\Exception; /** - * @since 2.5 - * * @author Bernhard Schussek */ class UnsupportedMetadataException extends InvalidArgumentException diff --git a/src/Symfony/Component/Validator/Mapping/CascadingStrategy.php b/src/Symfony/Component/Validator/Mapping/CascadingStrategy.php index 2b97bdd4ca90a..c78fb42ad46cb 100644 --- a/src/Symfony/Component/Validator/Mapping/CascadingStrategy.php +++ b/src/Symfony/Component/Validator/Mapping/CascadingStrategy.php @@ -27,8 +27,6 @@ * Although the constants currently represent a boolean switch, they are * implemented as bit mask in order to allow future extensions. * - * @since 2.5 - * * @author Bernhard Schussek * * @see TraversalStrategy diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php b/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php index 577440d61d8c7..d8c3d843bd4c1 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php @@ -24,8 +24,6 @@ * by a group sequence for that class and whether instances of that class * should be traversed or not. * - * @since 2.5 - * * @author Bernhard Schussek * * @see MetadataInterface diff --git a/src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php b/src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php index 6e55e771dd1aa..438ef9871c25f 100644 --- a/src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php +++ b/src/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php @@ -16,8 +16,6 @@ /** * Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. * - * @since 2.5 - * * @author Bernhard Schussek */ interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface diff --git a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php index 3459074fcabf7..458ad34fca6cd 100644 --- a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php @@ -23,8 +23,6 @@ * * This class supports serialization and cloning. * - * @since 2.5 - * * @author Bernhard Schussek */ class GenericMetadata implements MetadataInterface diff --git a/src/Symfony/Component/Validator/Mapping/MetadataInterface.php b/src/Symfony/Component/Validator/Mapping/MetadataInterface.php index e5f09e17edc82..1e9d3c8929bf7 100644 --- a/src/Symfony/Component/Validator/Mapping/MetadataInterface.php +++ b/src/Symfony/Component/Validator/Mapping/MetadataInterface.php @@ -24,8 +24,6 @@ * against their class' metadata and whether traversable objects should be * traversed or not. * - * @since 2.5 - * * @author Bernhard Schussek * * @see CascadingStrategy diff --git a/src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php b/src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php index 8a77aa83faba5..d7a4114d44f14 100644 --- a/src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php +++ b/src/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php @@ -24,8 +24,6 @@ * should be validated against their class' metadata and whether traversable * objects should be traversed or not. * - * @since 2.5 - * * @author Bernhard Schussek * * @see MetadataInterface diff --git a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php index ae76857aa443f..164992b2eab4f 100644 --- a/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php +++ b/src/Symfony/Component/Validator/Mapping/TraversalStrategy.php @@ -23,8 +23,6 @@ * * The traversal strategy is ignored for arrays. Arrays are always iterated. * - * @since 2.1 - * * @author Bernhard Schussek * * @see CascadingStrategy diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php index b5e2a7a97ddb0..230d90bd578c1 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php @@ -24,8 +24,6 @@ use Symfony\Component\Validator\Validation; /** - * @since 2.5.3 - * * @author Bernhard Schussek */ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCase diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php index eab15ed3bb848..002b1336aab3f 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php @@ -32,8 +32,6 @@ public function getDefaultOption() } /** - * @since 2.6 - * * @author Bernhard Schussek */ class CompositeTest extends \PHPUnit_Framework_TestCase diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php b/src/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php index 84c5a80bf2d16..bd2f5c94e7a96 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php @@ -16,8 +16,6 @@ use Symfony\Component\Validator\ValidationVisitorInterface; /** - * @since 2.5.3 - * * @author Bernhard Schussek * * @deprecated since version 2.5, to be removed in 3.0 diff --git a/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php index 6995d25817988..e85177ef59b24 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php @@ -29,8 +29,6 @@ /** * Verifies that a validator satisfies the API of Symfony 2.5+. * - * @since 2.5 - * * @author Bernhard Schussek */ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php index d78b67bee7e9a..cbbaecfcddcad 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php @@ -23,8 +23,6 @@ /** * Verifies that a validator satisfies the API of Symfony < 2.5. * - * @since 2.5 - * * @author Bernhard Schussek * @group legacy */ diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php index 678a3252a5a0b..7359348432b59 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php @@ -23,8 +23,6 @@ use Symfony\Component\Validator\Tests\Fixtures\Reference; /** - * @since 2.5 - * * @author Bernhard Schussek */ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase diff --git a/src/Symfony/Component/Validator/Util/PropertyPath.php b/src/Symfony/Component/Validator/Util/PropertyPath.php index 3ef8a8b1dc5da..52546c5ea9df0 100644 --- a/src/Symfony/Component/Validator/Util/PropertyPath.php +++ b/src/Symfony/Component/Validator/Util/PropertyPath.php @@ -16,8 +16,6 @@ * * For more extensive functionality, use Symfony's PropertyAccess component. * - * @since 2.5 - * * @author Bernhard Schussek */ class PropertyPath diff --git a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php index 048d6c7545f84..7d7ebe73b0814 100644 --- a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php @@ -17,8 +17,6 @@ /** * A validator in a specific execution context. * - * @since 2.5 - * * @author Bernhard Schussek */ interface ContextualValidatorInterface diff --git a/src/Symfony/Component/Validator/Validator/LegacyValidator.php b/src/Symfony/Component/Validator/Validator/LegacyValidator.php index e35f4c91401b3..588baa90135e0 100644 --- a/src/Symfony/Component/Validator/Validator/LegacyValidator.php +++ b/src/Symfony/Component/Validator/Validator/LegacyValidator.php @@ -16,8 +16,6 @@ /** * A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+. * - * @since 2.5 - * * @author Bernhard Schussek * * @see \Symfony\Component\Validator\ValidatorInterface diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index e27f6f637fc36..ebbc6a38837c9 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -33,8 +33,6 @@ /** * Recursive implementation of {@link ContextualValidatorInterface}. * - * @since 2.5 - * * @author Bernhard Schussek */ class RecursiveContextualValidator implements ContextualValidatorInterface diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php index e4dc0fb057d29..abd29087bc08a 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php @@ -24,8 +24,6 @@ /** * Recursive implementation of {@link ValidatorInterface}. * - * @since 2.5 - * * @author Bernhard Schussek */ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface diff --git a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php index 1cc9c6dd55940..e9576f5eceb37 100644 --- a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php @@ -19,8 +19,6 @@ /** * Validates PHP values against constraints. * - * @since 2.5 - * * @author Bernhard Schussek */ interface ValidatorInterface extends MetadataFactoryInterface diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php index cceb6dea980b8..bf887a08ec2b8 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php @@ -20,8 +20,6 @@ /** * Default implementation of {@link ConstraintViolationBuilderInterface}. * - * @since 2.5 - * * @author Bernhard Schussek * * @internal You should not instantiate or use this class. Code against diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php index b7cc2ecfcd230..fe5eaa3321d1b 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php @@ -19,8 +19,6 @@ * Finally, call {@link addViolation()} to add the violation to the current * execution context. * - * @since 2.5 - * * @author Bernhard Schussek */ interface ConstraintViolationBuilderInterface From ab9daeba1333a084081f062d8415e3681cfc12e8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 5 Jul 2016 08:40:30 +0200 Subject: [PATCH 17/62] [VarDumper] Fix indentation trimming in ExceptionCaster --- .../VarDumper/Caster/ExceptionCaster.php | 25 +++++++++++-------- .../Tests/Caster/ReflectionCasterTest.php | 4 +-- .../VarDumper/Tests/CliDumperTest.php | 2 +- .../VarDumper/Tests/Fixtures/Twig.php | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index 51c70dd5db9a8..2daffea8afffd 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -253,19 +253,24 @@ private static function extractSource(array $srcArray, $line, $srcContext) } $ltrim = 0; - while (' ' === $src[0][$ltrim] || "\t" === $src[0][$ltrim]) { - $i = $srcContext << 1; - while ($i > 0 && $src[0][$ltrim] === $src[$i][$ltrim]) { - --$i; - } - if ($i) { - break; + do { + $pad = null; + for ($i = $srcContext << 1; $i >= 0; --$i) { + if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) { + if (null === $pad) { + $pad = $c; + } + if ((' ' !== $c && "\t" !== $c) || $pad !== $c) { + break; + } + } } ++$ltrim; - } - if ($ltrim) { + } while (0 > $i && null !== $pad); + + if (--$ltrim) { foreach ($src as $i => $line) { - $src[$i] = substr($line, $ltrim); + $src[$i] = isset($line[$ltrim]) && "\r" !== $line[$ltrim] ? substr($line, $ltrim) : ltrim($line, " \t"); } } diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php index 52eae49fb01f9..a716bbabd6eec 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php @@ -208,8 +208,8 @@ public function testGenerator() executing: { Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): { %sGeneratorDemo.php:10: """ - yield 1;\n - }\n + yield 1;\n + }\n \n """ } diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index b00c0d435bf0f..54a9cdc113d8e 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -200,7 +200,7 @@ public function testThrowingCaster() $twig = << 2); } } -/* foo bar*/ +/* foo bar*/ /* twig source*/ /* */ From 6c5237ca36bb944cbf7ad0fe4cb78d75eee442de Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 5 Jul 2016 14:03:54 +0200 Subject: [PATCH 18/62] [varDumper] Fix missing usage of ExceptionCaster::$traceArgs --- src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index 2daffea8afffd..513352e374aa2 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -234,7 +234,7 @@ private static function filterExceptionArray($xClass, array $a, $xPrefix, $filte 'file' => $a[Caster::PREFIX_PROTECTED.'file'], 'line' => $a[Caster::PREFIX_PROTECTED.'line'], )); - $a[$xPrefix.'trace'] = new TraceStub($trace); + $a[$xPrefix.'trace'] = new TraceStub($trace, self::$traceArgs); } if (empty($a[$xPrefix.'previous'])) { unset($a[$xPrefix.'previous']); From d513eae29ec9349348255cdb8d15540766d8329b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 Jul 2016 10:59:52 +0200 Subject: [PATCH 19/62] [ClassLoader] Fix declared classes being computed when not needed --- .../ClassLoader/ClassCollectionLoader.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 8046579685ac9..b695b9272f28c 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -43,12 +43,12 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = self::$loaded[$name] = true; - $declared = array_merge(get_declared_classes(), get_declared_interfaces()); - if (function_exists('get_declared_traits')) { - $declared = array_merge($declared, get_declared_traits()); - } - if ($adaptive) { + $declared = array_merge(get_declared_classes(), get_declared_interfaces()); + if (function_exists('get_declared_traits')) { + $declared = array_merge($declared, get_declared_traits()); + } + // don't include already declared classes $classes = array_diff($classes, $declared); @@ -87,11 +87,17 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = } } - if (!$reload && is_file($cache)) { + if (!$reload && file_exists($cache)) { require_once $cache; return; } + if (!$adaptive) { + $declared = array_merge(get_declared_classes(), get_declared_interfaces()); + if (function_exists('get_declared_traits')) { + $declared = array_merge($declared, get_declared_traits()); + } + } $files = array(); $content = ''; From 32cb26961451cafd7f7957c309c4068005a07654 Mon Sep 17 00:00:00 2001 From: "Konstantin.Myakshin" Date: Thu, 7 Jul 2016 18:14:45 +0300 Subject: [PATCH 20/62] [DoctrineBridge] added missing error code for constraint. --- .../Validator/Constraints/UniqueEntityValidatorTest.php | 5 +++++ .../Bridge/Doctrine/Validator/Constraints/UniqueEntity.php | 6 ++++++ .../Validator/Constraints/UniqueEntityValidator.php | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 33e484320a56a..95b0589fc93e5 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -167,6 +167,7 @@ public function testValidateUniqueness() $this->buildViolation('myMessage') ->atPath('property.path.name') ->setInvalidValue('Foo') + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -190,6 +191,7 @@ public function testValidateCustomErrorPath() $this->buildViolation('myMessage') ->atPath('property.path.bar') ->setInvalidValue('Foo') + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -241,6 +243,7 @@ public function testValidateUniquenessWithIgnoreNull() $this->buildViolation('myMessage') ->atPath('property.path.name') ->setInvalidValue('Foo') + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -272,6 +275,7 @@ public function testValidateUniquenessWithValidCustomErrorPath() $this->buildViolation('myMessage') ->atPath('property.path.name2') ->setInvalidValue('Bar') + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } @@ -404,6 +408,7 @@ public function testAssociatedEntity() $this->buildViolation('myMessage') ->atPath('property.path.single') ->setInvalidValue($entity1) + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->assertRaised(); } diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php index fc6e213bd772e..315b1654e8f7e 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php @@ -23,6 +23,8 @@ */ class UniqueEntity extends Constraint { + const NOT_UNIQUE_ERROR = '23bd9dbf-6b9b-41cd-a99e-4844bcf3077f'; + public $message = 'This value is already used.'; public $service = 'doctrine.orm.validator.unique'; public $em = null; @@ -31,6 +33,10 @@ class UniqueEntity extends Constraint public $errorPath = null; public $ignoreNull = true; + protected static $errorNames = array( + self::NOT_UNIQUE_ERROR => 'NOT_UNIQUE_ERROR', + ); + public function getRequiredOptions() { return array('fields'); diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index f4c8671abae9a..94b40f980abc8 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -132,11 +132,13 @@ public function validate($entity, Constraint $constraint) $this->context->buildViolation($constraint->message) ->atPath($errorPath) ->setInvalidValue($invalidValue) + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->addViolation(); } else { $this->buildViolation($constraint->message) ->atPath($errorPath) ->setInvalidValue($invalidValue) + ->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->addViolation(); } } From f507023e50c7e86e3fa0e6b936eb18085e1b5e58 Mon Sep 17 00:00:00 2001 From: Alexander Cheprasov Date: Wed, 6 Jul 2016 22:55:29 +0100 Subject: [PATCH 21/62] [Form] fixed bug - name in ButtonBuilder --- src/Symfony/Component/Form/ButtonBuilder.php | 5 +- .../Form/Tests/ButtonBuilderTest.php | 61 +++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Component/Form/Tests/ButtonBuilderTest.php diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 1eaed6a826292..89cad51530224 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -62,11 +62,12 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface */ public function __construct($name, array $options = array()) { - if (empty($name) && 0 != $name) { + $name = (string) $name; + if ('' === $name) { throw new InvalidArgumentException('Buttons cannot have empty names.'); } - $this->name = (string) $name; + $this->name = $name; $this->options = $options; } diff --git a/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php new file mode 100644 index 0000000000000..dc5d38b744860 --- /dev/null +++ b/src/Symfony/Component/Form/Tests/ButtonBuilderTest.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\ButtonBuilder; + +/** + * @author Alexander Cheprasov + */ +class ButtonBuilderTest extends \PHPUnit_Framework_TestCase +{ + public function getValidNames() + { + return array( + array('reset'), + array('submit'), + array('foo'), + array('0'), + array(0), + array('button[]'), + ); + } + + /** + * @dataProvider getValidNames + */ + public function testValidNames($name) + { + $this->assertInstanceOf('\Symfony\Component\Form\ButtonBuilder', new ButtonBuilder($name)); + } + + public function getInvalidNames() + { + return array( + array(''), + array(false), + array(null), + ); + } + + /** + * @dataProvider getInvalidNames + */ + public function testInvalidNames($name) + { + $this->setExpectedException( + '\Symfony\Component\Form\Exception\InvalidArgumentException', + 'Buttons cannot have empty names.' + ); + new ButtonBuilder($name); + } +} From 6344ccd7b1e1ae34dfa48b0ae979440dab86c803 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Thu, 7 Jul 2016 17:57:55 +0200 Subject: [PATCH 22/62] Make the exception message more clear. --- src/Symfony/Component/Validator/Mapping/PropertyMetadata.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php index 9a2a4aac1428b..ac71be828541d 100644 --- a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php @@ -39,7 +39,7 @@ class PropertyMetadata extends MemberMetadata public function __construct($class, $name) { if (!property_exists($class, $name)) { - throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class)); + throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s"', $name, $class)); } parent::__construct($class, $name, $name); From 4d68f56242a21b410c20342caa79823093228d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20V=C3=A6versted?= Date: Fri, 8 Jul 2016 11:49:25 +0200 Subject: [PATCH 23/62] [Validator] Added additional MasterCard range to the CardSchemeValidator From October 2016 MasterCard will introduce a new card range, 222100 through 272099. See: https://www.mctestcards.com/ (click the help in top right) Implements unit tests and validation for this new card range. --- .../Validator/Constraints/CardSchemeValidator.php | 2 ++ .../Tests/Constraints/CardSchemeValidatorTest.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index 229e0d2c18997..be54a0cf477bd 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -74,8 +74,10 @@ class CardSchemeValidator extends ConstraintValidator '/^6[0-9]{11,18}$/', ), // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. + // October 2016 MasterCard numbers can also start with 222100 through 272099. 'MASTERCARD' => array( '/^5[1-5][0-9]{14}$/', + '/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/', ), // All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13. 'VISA' => array( diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php index 162563e09574c..dbe5166451a15 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -102,6 +102,12 @@ public function getValidNumbers() array('MAESTRO', '6594371785970435599'), array('MASTERCARD', '5555555555554444'), array('MASTERCARD', '5105105105105100'), + array('MASTERCARD', '2221005555554444'), + array('MASTERCARD', '2230000000000000'), + array('MASTERCARD', '2300000000000000'), + array('MASTERCARD', '2699999999999999'), + array('MASTERCARD', '2709999999999999'), + array('MASTERCARD', '2720995105105100'), array('VISA', '4111111111111111'), array('VISA', '4012888888881881'), array('VISA', '4222222222222'), @@ -129,6 +135,8 @@ public function getInvalidNumbers() array('AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR), // a lone number array('DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR), // only first part of the number array('DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR), // only last 4 digits + array('MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet + array('MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet ); } } From 880a392d37823915cb68ca275d26c9874d217d99 Mon Sep 17 00:00:00 2001 From: Maxime STEINHAUSSER Date: Thu, 7 Jul 2016 09:10:40 +0200 Subject: [PATCH 24/62] [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener --- .../Firewall/DigestAuthenticationListener.php | 2 +- .../DigestAuthenticationListenerTest.php | 79 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index d8d71fbdd1943..71bdf6ca3899a 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -78,7 +78,7 @@ public function handle(GetResponseEvent $event) } try { - $digestAuth->validateAndDecode($this->authenticationEntryPoint->getKey(), $this->authenticationEntryPoint->getRealmName()); + $digestAuth->validateAndDecode($this->authenticationEntryPoint->getSecret(), $this->authenticationEntryPoint->getRealmName()); } catch (BadCredentialsException $e) { $this->fail($event, $request, $e); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php new file mode 100644 index 0000000000000..80b2dc41343a8 --- /dev/null +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php @@ -0,0 +1,79 @@ +calculateServerDigest($username, $realm, $password, $nc, $nonce, $cnonce, $qop, 'GET', $uri); + + $digestData = + 'username="'.$username.'", realm="'.$realm.'", nonce="'.$nonce.'", '. + 'uri="'.$uri.'", cnonce="'.$cnonce.'", nc='.$nc.', qop="'.$qop.'", '. + 'response="'.$serverDigest.'"' + ; + + $request = new Request(array(), array(), array(), array(), array(), array('PHP_AUTH_DIGEST' => $digestData)); + + $entryPoint = new DigestAuthenticationEntryPoint($realm, $secret); + + $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); + $user->method('getPassword')->willReturn($password); + + $providerKey = 'TheProviderKey'; + + $tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); + $tokenStorage + ->expects($this->once()) + ->method('getToken') + ->will($this->returnValue(null)) + ; + $tokenStorage + ->expects($this->once()) + ->method('setToken') + ->with($this->equalTo(new UsernamePasswordToken($user, $password, $providerKey))) + ; + + $userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface'); + $userProvider->method('loadUserByUsername')->willReturn($user); + + $listener = new DigestAuthenticationListener($tokenStorage, $userProvider, $providerKey, $entryPoint); + + $event = $this->getMock('Symfony\Component\HttpKernel\Event\GetResponseEvent', array(), array(), '', false); + $event + ->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($request)) + ; + + $listener->handle($event); + } + + private function calculateServerDigest($username, $realm, $password, $nc, $nonce, $cnonce, $qop, $method, $uri) + { + $response = md5( + md5($username.':'.$realm.':'.$password).':'.$nonce.':'.$nc.':'.$cnonce.':'.$qop.':'.md5($method.':'.$uri) + ); + + return sprintf('username="%s", realm="%s", nonce="%s", uri="%s", cnonce="%s", nc=%s, qop="%s", response="%s"', + $username, $realm, $nonce, $uri, $cnonce, $nc, $qop, $response + ); + } +} From e90038c52e09bbb3a2c897ec7fb05467a6498e48 Mon Sep 17 00:00:00 2001 From: Malte Wunsch Date: Tue, 5 Jul 2016 10:15:40 +0200 Subject: [PATCH 25/62] [HttpKernel] fixed internal subrequests having an if-modified-since-header --- .../HttpKernel/Fragment/InlineFragmentRenderer.php | 2 ++ .../Tests/Fragment/InlineFragmentRendererTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php index a6ab82ea28efa..a61b239c158b9 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php @@ -129,6 +129,8 @@ protected function createSubRequest($uri, Request $request) } $server['REMOTE_ADDR'] = '127.0.0.1'; + unset($server['HTTP_IF_MODIFIED_SINCE']); + unset($server['HTTP_IF_NONE_MATCH']); $subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server); if ($request->headers->has('Surrogate-Capability')) { diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php index 4e487a478a600..d14ebb0d12c33 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -197,6 +197,19 @@ public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, $trustedHeaderName); } + + public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest() + { + $expectedSubRequest = Request::create('/'); + if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) { + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + } + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + $request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*')); + $strategy->render('/', $request); + } } class Bar From 965408fd2d87467b273fe6fc1578354aa9f3184d Mon Sep 17 00:00:00 2001 From: georaldc Date: Fri, 8 Jul 2016 11:46:34 -0700 Subject: [PATCH 26/62] Update getAbsoluteUri() for query string uris Apply same rules to query string only URIs as what's being used for URIs containing only hash/anchor values --- src/Symfony/Component/BrowserKit/Client.php | 6 +++--- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 000e8f3856065..85e36269244d7 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -522,9 +522,9 @@ protected function getAbsoluteUri($uri) return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri; } - // anchor? - if (!$uri || '#' == $uri[0]) { - return preg_replace('/#.*?$/', '', $currentUri).$uri; + // anchor or query string parameters? + if (!$uri || '#' == $uri[0] || '?' == $uri[0]) { + return preg_replace('/[#?].*?$/', '', $currentUri).$uri; } if ('/' !== $uri[0]) { diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 993e64a9e426c..f2b2a41d0a9e7 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -212,6 +212,15 @@ public function testRequestURIConversion() $client->request('GET', 'http://www.example.com/'); $client->request('GET', 'http'); $this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs'); + + $client = new TestClient(); + $client->request('GET', 'http://www.example.com/foo'); + $client->request('GET', '?'); + $this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?'); + $client->request('GET', '?'); + $this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?'); + $client->request('GET', '?foo=bar'); + $this->assertEquals('http://www.example.com/foo?foo=bar', $client->getRequest()->getUri(), '->request() uses the previous request for ?'); } public function testRequestReferer() From 140460707201665bec2d3e625e93b02f43aacd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 9 Jul 2016 10:59:31 +0200 Subject: [PATCH 27/62] [HttpFoundation] Add OPTIONS and TRACE to the list of safe methods --- .../Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/Tests/RequestTest.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 45f97016a04e8..125be18bbb409 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1470,7 +1470,7 @@ public function isMethod($method) */ public function isMethodSafe() { - return in_array($this->getMethod(), array('GET', 'HEAD')); + return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 1edc48c1b62db..8540cad6630ee 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1912,6 +1912,32 @@ public function getLongHostNames() array(str_repeat(':', 101)), ); } + + /** + * @dataProvider methodSafeProvider + */ + public function testMethodSafe($method, $safe) + { + $request = new Request(); + $request->setMethod($method); + $this->assertEquals($safe, $request->isMethodSafe()); + } + + public function methodSafeProvider() + { + return array( + array('HEAD', true), + array('GET', true), + array('POST', false), + array('PUT', false), + array('PATCH', false), + array('DELETE', false), + array('PURGE', false), + array('OPTIONS', true), + array('TRACE', true), + array('CONNECT', false), + ); + } } class RequestContentProxy extends Request From a3fd991c4b4c0e87eae0c530ae49de07a2349a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 10 Jul 2016 11:48:49 +0200 Subject: [PATCH 28/62] [Yaml] Fix PHPDoc of the Yaml class --- src/Symfony/Component/Yaml/Yaml.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php index d5fbbeeccf7f5..6fc4e9273d50b 100644 --- a/src/Symfony/Component/Yaml/Yaml.php +++ b/src/Symfony/Component/Yaml/Yaml.php @@ -73,20 +73,20 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup } /** - * Dumps a PHP array to a YAML string. + * Dumps a PHP value to a YAML string. * * The dump method, when supplied with an array, will do its best * to convert the array into friendly YAML. * - * @param array $array PHP array + * @param mixed $input The PHP value * @param int $inline The level where you switch to inline YAML * @param int $indent The amount of spaces to use for indentation of nested nodes * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise * - * @return string A YAML string representing the original PHP array + * @return string A YAML string representing the original PHP value */ - public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false) + public static function dump($input, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false) { if ($indent < 1) { throw new \InvalidArgumentException('The indentation must be greater than zero.'); @@ -95,6 +95,6 @@ public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvali $yaml = new Dumper(); $yaml->setIndentation($indent); - return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport); + return $yaml->dump($input, $inline, 0, $exceptionOnInvalidType, $objectSupport); } } From e04136524c1bf74c9bcfca8dc471a1339f94f537 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 11 Jul 2016 11:55:50 +0200 Subject: [PATCH 29/62] Fix the retrieval of the last username when using forwarding --- .../Security/Http/Authentication/AuthenticationUtils.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php index 4d5c71aa5c485..c6397e8ca1e3b 100644 --- a/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php +++ b/src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php @@ -65,7 +65,13 @@ public function getLastAuthenticationError($clearSession = true) */ public function getLastUsername() { - $session = $this->getRequest()->getSession(); + $request = $this->getRequest(); + + if ($request->attributes->has(Security::LAST_USERNAME)) { + return $request->attributes->get(Security::LAST_USERNAME); + } + + $session = $request->getSession(); return null === $session ? '' : $session->get(Security::LAST_USERNAME); } From 482e185daf15d7843340b1fc51c015406a7c186f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 13 Jul 2016 12:53:11 +0200 Subject: [PATCH 30/62] Revert "bug #19114 [HttpKernel] Dont close the reponse stream in debug (nicolas-grekas)" This reverts commit a0cdcb0ffbd6df9f5bed36e353d2152cb32bbf42, reversing changes made to 9c8a3e9563ff128696fecc247fd9b0077b75dddf. --- src/Symfony/Component/HttpFoundation/Response.php | 6 ++++++ src/Symfony/Component/HttpKernel/Kernel.php | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 89d151d08a27e..9babc6345a468 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -373,6 +373,12 @@ public function send() $this->sendHeaders(); $this->sendContent(); + if (function_exists('fastcgi_finish_request')) { + fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + static::closeOutputBuffers(0, true); + } + return $this; } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 6e4ca26219ee7..35b4f79461766 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -149,14 +149,6 @@ public function terminate(Request $request, Response $response) } if ($this->getHttpKernel() instanceof TerminableInterface) { - if (!$this->debug) { - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } elseif ('cli' !== PHP_SAPI) { - Response::closeOutputBuffers(0, true); - } - } - $this->getHttpKernel()->terminate($request, $response); } } From edbefacdd13c6a561de48637a9051992bb70511a Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Tue, 12 Jul 2016 09:46:53 +0200 Subject: [PATCH 31/62] PassConfig::getMergePass is not an array --- .../Component/DependencyInjection/Compiler/PassConfig.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index ab5f309f2e06b..c03ff9deb71d3 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -152,9 +152,9 @@ public function getRemovingPasses() } /** - * Gets all passes for the Merge pass. + * Gets the Merge pass. * - * @return array An array of passes + * @return CompilerPassInterface The merge pass */ public function getMergePass() { From e98c5841da01cf3dca8747e19d76999955fd69fb Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 15 Jul 2016 19:07:32 +0200 Subject: [PATCH 32/62] Fix the DBAL session handler version check for Postgresql --- .../HttpFoundation/DbalSessionHandler.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 92c7b6bf40afd..0b86f3964b569 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\DriverException; +use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Platforms\SQLServer2008Platform; /** @@ -241,9 +242,30 @@ private function getMergeSql() "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;"; case 'sqlite' === $platform: return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; - case 'postgresql' === $platform && version_compare($this->con->getServerVersion(), '9.5', '>='): + case 'postgresql' === $platform && version_compare($this->getServerVersion(), '9.5', '>='): return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)"; } } + + private function getServerVersion() + { + $params = $this->con->getParams(); + + if (isset($params['serverVersion'])) { + return $params['serverVersion']; // Explicit platform version requested (supersedes auto-detection), so we respect it. + } + + $wrappedConnection = $this->con->getWrappedConnection(); + + if ($wrappedConnection instanceof ServerInfoAwareConnection) { + return $wrappedConnection->getServerVersion(); + } + + if ($wrappedConnection instanceof \PDO) { // Support DBAL 2.4 by accessing it directly when using PDO PgSQL + return $wrappedConnection->getAttribute(\PDO::ATTR_SERVER_VERSION); + } + + return ''; // If we cannot guess the version, the empty string will mean we won't use the code for newer versions when doing version checks. + } } From 56549e7a704f38cc73538096f907655b19f457af Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 15 Jul 2016 18:54:42 +0200 Subject: [PATCH 33/62] [VarDumper] Fix dumping jsons casted as arrays --- .../Component/VarDumper/Caster/Caster.php | 4 +- .../VarDumper/Caster/ReflectionCaster.php | 2 +- .../Component/VarDumper/Cloner/VarCloner.php | 70 +++++++++++++------ .../VarDumper/Tests/CliDumperTest.php | 39 +++++++++++ .../VarDumper/Tests/VarClonerTest.php | 66 +++++++++++++++++ 5 files changed, 156 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index 4312e59352f1d..db052c8498a15 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -45,6 +45,8 @@ public static function castObject($obj, \ReflectionClass $reflector) { if ($reflector->hasMethod('__debugInfo')) { $a = $obj->__debugInfo(); + } elseif ($obj instanceof \Closure) { + $a = array(); } else { $a = (array) $obj; } @@ -52,7 +54,7 @@ public static function castObject($obj, \ReflectionClass $reflector) if ($a) { $p = array_keys($a); foreach ($p as $i => $k) { - if (!isset($k[0]) || ("\0" !== $k[0] && !$reflector->hasProperty($k))) { + if (isset($k[0]) && "\0" !== $k[0] && !$reflector->hasProperty($k)) { $p[$i] = self::PREFIX_DYNAMIC.$k; } elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) { $p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0"); diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 94c1bd3a6b8a0..8e9d212191bc6 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -69,7 +69,7 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested) } $prefix = Caster::PREFIX_DYNAMIC; - unset($a['name'], $a[$prefix.'0'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']); + unset($a['name'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']); return $a; } diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 51309c662b500..48ef6daa7fe80 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -28,7 +28,7 @@ protected function doClone($var) $i = 0; // Current iteration position in $queue $len = 1; // Length of $queue $pos = 0; // Number of cloned items past the first level - $refs = 0; // Hard references counter + $refsCounter = 0; // Hard references counter $queue = array(array($var)); // This breadth-first queue is the return value $arrayRefs = array(); // Map of queue indexes to stub array objects $hardRefs = array(); // Map of original zval hashes to stub objects @@ -60,27 +60,32 @@ protected function doClone($var) for ($i = 0; $i < $len; ++$i) { $indexed = true; // Whether the currently iterated array is numerically indexed or not $j = -1; // Position in the currently iterated array - $step = $queue[$i]; // Copy of the currently iterated array used for hard references detection - foreach ($step as $k => $v) { + $fromObjCast = array_keys($queue[$i]); + $fromObjCast = array_keys(array_flip($fromObjCast)) !== $fromObjCast; + $refs = $vals = $fromObjCast ? array_values($queue[$i]) : $queue[$i]; + foreach ($queue[$i] as $k => $v) { // $k is the original key // $v is the original value or a stub object in case of hard references - if ($indexed && $k !== ++$j) { + if ($k !== ++$j) { $indexed = false; } + if ($fromObjCast) { + $k = $j; + } if ($useExt) { - $zval = symfony_zval_info($k, $step); + $zval = symfony_zval_info($k, $refs); } else { - $step[$k] = $cookie; - if ($zval['zval_isref'] = $queue[$i][$k] === $cookie) { + $refs[$k] = $cookie; + if ($zval['zval_isref'] = $vals[$k] === $cookie) { $zval['zval_hash'] = $v instanceof Stub ? spl_object_hash($v) : null; } $zval['type'] = gettype($v); } if ($zval['zval_isref']) { - $queue[$i][$k] = &$stub; // Break hard references to make $queue completely + $vals[$k] = &$stub; // Break hard references to make $queue completely unset($stub); // independent from the original structure if (isset($hardRefs[$zval['zval_hash']])) { - $queue[$i][$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($step[$k] = $v); + $vals[$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($refs[$k] = $v); if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) { ++$v->value->refCount; } @@ -204,18 +209,18 @@ protected function doClone($var) if (isset($stub)) { if ($zval['zval_isref']) { if ($useExt) { - $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = $v = new Stub(); + $vals[$k] = $hardRefs[$zval['zval_hash']] = $v = new Stub(); $v->value = $stub; } else { - $step[$k] = new Stub(); - $step[$k]->value = $stub; - $h = spl_object_hash($step[$k]); - $queue[$i][$k] = $hardRefs[$h] = &$step[$k]; + $refs[$k] = new Stub(); + $refs[$k]->value = $stub; + $h = spl_object_hash($refs[$k]); + $vals[$k] = $hardRefs[$h] = &$refs[$k]; $values[$h] = $v; } - $queue[$i][$k]->handle = ++$refs; + $vals[$k]->handle = ++$refsCounter; } else { - $queue[$i][$k] = $stub; + $vals[$k] = $stub; } if ($a) { @@ -243,19 +248,38 @@ protected function doClone($var) $stub = $a = null; } elseif ($zval['zval_isref']) { if ($useExt) { - $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = new Stub(); - $queue[$i][$k]->value = $v; + $vals[$k] = $hardRefs[$zval['zval_hash']] = new Stub(); + $vals[$k]->value = $v; } else { - $step[$k] = $queue[$i][$k] = new Stub(); - $step[$k]->value = $v; - $h = spl_object_hash($step[$k]); - $hardRefs[$h] = &$step[$k]; + $refs[$k] = $vals[$k] = new Stub(); + $refs[$k]->value = $v; + $h = spl_object_hash($refs[$k]); + $hardRefs[$h] = &$refs[$k]; $values[$h] = $v; } - $queue[$i][$k]->handle = ++$refs; + $vals[$k]->handle = ++$refsCounter; + } + } + + if ($fromObjCast) { + $refs = $vals; + $vals = array(); + $j = -1; + foreach ($queue[$i] as $k => $v) { + foreach (array($k => $v) as $a => $v) { + } + if ($a !== $k) { + $vals = (object) $vals; + $vals->{$k} = $refs[++$j]; + $vals = (array) $vals; + } else { + $vals[$k] = $refs[++$j]; + } } } + $queue[$i] = $vals; + if (isset($arrayRefs[$i])) { if ($indexed) { $arrayRefs[$i]->class = Stub::ARRAY_INDEXED; diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 8893b6b8d05ae..4a719ca2a3751 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -133,6 +133,45 @@ public function testXmlResource() ); } + public function testJsonCast() + { + $var = (array) json_decode('{"0":{},"1":null}'); + foreach ($var as &$v) { + } + $var[] = &$v; + $var[''] = 2; + + $this->assertDumpMatchesFormat( + << {} + "1" => &1 null + 0 => &1 null + "" => 2 +] +EOTXT + , + $var + ); + } + + public function testObjectCast() + { + $var = (object) array(1 => 1); + $var->{1} = 2; + + $this->assertDumpMatchesFormat( + <<assertStringMatchesFormat($expected, print_r($clone, true)); } + public function testJsonCast() + { + $data = (array) json_decode('{"1":{}}'); + + $cloner = new VarCloner(); + $clone = $cloner->cloneVar($data); + + $expected = <<<'EOTXT' +object(Symfony\Component\VarDumper\Cloner\Data)#%i (4) { + ["data":"Symfony\Component\VarDumper\Cloner\Data":private]=> + array(2) { + [0]=> + array(1) { + [0]=> + object(Symfony\Component\VarDumper\Cloner\Stub)#%i (7) { + ["type"]=> + string(5) "array" + ["class"]=> + string(5) "assoc" + ["value"]=> + int(1) + ["cut"]=> + int(0) + ["handle"]=> + int(0) + ["refCount"]=> + int(0) + ["position"]=> + int(1) + } + } + [1]=> + array(1) { + ["1"]=> + object(Symfony\Component\VarDumper\Cloner\Stub)#%i (7) { + ["type"]=> + string(6) "object" + ["class"]=> + string(8) "stdClass" + ["value"]=> + NULL + ["cut"]=> + int(0) + ["handle"]=> + int(%i) + ["refCount"]=> + int(0) + ["position"]=> + int(0) + } + } + } + ["maxDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=> + int(20) + ["maxItemsPerDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=> + int(-1) + ["useRefHandles":"Symfony\Component\VarDumper\Cloner\Data":private]=> + int(-1) +} + +EOTXT; + ob_start(); + var_dump($clone); + $this->assertStringMatchesFormat($expected, ob_get_clean()); + } + public function testCaster() { $cloner = new VarCloner(array( From 72db6e706847c3530f7086f7361b475fe4754649 Mon Sep 17 00:00:00 2001 From: Alexander Zhuravlev Date: Tue, 12 Jul 2016 14:13:14 +1200 Subject: [PATCH 34/62] Added class existence check if is_subclass_of() fails in compiler passes --- .../DependencyInjection/RegisterListenersPass.php | 6 +++++- .../HttpKernel/DependencyInjection/FragmentRendererPass.php | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php index ebfe435f87126..326bfd184f497 100644 --- a/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php +++ b/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php @@ -97,9 +97,13 @@ public function process(ContainerBuilder $container) // We must assume that the class value has been correctly filled, even if the service is created by a factory $class = $container->getParameterBag()->resolveValue($def->getClass()); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; + if (!is_subclass_of($class, $interface)) { + if (!class_exists($class, false)) { + throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } + throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php index 3187e943c94f4..0c4cecef66423 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php @@ -54,7 +54,12 @@ public function process(ContainerBuilder $container) $class = $container->getParameterBag()->resolveValue($def->getClass()); $interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface'; + if (!is_subclass_of($class, $interface)) { + if (!class_exists($class, false)) { + throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } + throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); } From 1376e14e7e4e763e2fb99efa2fa53ce753f5490c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 18 Jul 2016 11:42:28 +0200 Subject: [PATCH 35/62] fixed CS --- .../Doctrine/HttpFoundation/DbalSessionHandler.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 0b86f3964b569..d819ff0a6c51e 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -252,8 +252,9 @@ private function getServerVersion() { $params = $this->con->getParams(); + // Explicit platform version requested (supersedes auto-detection), so we respect it. if (isset($params['serverVersion'])) { - return $params['serverVersion']; // Explicit platform version requested (supersedes auto-detection), so we respect it. + return $params['serverVersion']; } $wrappedConnection = $this->con->getWrappedConnection(); @@ -262,10 +263,12 @@ private function getServerVersion() return $wrappedConnection->getServerVersion(); } - if ($wrappedConnection instanceof \PDO) { // Support DBAL 2.4 by accessing it directly when using PDO PgSQL + // Support DBAL 2.4 by accessing it directly when using PDO PgSQL + if ($wrappedConnection instanceof \PDO) { return $wrappedConnection->getAttribute(\PDO::ATTR_SERVER_VERSION); } - return ''; // If we cannot guess the version, the empty string will mean we won't use the code for newer versions when doing version checks. + // If we cannot guess the version, the empty string will mean we won't use the code for newer versions when doing version checks. + return ''; } } From d422939f6c3ae33435b0208ff363fac9d97ebf6b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 18 Jul 2016 14:55:17 +0200 Subject: [PATCH 36/62] [VarDumper] Fix for 7.1 --- src/Symfony/Component/VarDumper/Cloner/VarCloner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 48ef6daa7fe80..90c2454e6654a 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -315,7 +315,7 @@ private static function initHashMask() if (!empty($frame['line'])) { ob_start(); debug_zval_dump($obj); - self::$hashMask = substr(ob_get_clean(), 17); + self::$hashMask = (int) substr(ob_get_clean(), 17); } } From 07467ed3a3aca5bd8760060e4472cf519b7812c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 19 Jul 2016 08:52:31 +0200 Subject: [PATCH 37/62] Fix PHP 7.1 related failures --- .travis.yml | 10 +++++----- .../Fixtures/php/lazy_service_structure.txt | 4 ++-- src/Symfony/Bridge/Twig/composer.json | 2 +- src/Symfony/Component/Console/Helper/Table.php | 2 +- .../DependencyInjection/Tests/CrossCheckTest.php | 2 +- .../Component/DependencyInjection/composer.json | 2 +- src/Symfony/Component/Form/Util/OrderedHashMap.php | 2 +- .../Component/HttpKernel/CacheWarmer/CacheWarmer.php | 2 +- src/Symfony/Component/Validator/Constraints/File.php | 12 +++++++----- src/Symfony/Component/Validator/composer.json | 2 +- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76e38fcb1beb7..500da3ee9387d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,8 +26,9 @@ matrix: - php: 5.4 - php: 5.5 - php: 5.6 - env: deps=high - php: 7.0 + env: deps=high + - php: 7.1 env: deps=low fast_finish: true @@ -50,13 +51,12 @@ before_install: - if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi - - if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi + - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi + - if [[ ! $skip && $PHP = 7.0 ]]; then (echo yes | pecl install -f apcu-5.1.5 && echo apc.enable_cli = 1 >> $INI_FILE); fi - if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi - if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi - if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini; fi - - if [[ ! $skip ]]; then composer self-update --stable; fi + - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi - if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi - if [[ ! $skip ]]; then ./phpunit install; fi - if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt index e2775cfa5f3d3..a0e3642f4949e 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt @@ -23,5 +23,5 @@ class ProjectServiceContainer extends Container } } -class stdClass_%s extends \stdClass implements \ProxyManager\%s -{%a}%A \ No newline at end of file +class stdClass_%s extends %SstdClass implements \ProxyManager\%s +{%a}%A diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 1c0cc2f10568d..f62708cf97df2 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -33,7 +33,7 @@ "symfony/security-acl": "~2.6", "symfony/stopwatch": "~2.2", "symfony/console": "~2.7", - "symfony/var-dumper": "~2.6", + "symfony/var-dumper": "~2.7.16|~2.8.9", "symfony/expression-language": "~2.4" }, "suggest": { diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index c4e24a63d916d..b1111fec6514f 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -396,7 +396,7 @@ private function fillNextRows($rows, $line) } // create a two dimensional array (rowspan x colspan) - $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows); + $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows); foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan())); diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index 7905e7f3c6b9c..423c5db2ec96a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -34,7 +34,7 @@ public function testCrossCheck($fixture, $type) $loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\'.ucfirst($type).'FileLoader'; $dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\'.ucfirst($type).'Dumper'; - $tmp = tempnam('sf_service_container', 'sf'); + $tmp = tempnam(sys_get_temp_dir(), 'sf'); file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture)); diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index d42c7a0c6c0d6..9c12d111f2bbe 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -19,7 +19,7 @@ "php": ">=5.3.9" }, "require-dev": { - "symfony/yaml": "~2.1", + "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7", "symfony/config": "~2.2", "symfony/expression-language": "~2.6" }, diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index a25df3214f63e..78687032feac6 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -130,7 +130,7 @@ public function offsetSet($key, $value) ? 0 // Imitate PHP's behavior of generating a key that equals // the highest existing integer key + 1 - : max($this->orderedKeys) + 1; + : 1 + (int) max($this->orderedKeys); } $this->orderedKeys[] = $key; diff --git a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php index 948b3ffd141c1..dba35a639a46c 100644 --- a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php +++ b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php @@ -20,7 +20,7 @@ abstract class CacheWarmer implements CacheWarmerInterface { protected function writeCacheFile($file, $content) { - $tmpFile = tempnam(dirname($file), basename($file)); + $tmpFile = @tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { @chmod($file, 0666 & ~umask()); diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php index de9fc00763686..b9c06bfdb142c 100644 --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php @@ -88,20 +88,22 @@ public function __get($option) private function normalizeBinaryFormat($maxSize) { + $sizeInt = (int) $maxSize; + if (ctype_digit((string) $maxSize)) { - $this->maxSize = (int) $maxSize; + $this->maxSize = $sizeInt; $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; } elseif (preg_match('/^\d++k$/i', $maxSize)) { - $this->maxSize = $maxSize * 1000; + $this->maxSize = $sizeInt * 1000; $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; } elseif (preg_match('/^\d++M$/i', $maxSize)) { - $this->maxSize = $maxSize * 1000000; + $this->maxSize = $sizeInt * 1000000; $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; } elseif (preg_match('/^\d++Ki$/i', $maxSize)) { - $this->maxSize = $maxSize << 10; + $this->maxSize = $sizeInt << 10; $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; } elseif (preg_match('/^\d++Mi$/i', $maxSize)) { - $this->maxSize = $maxSize << 20; + $this->maxSize = $sizeInt << 20; $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; } else { throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize)); diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index c74b46e68c0bc..96563e4fa438d 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "doctrine/common": "~2.3", - "symfony/http-foundation": "~2.1", + "symfony/http-foundation": "~2.3", "symfony/intl": "~2.7.4|~2.8", "symfony/yaml": "~2.0,>=2.0.5", "symfony/config": "~2.2", From 579801157ad7cfb28e55d6d49d173eff01230e56 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 20 Jul 2016 08:41:28 +0300 Subject: [PATCH 38/62] Fix merge --- src/Symfony/Component/DependencyInjection/composer.json | 2 +- src/Symfony/Component/Filesystem/Filesystem.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/composer.json b/src/Symfony/Component/DependencyInjection/composer.json index b2c7ec0d56cab..2506690ca6997 100644 --- a/src/Symfony/Component/DependencyInjection/composer.json +++ b/src/Symfony/Component/DependencyInjection/composer.json @@ -19,7 +19,7 @@ "php": ">=5.3.9" }, "require-dev": { - "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.9", + "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7", "symfony/config": "~2.2|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0" }, diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 7390783de6e5a..e1d62fa427e0f 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -491,7 +491,7 @@ public function tempnam($dir, $prefix) // If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) { - $tmpFile = tempnam($hierarchy, $prefix); + $tmpFile = @tempnam($hierarchy, $prefix); // If tempnam failed or no scheme return the filename otherwise prepend the scheme if (false !== $tmpFile) { From 96df6b984cdf2bc7df50e028e92fe27abb8826f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Wed, 20 Jul 2016 17:11:46 +0000 Subject: [PATCH 39/62] [HttpFoundation] HttpCache refresh stale responses containing an ETag --- .../HttpKernel/HttpCache/HttpCache.php | 3 +++ .../Tests/HttpCache/HttpCacheTest.php | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index f794d94e29d45..1b86ddd3c0c58 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -600,6 +600,9 @@ protected function lock(Request $request, Response $entry) */ protected function store(Request $request, Response $response) { + if (!$response->headers->has('Date')) { + $response->setDate(\DateTime::createFromFormat('U', time())); + } try { $this->store->write($request, $response); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index b6164dd6782fb..4eb14371448fa 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -181,6 +181,31 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch( $this->assertEquals(304, $this->response->getStatusCode()); } + public function testIncrementsMaxAgeWhenNoDateIsSpecifiedEventWhenUsingETag() + { + $this->setNextResponse( + 200, + array( + 'ETag' => '1234', + 'Cache-Control' => 'public, s-maxage=60', + ) + ); + + $this->request('GET', '/'); + $this->assertHttpKernelIsCalled(); + $this->assertEquals(200, $this->response->getStatusCode()); + $this->assertTraceContains('miss'); + $this->assertTraceContains('store'); + + sleep(2); + + $this->request('GET', '/'); + $this->assertHttpKernelIsNotCalled(); + $this->assertEquals(200, $this->response->getStatusCode()); + $this->assertTraceContains('fresh'); + $this->assertEquals(2, $this->response->headers->get('Age')); + } + public function testValidatesPrivateResponsesCachedOnTheClient() { $this->setNextResponse(200, array(), '', function ($request, $response) { From 191aef975c44aca720be971930f699bdc82d7b20 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Sat, 23 Jul 2016 18:20:27 +0300 Subject: [PATCH 40/62] [WebProfilerBundle] Fixed JSDoc parameter definition --- .../WebProfilerBundle/Resources/views/Collector/time.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig index 716f6565a2c0a..3361be296e26b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig @@ -115,7 +115,7 @@ /** * Query an element with a CSS selector. * - * @param string selector a CSS-selector-compatible query string + * @param {string} selector - a CSS-selector-compatible query string * * @return DOMElement|null */ From e89c758a76a475a44f579b874636f4dc0f1611db Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 25 Jul 2016 10:47:56 +0200 Subject: [PATCH 41/62] [DomCrawler] Inherit the namespace cache in subcrawlers --- src/Symfony/Component/DomCrawler/Crawler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 9e8b0cbc038ff..60f27f8cd7251 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1151,6 +1151,7 @@ private function createSubCrawler($nodes) $crawler = new static($nodes, $this->uri, $this->baseHref); $crawler->isHtml = $this->isHtml; $crawler->document = $this->document; + $crawler->namespaces = $this->namespaces; return $crawler; } From 7b117d332004c9cdf5619b0e019899e654ccc81c Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Mon, 25 Jul 2016 14:54:45 +0100 Subject: [PATCH 42/62] [BrowserKit] Uppercase the "GET" method in redirects --- src/Symfony/Component/BrowserKit/Client.php | 4 ++-- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 85e36269244d7..c69599083802d 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -455,7 +455,7 @@ public function followRedirect() $request = $this->internalRequest; if (in_array($this->internalResponse->getStatus(), array(302, 303))) { - $method = 'get'; + $method = 'GET'; $files = array(); $content = null; } else { @@ -464,7 +464,7 @@ public function followRedirect() $content = $request->getContent(); } - if ('get' === strtolower($method)) { + if ('GET' === strtoupper($method)) { // Don't forward parameters for GET request as it should reach the redirection URI $parameters = array(); } else { diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index f2b2a41d0a9e7..94e6983fbd000 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -410,7 +410,7 @@ public function testFollowRedirectWithMaxRedirects() $client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected'))); $client->request('POST', 'http://www.example.com/foo/foobar', array('name' => 'bar')); - $this->assertEquals('get', $client->getRequest()->getMethod(), '->followRedirect() uses a get for 302'); + $this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302'); $this->assertEquals(array(), $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method'); } From 637a4411d749bb0328561da5976470c379f9997f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81re=CC=81my=20Marodon?= Date: Mon, 25 Jul 2016 15:48:42 +0200 Subject: [PATCH 43/62] Fix the money form type render with Bootstrap3 There is a confusion between the variable naming, and the result expected. When prepend variable is false, the currency symbol must be add after the widget. When the money_patternstarts with {{, prepend variable must be false. --- .../Twig/Resources/views/Form/bootstrap_3_layout.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index ef2035ab43f04..3e9f133d37b46 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -21,12 +21,12 @@ {% block money_widget -%}
- {% set prepend = '{{' == money_pattern[0:2] %} - {% if not prepend %} + {% set append = money_pattern starts with '{{' %} + {% if not append %} {{ money_pattern|replace({ '{{ widget }}':''}) }} {% endif %} {{- block('form_widget_simple') -}} - {% if prepend %} + {% if append %} {{ money_pattern|replace({ '{{ widget }}':''}) }} {% endif %}
From 2ace5d812c72247d34b7bf3f5819c0bef2dd09f4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Wed, 20 Jul 2016 21:01:23 +0300 Subject: [PATCH 44/62] [BrowserKit] Added test for followRedirect method (POST method) --- .../Component/BrowserKit/Tests/ClientTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index f2b2a41d0a9e7..b70a35ec83ae9 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -473,6 +473,26 @@ public function testFollowRedirectWithPort() $this->assertEquals($headers, $client->getRequest()->getServer()); } + public function testFollowRedirectWithPostMethod() + { + $parameters = array('foo' => 'bar'); + $files = array('myfile.foo' => 'baz'); + $server = array('X_TEST_FOO' => 'bazbar'); + $content = 'foobarbaz'; + + $client = new TestClient(); + + $client->setNextResponse(new Response('', 307, array('Location' => 'http://www.example.com/redirected'))); + $client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content); + + $this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method'); + $this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->followRedirect() keeps parameters with POST method'); + $this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->followRedirect() keeps files with POST method'); + $this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method'); + $this->assertEquals($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method'); + $this->assertEquals('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method'); + } + public function testBack() { $client = new TestClient(); From 9c4efd0d918d865233c111a4fe33b026a2575a71 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Sat, 23 Jul 2016 18:07:08 +0300 Subject: [PATCH 45/62] [FrameworkBundle] Fixed parameters number mismatch declaration --- .../Bundle/FrameworkBundle/Command/AbstractConfigCommand.php | 2 +- .../FrameworkBundle/Tests/Templating/DelegatingEngineTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index aceaa0cbdc6dd..6afe16a8d2daf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -48,7 +48,7 @@ protected function listBundles(OutputInterface $output) } else { $output->writeln($message); $table = new Table($output); - $table->setHeaders($headers)->setRows($rows)->render($output); + $table->setHeaders($headers)->setRows($rows)->render(); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php index c5d2d8bbebede..0f887218137d3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php @@ -38,7 +38,7 @@ public function testGetExistingEngine() $delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second')); - $this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php', array('foo' => 'bar'))); + $this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php')); } /** @@ -55,7 +55,7 @@ public function testGetInvalidEngine() )); $delegatingEngine = new DelegatingEngine($container, array('engine.first', 'engine.second')); - $delegatingEngine->getEngine('template.php', array('foo' => 'bar')); + $delegatingEngine->getEngine('template.php'); } public function testRenderResponseWithFrameworkEngine() From b2d25f4d189e9f008c0609338262da9809a985f8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Sat, 23 Jul 2016 18:28:19 +0300 Subject: [PATCH 46/62] [DoctrineBridge] Fixed php doc --- .../DependencyInjection/AbstractDoctrineExtension.php | 8 ++++---- .../CompilerPass/RegisterMappingsPass.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index 876ab1d5949e0..534d762e73f11 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -314,10 +314,10 @@ protected function loadObjectManagerCacheDriver(array $objectManager, ContainerB /** * Loads a cache driver. * - * @param string $cacheDriverServiceId The cache driver name - * @param string $objectManagerName The object manager name - * @param array $cacheDriver The cache driver mapping - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The ContainerBuilder instance + * @param string $cacheName The cache driver name + * @param string $objectManagerName The object manager name + * @param array $cacheDriver The cache driver mapping + * @param ContainerBuilder $container The ContainerBuilder instance * * @return string * diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php index 9a4756ff9eac7..e37e4f66c29aa 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -111,7 +111,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface * @param string[] $managerParameters List of container parameters that could * hold the manager name. * @param string $driverPattern Pattern for the metadata driver service name - * @param string $enabledParameter Service container parameter that must be + * @param string|false $enabledParameter Service container parameter that must be * present to enable the mapping. Set to false * to not do any check, optional. * @param string $configurationPattern Pattern for the Configuration service name From c41aa03c48a6741ebd1b48d40a616f8a64b0f565 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Fri, 22 Jul 2016 17:17:18 +0300 Subject: [PATCH 47/62] Fixed bugs in names of classes and methods. --- .../DependencyInjection/FrameworkExtension.php | 8 ++++---- .../FrameworkBundle/Translation/TranslationLoader.php | 2 +- src/Symfony/Component/Config/Util/XmlUtils.php | 2 +- .../Component/Console/Helper/SymfonyQuestionHelper.php | 2 +- src/Symfony/Component/Console/Tests/ApplicationTest.php | 2 +- .../Component/Debug/Tests/MockExceptionHandler.php | 2 +- .../DependencyInjection/Loader/XmlFileLoader.php | 2 +- .../DependencyInjection/Tests/Dumper/PhpDumperTest.php | 2 +- .../Tests/Fixtures/containers/container9.php | 2 +- .../DependencyInjection/Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 2 +- .../DependencyInjection/Tests/Fixtures/xml/services6.xml | 2 +- .../DependencyInjection/Tests/Fixtures/xml/services9.xml | 2 +- .../DependencyInjection/Tests/Fixtures/yaml/services6.yml | 2 +- .../DependencyInjection/Tests/Fixtures/yaml/services9.yml | 2 +- .../Tests/Loader/XmlFileLoaderTest.php | 2 +- .../Tests/Loader/YamlFileLoaderTest.php | 2 +- src/Symfony/Component/Finder/Tests/Shell/CommandTest.php | 2 +- src/Symfony/Component/Form/Tests/AbstractLayoutTest.php | 2 +- src/Symfony/Component/Intl/Util/IntlTestHelper.php | 8 ++++---- src/Symfony/Component/Process/Tests/ProcessTest.php | 2 +- .../Component/Security/Acl/Resources/bin/generateSql.php | 2 +- .../Component/Translation/DataCollectorTranslator.php | 4 ++-- .../Validator/Constraints/AbstractComparisonValidator.php | 2 +- src/Symfony/Component/VarDumper/Caster/AmqpCaster.php | 2 +- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 15b1e1fdf3b28..77ea285860ccf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -823,10 +823,10 @@ private function getValidatorMappingFiles(ContainerBuilder $container) if (is_dir($dir = $dirname.'/Resources/config/validation')) { foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) { - $files[0][] = $file->getRealpath(); + $files[0][] = $file->getRealPath(); } foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) { - $files[1][] = $file->getRealpath(); + $files[1][] = $file->getRealPath(); } $container->addResource(new DirectoryResource($dir)); @@ -944,13 +944,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder if (is_dir($dir = $dirname.'/Resources/config/serialization')) { foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) { - $definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealpath())); + $definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealPath())); $definition->setPublic(false); $serializerLoaders[] = $definition; } foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) { - $definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealpath())); + $definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealPath())); $definition->setPublic(false); $serializerLoaders[] = $definition; diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php index 0a00cf2b1958a..b6377863afe48 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php @@ -58,7 +58,7 @@ public function loadMessages($directory, MessageCatalogue $catalogue) $extension = $catalogue->getLocale().'.'.$format; $files = $finder->files()->name('*.'.$extension)->in($directory); foreach ($files as $file) { - $domain = substr($file->getFileName(), 0, -1 * strlen($extension) - 1); + $domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1); $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain)); } } diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index d8d4eaa3b17a1..25d9b0a0abe5d 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -123,7 +123,7 @@ public static function loadFile($file, $schemaOrCallable = null) * * @return array A PHP array */ - public static function convertDomElementToArray(\DomElement $element, $checkPrefix = true) + public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true) { $prefix = (string) $element->prefix; $empty = true; diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php index c0219b6372911..8abec46007e49 100644 --- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php @@ -66,7 +66,7 @@ protected function writePrompt(OutputInterface $output, Question $question) break; - case $question instanceof ChoiceQuestion && $question->isMultiSelect(): + case $question instanceof ChoiceQuestion && $question->isMultiselect(): $choices = $question->getChoices(); $default = explode(',', $default); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 7a4079eddffaf..918200d53cfb3 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -423,7 +423,7 @@ public function testFindAlternativeNamespace() $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); - $application->add(new \foo3Command()); + $application->add(new \Foo3Command()); try { $application->find('Unknown-namespace:Unknown-command'); diff --git a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php b/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php index a85d2d15e7131..2d6ce564d23a4 100644 --- a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php +++ b/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php @@ -13,7 +13,7 @@ use Symfony\Component\Debug\ExceptionHandler; -class MockExceptionHandler extends Exceptionhandler +class MockExceptionHandler extends ExceptionHandler { public $e; diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 33b98a3aaa0bc..4336eced018eb 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -564,7 +564,7 @@ private function loadFromExtensions(\DOMDocument $xml) * * @return array A PHP array */ - public static function convertDomElementToArray(\DomElement $element) + public static function convertDomElementToArray(\DOMElement $element) { return XmlUtils::convertDomElementToArray($element); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 562b94e21e94c..118a55244597a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -100,7 +100,7 @@ public function provideInvalidParameters() { return array( array(array('foo' => new Definition('stdClass'))), - array(array('foo' => new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'))), + array(array('foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))), array(array('foo' => new Reference('foo'))), array(array('foo' => new Variable('foo'))), ); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 47064c302fbf5..695f2875ffdf4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -50,7 +50,7 @@ ->addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE))) ->addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) ->addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'))) + ->addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))) ; $container ->register('foo_with_inline', 'Foo') diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 18499a62c0ccf..abdfcbce3a55a 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 d894f673ce06a..514cce35f82fa 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -246,7 +246,7 @@ protected function getMethodCall1Service() $instance->setBar($this->get('foo')); $instance->setBar(NULL); - $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/xml/services6.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml index 9eb7b8915e627..06252b55f9422 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml @@ -32,7 +32,7 @@ - service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default") + service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default") diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index c4ddc416b4636..cba6814126f87 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -56,7 +56,7 @@ - service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default") + service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default") diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml index b1e69f5550f56..e9e91fa6ba83a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -14,7 +14,7 @@ services: calls: - [ setBar, [] ] - [ setBar ] - - [ setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'] ] + - [ setBar, ['@=service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'] ] method_call2: class: FooClass calls: diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index f2b94810969a7..84f62d25c0fd3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -36,7 +36,7 @@ services: - [setBar, ['@?foo2']] - [setBar, ['@?foo3']] - [setBar, ['@?foobaz']] - - [setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")']] + - [setBar, ['@=service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")']] foo_with_inline: class: Foo diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index ca1e7b8500848..e2a097b182f39 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -260,7 +260,7 @@ public function testLoadServices() $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); $this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 78f9bafc154f5..0827b48eb8d12 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -157,7 +157,7 @@ public function testLoadServices() $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array(new Reference('baz'), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(array('setBar', array()), array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals(array(array('setBar', array()), array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); $this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); diff --git a/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php b/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php index 0c19ab47a88c1..d45ea9d238259 100644 --- a/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php +++ b/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php @@ -148,7 +148,7 @@ public function testExecute() $this->assertInternalType('array', $result); $this->assertNotEmpty($result); - $this->assertRegexp('/PHP|HipHop/', $result[0]); + $this->assertRegExp('/PHP|HipHop/', $result[0]); } public function testCastToString() diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index cad57cabb5fc8..01b3d3757a597 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -47,7 +47,7 @@ protected function tearDown() parent::tearDown(); } - protected function assertXpathNodeValue(\DomElement $element, $expression, $nodeValue) + protected function assertXpathNodeValue(\DOMElement $element, $expression, $nodeValue) { $xpath = new \DOMXPath($element->ownerDocument); $nodeList = $xpath->evaluate($expression); diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index cefb8db9919e6..ecd5ed6b660d6 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -31,7 +31,7 @@ class IntlTestHelper * * @param \PhpUnit_Framework_TestCase $testCase */ - public static function requireIntl(\PhpUnit_Framework_TestCase $testCase) + public static function requireIntl(\PHPUnit_Framework_TestCase $testCase) { // We only run tests if the version is *one specific version*. // This condition is satisfied if @@ -63,7 +63,7 @@ public static function requireIntl(\PhpUnit_Framework_TestCase $testCase) * * @param \PhpUnit_Framework_TestCase $testCase */ - public static function requireFullIntl(\PhpUnit_Framework_TestCase $testCase) + public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase) { // We only run tests if the intl extension is loaded... if (!Intl::isExtensionLoaded()) { @@ -92,7 +92,7 @@ public static function requireFullIntl(\PhpUnit_Framework_TestCase $testCase) * * @param \PhpUnit_Framework_TestCase $testCase */ - public static function require32Bit(\PhpUnit_Framework_TestCase $testCase) + public static function require32Bit(\PHPUnit_Framework_TestCase $testCase) { if (4 !== PHP_INT_SIZE) { $testCase->markTestSkipped('PHP 32 bit is required.'); @@ -104,7 +104,7 @@ public static function require32Bit(\PhpUnit_Framework_TestCase $testCase) * * @param \PhpUnit_Framework_TestCase $testCase */ - public static function require64Bit(\PhpUnit_Framework_TestCase $testCase) + public static function require64Bit(\PHPUnit_Framework_TestCase $testCase) { if (8 !== PHP_INT_SIZE) { $testCase->markTestSkipped('PHP 64 bit is required.'); diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index f06b135e26821..0fcedccf8bf07 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1229,7 +1229,7 @@ private function getProcess($commandline, $cwd = null, array $env = null, $input } catch (RuntimeException $e) { $this->assertSame('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.', $e->getMessage()); if ($enhance) { - $process->setEnhanceSigChildCompatibility(true); + $process->setEnhanceSigchildCompatibility(true); } else { self::$notEnhancedSigchild = true; } diff --git a/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php b/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php index 4b1b38d5847f0..c425651168c77 100644 --- a/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php +++ b/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php @@ -37,7 +37,7 @@ $finder = new Finder(); $finder->name('*Platform.php')->in(dirname($reflection->getFileName())); foreach ($finder as $file) { - require_once $file->getPathName(); + require_once $file->getPathname(); $className = 'Doctrine\\DBAL\\Platforms\\'.$file->getBasename('.php'); $reflection = new ReflectionClass($className); diff --git a/src/Symfony/Component/Translation/DataCollectorTranslator.php b/src/Symfony/Component/Translation/DataCollectorTranslator.php index 4c69ff6d840c3..1aedab7449aab 100644 --- a/src/Symfony/Component/Translation/DataCollectorTranslator.php +++ b/src/Symfony/Component/Translation/DataCollectorTranslator.php @@ -124,14 +124,14 @@ private function collectMessage($locale, $domain, $id, $translation) } elseif ($catalogue->has($id, $domain)) { $state = self::MESSAGE_EQUALS_FALLBACK; - $fallbackCatalogue = $catalogue->getFallBackCatalogue(); + $fallbackCatalogue = $catalogue->getFallbackCatalogue(); while ($fallbackCatalogue) { if ($fallbackCatalogue->defines($id, $domain)) { $locale = $fallbackCatalogue->getLocale(); break; } - $fallbackCatalogue = $fallbackCatalogue->getFallBackCatalogue(); + $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); } } else { $state = self::MESSAGE_MISSING; diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php index 67d73a5ee25f8..a249abebb2ef1 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php @@ -44,7 +44,7 @@ public function validate($value, Constraint $constraint) // the DateTime constructor: // http://php.net/manual/en/datetime.formats.php if (is_string($comparedValue)) { - if ($value instanceof \DatetimeImmutable) { + if ($value instanceof \DateTimeImmutable) { // If $value is immutable, convert the compared value to a // DateTimeImmutable too $comparedValue = new \DatetimeImmutable($comparedValue); diff --git a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php index 98eede22d55d4..6a6fc9297082b 100644 --- a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php @@ -131,7 +131,7 @@ public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isN $prefix.'contentType' => $c->getContentType(), $prefix.'contentEncoding' => $c->getContentEncoding(), $prefix.'type' => $c->getType(), - $prefix.'timestamp' => $c->getTimestamp(), + $prefix.'timestamp' => $c->getTimeStamp(), $prefix.'priority' => $c->getPriority(), $prefix.'expiration' => $c->getExpiration(), $prefix.'userId' => $c->getUserId(), From d0f4434c4e0d3b498b9cfac43ee3e1298bb1f7cb Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Thu, 21 Jul 2016 10:44:16 +0300 Subject: [PATCH 48/62] [Config] Extra tests for Config component --- .../Builder/ArrayNodeDefinitionTest.php | 42 +++++++++++++++++++ .../Definition/Builder/ExprBuilderTest.php | 20 +++++++++ 2 files changed, 62 insertions(+) diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index e75ed34f469a4..b07f6079ebd90 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -185,6 +185,48 @@ public function testTrueEnableEnabledNode($expected, $config, $message) ); } + public function testCanBeDisabled() + { + $node = new ArrayNodeDefinition('root'); + $node->canBeDisabled(); + + $this->assertTrue($this->getField($node, 'addDefaults')); + $this->assertEquals(array('enabled' => false), $this->getField($node, 'falseEquivalent')); + $this->assertEquals(array('enabled' => true), $this->getField($node, 'trueEquivalent')); + $this->assertEquals(array('enabled' => true), $this->getField($node, 'nullEquivalent')); + + $nodeChildren = $this->getField($node, 'children'); + $this->assertArrayHasKey('enabled', $nodeChildren); + + $enabledNode = $nodeChildren['enabled']; + $this->assertTrue($this->getField($enabledNode, 'default')); + $this->assertTrue($this->getField($enabledNode, 'defaultValue')); + } + + public function testIgnoreExtraKeys() + { + $node = new ArrayNodeDefinition('root'); + + $this->assertFalse($this->getField($node, 'ignoreExtraKeys')); + + $result = $node->ignoreExtraKeys(); + + $this->assertEquals($node, $result); + $this->assertTrue($this->getField($node, 'ignoreExtraKeys')); + } + + public function testNormalizeKeys() + { + $node = new ArrayNodeDefinition('root'); + + $this->assertTrue($this->getField($node, 'normalizeKeys')); + + $result = $node->normalizeKeys(false); + + $this->assertEquals($node, $result); + $this->assertFalse($this->getField($node, 'normalizeKeys')); + } + public function getEnableableNodeFixtures() { return array( diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php index 147bf1324c884..ebb766eed63d8 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -150,6 +150,26 @@ public function testThenUnsetExpression() $this->assertEquals(array(), $this->finalizeTestBuilder($test)); } + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage You must specify an if part. + */ + public function testEndIfPartNotSpecified() + { + $this->getTestBuilder()->end(); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage You must specify a then part. + */ + public function testEndThenPartNotSpecified() + { + $builder = $this->getTestBuilder(); + $builder->ifPart = 'test'; + $builder->end(); + } + /** * Create a test treebuilder with a variable node, and init the validation. * From 6f0474f9a67f61936b89ae5ae04ade9d4c069431 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Tue, 19 Jul 2016 18:04:54 +0200 Subject: [PATCH 49/62] [Console] Application update PHPDoc of add and register methods --- src/Symfony/Component/Console/Application.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 11990242e85d1..590460ca0de99 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -213,7 +213,7 @@ public function getHelperSet() } /** - * Set an input definition set to be used with this application. + * Set an input definition to be used with this application. * * @param InputDefinition $definition The input definition */ @@ -335,6 +335,8 @@ public function register($name) /** * Adds an array of command objects. * + * If a Command is not enabled it will not be added. + * * @param Command[] $commands An array of commands */ public function addCommands(array $commands) @@ -348,10 +350,11 @@ public function addCommands(array $commands) * Adds a command object. * * If a command with the same name already exists, it will be overridden. + * If the command is not enabled it will not be added. * * @param Command $command A Command object * - * @return Command The registered command + * @return Command|null The registered command if enabled or null */ public function add(Command $command) { @@ -420,9 +423,9 @@ public function has($name) /** * Returns an array of all unique namespaces used by currently registered commands. * - * It does not returns the global namespace which always exists. + * It does not return the global namespace which always exists. * - * @return array An array of namespaces + * @return string[] An array of namespaces */ public function getNamespaces() { @@ -954,7 +957,7 @@ private function getSttyColumns() /** * Runs and parses mode CON if it's available, suppressing any error output. * - * @return string x or null if it could not be parsed + * @return string|null x or null if it could not be parsed */ private function getConsoleMode() { @@ -1013,7 +1016,7 @@ public function extractNamespace($name, $limit = null) * @param string $name The string * @param array|\Traversable $collection The collection * - * @return array A sorted array of similar string + * @return string[] A sorted array of similar string */ private function findAlternatives($name, $collection) { @@ -1121,7 +1124,7 @@ private function splitStringByWidth($string, $width) * * @param string $name The full name of the command * - * @return array The namespaces of the command + * @return string[] The namespaces of the command */ private function extractAllNamespaces($name) { From 2668edd05bbcd60e1146dbaa0ad5ba9498b32ba7 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 6 Jul 2016 14:07:04 +0200 Subject: [PATCH 50/62] [HttpKernel] Use flock() for HttpCache's lock files --- .../Component/HttpKernel/HttpCache/Store.php | 127 +++++++++++------- .../Tests/HttpCache/HttpCacheTestCase.php | 3 + .../HttpKernel/Tests/HttpCache/StoreTest.php | 4 + 3 files changed, 89 insertions(+), 45 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 433b0ef29b4e2..b57d4a774d5c2 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -38,7 +38,7 @@ class Store implements StoreInterface public function __construct($root) { $this->root = $root; - if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) { + if (!file_exists($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) { throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); } $this->keyCache = new \SplObjectStorage(); @@ -52,22 +52,15 @@ public function cleanup() { // unlock everything foreach ($this->locks as $lock) { - if (file_exists($lock)) { - @unlink($lock); - } + flock($lock, LOCK_UN); + fclose($lock); } - $error = error_get_last(); - if (1 === $error['type'] && false === headers_sent()) { - // send a 503 - header('HTTP/1.0 503 Service Unavailable'); - header('Retry-After: 10'); - echo '503 Service Unavailable'; - } + $this->locks = array(); } /** - * Locks the cache for a given Request. + * Tries to lock the cache for a given Request, without blocking. * * @param Request $request A Request instance * @@ -75,21 +68,24 @@ public function cleanup() */ public function lock(Request $request) { - $path = $this->getPath($this->getCacheKey($request).'.lck'); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { - return false; - } + $key = $this->getCacheKey($request); - $lock = @fopen($path, 'x'); - if (false !== $lock) { - fclose($lock); + if (!isset($this->locks[$key])) { + $path = $this->getPath($key); + if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { + return $path; + } + $h = fopen($path, 'cb'); + if (!flock($h, LOCK_EX | LOCK_NB)) { + fclose($h); - $this->locks[] = $path; + return $path; + } - return true; + $this->locks[$key] = $h; } - return !file_exists($path) ?: $path; + return true; } /** @@ -101,17 +97,37 @@ public function lock(Request $request) */ public function unlock(Request $request) { - $file = $this->getPath($this->getCacheKey($request).'.lck'); + $key = $this->getCacheKey($request); + + if (isset($this->locks[$key])) { + flock($this->locks[$key], LOCK_UN); + fclose($this->locks[$key]); + unset($this->locks[$key]); + + return true; + } - return is_file($file) ? @unlink($file) : false; + return false; } public function isLocked(Request $request) { - $path = $this->getPath($this->getCacheKey($request).'.lck'); - clearstatcache(true, $path); + $key = $this->getCacheKey($request); + + if (isset($this->locks[$key])) { + return true; // shortcut if lock held by this process + } + + if (!file_exists($path = $this->getPath($key))) { + return false; + } - return is_file($path); + $h = fopen($path, 'rb'); + flock($h, LOCK_EX | LOCK_NB, $wouldBlock); + flock($h, LOCK_UN); // release the lock we just acquired + fclose($h); + + return (bool) $wouldBlock; } /** @@ -144,7 +160,7 @@ public function lookup(Request $request) } list($req, $headers) = $match; - if (is_file($body = $this->getPath($headers['x-content-digest'][0]))) { + if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { return $this->restoreResponse($headers, $body); } @@ -291,7 +307,7 @@ private function requestsMatch($vary, $env1, $env2) */ private function getMetadata($key) { - if (false === $entries = $this->load($key)) { + if (!$entries = $this->load($key)) { return array(); } @@ -307,7 +323,15 @@ private function getMetadata($key) */ public function purge($url) { - if (is_file($path = $this->getPath($this->getCacheKey(Request::create($url))))) { + $key = $this->getCacheKey(Request::create($url)); + + if (isset($this->locks[$key])) { + flock($this->locks[$key], LOCK_UN); + fclose($this->locks[$key]); + unset($this->locks[$key]); + } + + if (file_exists($path = $this->getPath($key))) { unlink($path); return true; @@ -327,7 +351,7 @@ private function load($key) { $path = $this->getPath($key); - return is_file($path) ? file_get_contents($path) : false; + return file_exists($path) ? file_get_contents($path) : false; } /** @@ -341,23 +365,36 @@ private function load($key) private function save($key, $data) { $path = $this->getPath($key); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { - return false; - } - $tmpFile = tempnam(dirname($path), basename($path)); - if (false === $fp = @fopen($tmpFile, 'wb')) { - return false; - } - @fwrite($fp, $data); - @fclose($fp); + if (isset($this->locks[$key])) { + $fp = $this->locks[$key]; + @ftruncate($fp, 0); + @fseek($fp, 0); + $len = @fwrite($fp, $data); + if (strlen($data) !== $len) { + @ftruncate($fp, 0); - if ($data != file_get_contents($tmpFile)) { - return false; - } + return false; + } + } else { + if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { + return false; + } - if (false === @rename($tmpFile, $path)) { - return false; + $tmpFile = tempnam(dirname($path), basename($path)); + if (false === $fp = @fopen($tmpFile, 'wb')) { + return false; + } + @fwrite($fp, $data); + @fclose($fp); + + if ($data != file_get_contents($tmpFile)) { + return false; + } + + if (false === @rename($tmpFile, $path)) { + return false; + } } @chmod($path, 0666 & ~umask()); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 1fcd2107519bd..722e98760f111 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -50,6 +50,9 @@ protected function setUp() protected function tearDown() { + if ($this->cache) { + $this->cache->getStore()->cleanup(); + } $this->kernel = null; $this->cache = null; $this->caches = null; diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index 4198ce4031340..bf4239beaea61 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -19,6 +19,10 @@ class StoreTest extends \PHPUnit_Framework_TestCase { protected $request; protected $response; + + /** + * @var Store + */ protected $store; protected function setUp() From 66e694ed57ed76cf0b2d8b960ee505a87a8fd054 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 25 Jul 2016 22:35:22 +0200 Subject: [PATCH 51/62] [Process] Fix write access check for pipes on Windows --- .../Component/Process/Pipes/WindowsPipes.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 071dd0334a74f..db66c672a7dae 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -52,27 +52,30 @@ public function __construct($disableOutput, $input) Process::STDERR => Process::ERR, ); $tmpDir = sys_get_temp_dir(); - if (!@fopen($file = $tmpDir.'\\sf_proc_00.check', 'wb')) { - throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable'); - } - @unlink($file); + $error = 'unknown reason'; + set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); 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)) { + if (file_exists($file) && !unlink($file)) { continue 2; } - $h = @fopen($file, 'xb'); + $h = fopen($file, 'xb'); + if (!$h && false === strpos($error, 'File exists')) { + restore_error_handler(); + throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error)); + } if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) { continue 2; } if (isset($this->files[$pipe])) { - @unlink($this->files[$pipe]); + unlink($this->files[$pipe]); } $this->files[$pipe] = $file; } break; } + restore_error_handler(); } parent::__construct($input); From 754bd4ecd43e60ec23992b56eb64d53392dd61d4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Tue, 26 Jul 2016 15:42:00 +0300 Subject: [PATCH 52/62] [TwigBridge] Removed extra arguments in 2 places. --- src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php index 7fc278758eb38..ea105e8d955e4 100644 --- a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php @@ -11,7 +11,6 @@ namespace Symfony\Bridge\Twig\Extension; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; /** @@ -48,7 +47,7 @@ public function getFunctions() */ public function getLogoutPath($key = null) { - return $this->generator->getLogoutPath($key, UrlGeneratorInterface::ABSOLUTE_PATH); + return $this->generator->getLogoutPath($key); } /** @@ -60,7 +59,7 @@ public function getLogoutPath($key = null) */ public function getLogoutUrl($key = null) { - return $this->generator->getLogoutUrl($key, UrlGeneratorInterface::ABSOLUTE_URL); + return $this->generator->getLogoutUrl($key); } /** From 165529bb55ed9fd7ac326619c1ba11022c668337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Romey?= Date: Tue, 26 Jul 2016 18:22:37 +0200 Subject: [PATCH 53/62] [DependencyInjection] Fixed deprecated default message template with XML --- .../DependencyInjection/Loader/XmlFileLoader.php | 2 +- .../Tests/Fixtures/xml/services_deprecated.xml | 11 +++++++++++ .../Tests/Loader/XmlFileLoaderTest.php | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_deprecated.xml diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 4b7565a807bec..c47821922cbf3 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -187,7 +187,7 @@ private function parseDefinition(\DOMElement $service, $file) } if ($deprecated = $this->getChildren($service, 'deprecated')) { - $definition->setDeprecated(true, $deprecated[0]->nodeValue); + $definition->setDeprecated(true, $deprecated[0]->nodeValue ?: null); } $definition->setArguments($this->getArgumentsAsPhp($service, 'argument')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_deprecated.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_deprecated.xml new file mode 100644 index 0000000000000..c19a47adf517f --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_deprecated.xml @@ -0,0 +1,11 @@ + + + + + + + + The "%service_id%" service is deprecated. + + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index b1e5decff83f8..0db9de63f7ef8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -324,6 +324,21 @@ public function testParseTagWithEmptyNameThrowsException() $loader->load('tag_with_empty_name.xml'); } + public function testDeprecated() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services_deprecated.xml'); + + $this->assertTrue($container->getDefinition('foo')->isDeprecated()); + $message = 'The "foo" service is deprecated. You should stop using it, as it will soon be removed.'; + $this->assertSame($message, $container->getDefinition('foo')->getDeprecationMessage('foo')); + + $this->assertTrue($container->getDefinition('bar')->isDeprecated()); + $message = 'The "bar" service is deprecated.'; + $this->assertSame($message, $container->getDefinition('bar')->getDeprecationMessage('bar')); + } + public function testConvertDomElementToArray() { $doc = new \DOMDocument('1.0'); From 7f3145c60615ce13589b2298048ade8619783cb2 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Wed, 27 Jul 2016 23:41:42 +0300 Subject: [PATCH 54/62] [TwigBundle] Removed redundant return statement. --- .../Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php index 0ee259fb7b23b..269e029a0858b 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php @@ -48,7 +48,7 @@ public function testExists() ; $loader = new FilesystemLoader($locator, $parser); - return $this->assertTrue($loader->exists($template)); + $this->assertTrue($loader->exists($template)); } /** From 891e2ea17b43da17b4def6df0d3310530f8a6ea6 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Thu, 28 Jul 2016 10:50:15 +0300 Subject: [PATCH 55/62] [EventDispatcher] Removed unused variable --- .../EventDispatcher/Tests/AbstractEventDispatcherTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php index 2e4c3fd97ff0f..bae74bb888df7 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php @@ -128,7 +128,7 @@ public function testDispatch() public function testLegacyDispatch() { $event = new Event(); - $return = $this->dispatcher->dispatch(self::preFoo, $event); + $this->dispatcher->dispatch(self::preFoo, $event); $this->assertEquals('pre.foo', $event->getName()); } From 9813888a4f2efcc79e5bf711e64ce862c9715ee8 Mon Sep 17 00:00:00 2001 From: ReenExe Date: Thu, 28 Jul 2016 19:22:45 +0300 Subject: [PATCH 56/62] undefined offset fix (#19406) --- .../Component/Console/Helper/Table.php | 27 ++++++++++++------- .../Console/Tests/Helper/TableTest.php | 19 +++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index b1111fec6514f..0d947843a996c 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -101,11 +101,11 @@ public static function getStyleDefinition($name) self::$styles = self::initStyles(); } - if (!self::$styles[$name]) { - throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); + if (isset(self::$styles[$name])) { + return self::$styles[$name]; } - return self::$styles[$name]; + throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); } /** @@ -117,13 +117,7 @@ public static function getStyleDefinition($name) */ public function setStyle($name) { - if ($name instanceof TableStyle) { - $this->style = $name; - } elseif (isset(self::$styles[$name])) { - $this->style = self::$styles[$name]; - } else { - throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } + $this->style = $this->resolveStyle($name); return $this; } @@ -611,4 +605,17 @@ private static function initStyles() 'symfony-style-guide' => $styleGuide, ); } + + private function resolveStyle($name) + { + if ($name instanceof TableStyle) { + return $name; + } + + if (isset(self::$styles[$name])) { + return self::$styles[$name]; + } + + throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); + } } diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index c933ff6a69760..9628bc36faaee 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -577,6 +577,25 @@ public function testRowSeparator() $this->assertEquals($table, $table->addRow(new TableSeparator()), 'fluent interface on addRow() with a single TableSeparator() works'); } + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testIsNotDefinedStyleException() + { + $table = new Table($this->getOutputStream()); + $table->setStyle('absent'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testGetStyleDefinition() + { + Table::getStyleDefinition('absent'); + } + protected function getOutputStream() { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); From 217274b3c1729afdfb5b2309b2102a152b58c9f9 Mon Sep 17 00:00:00 2001 From: ReenExe Date: Fri, 22 Jul 2016 19:57:17 +0300 Subject: [PATCH 57/62] Console table cleanup --- .../Component/Console/Helper/Table.php | 8 +------- .../Console/Tests/Helper/TableTest.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index a8d90966fd43b..04aa98d5b41f3 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -151,13 +151,7 @@ public function setColumnStyle($columnIndex, $name) { $columnIndex = intval($columnIndex); - if ($name instanceof TableStyle) { - $this->columnStyles[$columnIndex] = $name; - } elseif (isset(self::$styles[$name])) { - $this->columnStyles[$columnIndex] = self::$styles[$name]; - } else { - throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } + $this->columnStyles[$columnIndex] = $this->resolveStyle($name); return $this; } diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 2af74b2daf1f1..7eddb13140960 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -650,6 +650,25 @@ public function testGetStyleDefinition() Table::getStyleDefinition('absent'); } + /** + * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testIsNotDefinedStyleException() + { + $table = new Table($this->getOutputStream()); + $table->setStyle('absent'); + } + + /** + * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testGetStyleDefinition() + { + Table::getStyleDefinition('absent'); + } + protected function getOutputStream() { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); From 6404e8e033980ad4d522f71e0c3278d4e53d22b8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 28 Jul 2016 12:58:23 -0400 Subject: [PATCH 58/62] fixed bad auto merge --- .../Console/Tests/Helper/TableTest.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 7eddb13140960..c3182329caf56 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -641,25 +641,6 @@ public function testIsNotDefinedStyleException() $table->setStyle('absent'); } - /** - * @expectedException Symfony\Component\Console\Exception\InvalidArgumentException - * @expectedExceptionMessage Style "absent" is not defined. - */ - public function testGetStyleDefinition() - { - Table::getStyleDefinition('absent'); - } - - /** - * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException - * @expectedExceptionMessage Style "absent" is not defined. - */ - public function testIsNotDefinedStyleException() - { - $table = new Table($this->getOutputStream()); - $table->setStyle('absent'); - } - /** * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException * @expectedExceptionMessage Style "absent" is not defined. From 7af59cdf867225e454cf2b0256823e95c14d5bab Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Wed, 27 Jul 2016 12:20:49 +0200 Subject: [PATCH 59/62] [Console] Overcomplete argument exception message tweak. --- src/Symfony/Component/Console/Input/ArgvInput.php | 7 ++++++- .../Component/Console/Tests/Input/ArgvInputTest.php | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 1732387f7b375..f18d6e189970c 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -174,7 +174,12 @@ private function parseArgument($token) // unexpected argument } else { - throw new \RuntimeException('Too many arguments.'); + $all = $this->definition->getArguments(); + if (count($all)) { + throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)))); + } + + throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token)); } } diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index d2c540e6fe418..3b0dc3f231659 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -183,7 +183,17 @@ public function provideInvalidInput() array( array('cli.php', 'foo', 'bar'), new InputDefinition(), - 'Too many arguments.', + 'No arguments expected, got "foo".', + ), + array( + array('cli.php', 'foo', 'bar'), + new InputDefinition(array(new InputArgument('number'))), + 'Too many arguments, expected arguments "number".', + ), + array( + array('cli.php', 'foo', 'bar', 'zzz'), + new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))), + 'Too many arguments, expected arguments "number" "county".', ), array( array('cli.php', '--foo'), From 774c984863e8bb891eb73d6902ef02419b7f93e4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pavlov Date: Thu, 28 Jul 2016 14:36:19 +0300 Subject: [PATCH 60/62] Minor fixes --- .../Tests/Extension/ExpressionExtensionTest.php | 1 - .../DependencyInjection/FrameworkExtension.php | 1 - .../FrameworkExtensionTest.php | 1 - .../TestBundle/Controller/SessionController.php | 2 +- .../Command/UserPasswordEncoderCommand.php | 2 +- .../Tests/Helper/LegacyDialogHelperTest.php | 5 ----- .../Debug/Tests/DebugClassLoaderTest.php | 1 - .../Compiler/ResolveReferencesToAliasesPass.php | 1 - .../ReplaceAliasByActualDefinitionPassTest.php | 2 +- .../Tests/ContainerBuilderTest.php | 2 +- .../Fixtures/containers/legacy-container9.php | 1 - .../Tests/Loader/XmlFileLoaderTest.php | 1 - .../Component/DomCrawler/Tests/FormTest.php | 1 - .../Extension/Core/Type/CollectionTypeTest.php | 1 - .../Handler/LegacyPdoSessionHandlerTest.php | 2 +- .../Tests/EventListener/LocaleListenerTest.php | 1 - .../Tests/EventListener/RouterListenerTest.php | 1 - .../Command/BarCommand.php | 1 - .../AbstractNumberFormatterTest.php | 2 +- .../Tests/PropertyAccessorArrayAccessTest.php | 2 +- .../Tests/PropertyAccessorCollectionTest.php | 16 ++++------------ .../Core/Tests/LegacySecurityContextTest.php | 2 -- .../Templating/Tests/DelegatingEngineTest.php | 2 +- .../Translation/Tests/PluralizationRulesTest.php | 6 +++--- 24 files changed, 15 insertions(+), 42 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php index 0c7cc1bd4168c..6d457e395b07e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\ExpressionExtension; -use Symfony\Component\ExpressionLanguage\Expression; class ExpressionExtensionTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 77ea285860ccf..1342cc0fce7fb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -23,7 +23,6 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\Config\FileLocator; -use Symfony\Component\Validator\Validation; /** * FrameworkExtension. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 3c1a2335141e0..92bd30832abf1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Validator\Validation; abstract class FrameworkExtensionTest extends TestCase { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php index bf22e63370139..735178320fa95 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php @@ -42,7 +42,7 @@ public function welcomeAction(Request $request, $name = null) public function logoutAction(Request $request) { - $request->getSession('session')->invalidate(); + $request->getSession()->invalidate(); return new Response('Session cleared.'); } diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index 5dbd830a39da5..342ae791475e2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } - $passwordQuestion = $this->createPasswordQuestion($input, $output); + $passwordQuestion = $this->createPasswordQuestion(); $password = $output->askQuestion($passwordQuestion); } diff --git a/src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php index 3310e075bffff..79bf7b172ade9 100644 --- a/src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php @@ -248,11 +248,6 @@ protected function getConsoleOutput($stderr) return $output; } - private function hasStderrSupport() - { - return false === $this->isRunningOS400(); - } - private function hasSttyAvailable() { exec('stty 2>&1', $output, $exitcode); diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php index 02005187bb226..eeec0e0beb081 100644 --- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php @@ -13,7 +13,6 @@ use Symfony\Component\Debug\DebugClassLoader; use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\Exception\ContextErrorException; class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php index a1ba8a2732bb4..fed851a88d213 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php @@ -12,7 +12,6 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php index 7cb63c6613663..1b2ec6bd7604b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php @@ -51,7 +51,7 @@ public function testProcess() $this->assertSame('b_alias', $aDefinition->getFactoryService(false)); $this->assertTrue($container->has('container')); - $resolvedFactory = $aDefinition->getFactory(false); + $resolvedFactory = $aDefinition->getFactory(); $this->assertSame('b_alias', (string) $resolvedFactory[0]); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index b066b4e611d4d..7870c40ea9841 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -100,7 +100,7 @@ public function testGet() try { @$builder->get('baz'); $this->fail('->get() throws a ServiceCircularReferenceException if the service has a circular reference to itself'); - } catch (\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) { + } catch (ServiceCircularReferenceException $e) { $this->assertEquals('Circular reference detected for service "baz", path: "baz".', $e->getMessage(), '->get() throws a LogicException if the service has a circular reference to itself'); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php index 9f4210c9d5b7f..06b4e83b15a84 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/legacy-container9.php @@ -4,7 +4,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; $container = new ContainerBuilder(); $container-> diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index e2a097b182f39..2de5915f4ef41 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -13,7 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 3035e8d371d96..91e87cc25dbe3 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -13,7 +13,6 @@ use Symfony\Component\DomCrawler\Form; use Symfony\Component\DomCrawler\FormFieldRegistry; -use Symfony\Component\DomCrawler\Field; class FormTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php index fe4543e8442fa..c69679a475045 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; -use Symfony\Component\Form\Form; use Symfony\Component\Form\Tests\Fixtures\Author; use Symfony\Component\Form\Tests\Fixtures\AuthorType; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php index 4efb33cd09cca..f8497f53ec7dc 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php @@ -58,7 +58,7 @@ public function testWrongTableOptionsRead() { $storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' => 'bad_name')); $this->setExpectedException('RuntimeException'); - $storage->read('foo', 'bar'); + $storage->read('foo'); } public function testWriteRead() diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index ecc4eb02768fd..30c823c83cd1e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\EventListener\LocaleListener; use Symfony\Component\HttpKernel\HttpKernelInterface; diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 5b77d8bb94303..122fe2f76a054 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\EventListener\RouterListener; use Symfony\Component\HttpKernel\HttpKernelInterface; diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php index f3fd14b55de8b..977976b75f88b 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php @@ -3,7 +3,6 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command; use Symfony\Component\Console\Command\Command; -use Symfony\Component\HttpKernel\Bundle; /** * This command has a required parameter on the constructor and will be ignored by the default Bundle implementation. diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 9eb786844269c..e424b715fce4e 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -656,7 +656,7 @@ public function testParseTypeInt32($value, $expected, $message = '') { $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $parsedValue = $formatter->parse($value, NumberFormatter::TYPE_INT32); - $this->assertSame($expected, $parsedValue); + $this->assertSame($expected, $parsedValue, $message); } public function parseTypeInt32Provider() diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php index a253d4030f1ef..07f44f19d8a11 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php @@ -81,6 +81,6 @@ public function testIsReadable($collection, $path) */ public function testIsWritable($collection, $path) { - $this->assertTrue($this->propertyAccessor->isWritable($collection, $path, 'Updated')); + $this->assertTrue($this->propertyAccessor->isWritable($collection, $path)); } } diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index 17518468ebad8..ad87687bc0561 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -166,33 +166,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound() public function testIsWritableReturnsTrueIfAdderAndRemoverExists() { $car = $this->getMock(__CLASS__.'_Car'); - $axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third')); - - $this->assertTrue($this->propertyAccessor->isWritable($car, 'axes', $axes)); + $this->assertTrue($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyAdderExists() { $car = $this->getMock(__CLASS__.'_CarOnlyAdder'); - $axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third')); - - $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes)); + $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyRemoverExists() { $car = $this->getMock(__CLASS__.'_CarOnlyRemover'); - $axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third')); - - $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes)); + $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists() { $car = $this->getMock(__CLASS__.'_CarNoAdderAndRemover'); - $axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third')); - - $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes)); + $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php index 92d7c163a70fb..fbb847eed596f 100644 --- a/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php +++ b/src/Symfony/Component/Security/Core/Tests/LegacySecurityContextTest.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Security\Core\Tests; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; -use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; use Symfony\Component\Security\Core\SecurityContext; /** diff --git a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php index 368723c884a57..e9cb5fc472066 100644 --- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php @@ -121,7 +121,7 @@ public function testGetInvalidEngine() $secondEngine = $this->getEngineMock('template.php', false); $delegatingEngine = new DelegatingEngine(array($firstEngine, $secondEngine)); - $delegatingEngine->getEngine('template.php', array('foo' => 'bar')); + $delegatingEngine->getEngine('template.php'); } private function getEngineMock($template, $supports) diff --git a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 8ce2c58defb9e..78bbc87eece40 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -37,7 +37,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase */ public function testFailedLangcodes($nplural, $langCodes) { - $matrix = $this->generateTestData($nplural, $langCodes); + $matrix = $this->generateTestData($langCodes); $this->validateMatrix($nplural, $matrix, false); } @@ -46,7 +46,7 @@ public function testFailedLangcodes($nplural, $langCodes) */ public function testLangcodes($nplural, $langCodes) { - $matrix = $this->generateTestData($nplural, $langCodes); + $matrix = $this->generateTestData($langCodes); $this->validateMatrix($nplural, $matrix); } @@ -108,7 +108,7 @@ protected function validateMatrix($nplural, $matrix, $expectSuccess = true) } } - protected function generateTestData($plural, $langCodes) + protected function generateTestData($langCodes) { $matrix = array(); foreach ($langCodes as $langCode) { From acff9736bebeaf680b4c30bab44bb91595e27a37 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 30 Jul 2016 04:48:30 -0400 Subject: [PATCH 61/62] updated CHANGELOG for 2.8.9 --- CHANGELOG-2.8.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 27060f7527791..f3c89cff979bb 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,37 @@ 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.9 (2016-07-30) + + * bug #19470 undefined offset fix (#19406) (ReenExe) + * bug #19300 [HttpKernel] Use flock() for HttpCache's lock files (mpdude) + * bug #19428 [Process] Fix write access check for pipes on Windows (nicolas-grekas) + * bug #19439 [DependencyInjection] Fixed deprecated default message template with XML (jeremyFreeAgent) + * bug #19397 [HttpFoundation] HttpCache refresh stale responses containing an ETag (maennchen) + * bug #19426 [Form] Fix the money form type render with Bootstrap3 (Th3Mouk) + * bug #19422 [DomCrawler] Inherit the namespace cache in subcrawlers (stof) + * bug #19425 [BrowserKit] Uppercase the "GET" method in redirects (jakzal) + * bug #19384 Fix PHP 7.1 related failures (nicolas-grekas) + * bug #19379 [VarDumper] Fix for PHP 7.1 (nicolas-grekas) + * bug #19342 Added class existence check if is_subclass_of() fails in compiler passes (SCIF) + * bug #19369 Fix the DBAL session handler version check for Postgresql (stof) + * bug #19368 [VarDumper] Fix dumping jsons casted as arrays (nicolas-grekas) + * bug #19334 [Security] Fix the retrieval of the last username when using forwarding (stof) + * bug #19321 [HttpFoundation] Add OPTIONS and TRACE to the list of safe methods (dunglas) + * bug #19317 [BrowserKit] Update Client::getAbsoluteUri() for query string only URIs (georaldc) + * bug #19298 [ClassLoader] Fix declared classes being computed when not needed (nicolas-grekas) + * bug #19316 [Validator] Added additional MasterCard range to the CardSchemeValidator (Dennis Væversted) + * bug #19290 [HttpKernel] fixed internal subrequests having an if-modified-since-header (MalteWunsch) + * bug #19307 [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener (Maxime STEINHAUSSER) + * bug #19309 [DoctrineBridge] added missing error code for constraint. (Koc) + * bug #19306 [Form] fixed bug - name in ButtonBuilder (cheprasov) + * bug #19292 [varDumper] Fix missing usage of ExceptionCaster::$traceArgs (nicolas-grekas) + * bug #19288 [VarDumper] Fix indentation trimming in ExceptionCaster (nicolas-grekas) + * bug #19267 [Validator] UuidValidator must accept a Uuid constraint. (hhamon) + * bug #19186 Fix for #19183 to add support for new PHP MongoDB extension in sessions. (omanizer) + * bug #19253 [Console] Fix block() padding formatting after #19189 (chalasr) + * bug #19218 [Security][Guard] check if session exist before using it (pasdeloup) + * 2.8.8 (2016-06-30) * bug #19217 [HttpKernel] Inline ValidateRequestListener logic into HttpKernel (nicolas-grekas) From 75257399709b73241e03e369e4f1c870e50562d2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 30 Jul 2016 04:48:39 -0400 Subject: [PATCH 62/62] updated VERSION for 2.8.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 b47d645565941..e8dd596cad1e2 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.9-DEV'; + const VERSION = '2.8.9'; const VERSION_ID = 20809; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 9; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019';