From 30922a2d3258552dc06ccfab22b26a4b7dc18153 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 06:15:53 +0100 Subject: [PATCH 01/74] updated CHANGELOG for 2.7.40 --- CHANGELOG-2.7.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index 916ce96ddb47..16c534250090 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,26 @@ 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.40 (2018-01-05) + + * bug #25532 [HttpKernel] Disable CSP header on exception pages (ostrolucky) + * bug #25491 [Routing] Use the default host even if context is empty (sroze) + * bug #25662 Dumper shouldn't use html format for phpdbg / cli-server (jhoff) + * bug #25529 [Validator] Fix access to root object when using composite constraint (ostrolucky) + * bug #25430 Fixes for Oracle in PdoSessionHandler (elislenio) + * bug #25599 Add application/ld+json format associated to json (vincentchalamon) + * bug #25407 [Console] Commands with an alias should not be recognized as ambiguous (Simperfit) + * bug #25521 [Console] fix a bug when you are passing a default value and passing -n would output the index (Simperfit) + * bug #25489 [FrameworkBundle] remove esi/ssi renderers if inactive (dmaicher) + * bug #25427 Preserve percent-encoding in URLs when performing redirects in the UrlMatcher (mpdude) + * bug #25480 [FrameworkBundle] add missing validation options to XSD file (xabbuh) + * bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit) + * bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque) + * bug #25408 [Debug] Fix catching fatal errors in case of nested error handlers (nicolas-grekas) + * bug #25330 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) (stephank) + * bug #25410 [HttpKernel] Fix logging of post-terminate errors/exceptions (nicolas-grekas) + * bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit) + * 2.7.39 (2017-12-04) * bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos) From daffb5b9856ecab06496ef92b73af2b581f12317 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 06:15:59 +0100 Subject: [PATCH 02/74] update CONTRIBUTORS for 2.7.40 --- CONTRIBUTORS.md | 85 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 30d8ae3f828e..85b3003b2abc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -13,13 +13,13 @@ Symfony is the result of the work of many people who made the code better - Jordi Boggiano (seldaek) - Victor Berchet (victor) - Johannes S (johannes) - - Jakub Zalas (jakubzalas) - Kévin Dunglas (dunglas) + - Jakub Zalas (jakubzalas) - Kris Wallsmith (kriswallsmith) - Ryan Weaver (weaverryan) + - Robin Chalas (chalas_r) - Javier Eguiluz (javier.eguiluz) - Maxime Steinhausser (ogizanagi) - - Robin Chalas (chalas_r) - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) - Grégoire Pineau (lyrixx) @@ -48,21 +48,22 @@ Symfony is the result of the work of many people who made the code better - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Iltar van der Berg (kjarli) + - Yonel Ceruto (yonelceruto) - Bulat Shakirzyanov (avalanche123) - Peter Rehm (rpet) - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) - - Yonel Ceruto (yonelceruto) - Miha Vrhovnik - Matthias Pigulla (mpdude) - Diego Saint Esteben (dii3g0) + - Dany Maillard (maidmaid) - Konstantin Kudryashov (everzet) - - Bilal Amarni (bamarni) - Kevin Bond (kbond) - - Dany Maillard (maidmaid) + - Bilal Amarni (bamarni) - Pierre du Plessis (pierredup) - Florin Patan (florinpatan) - Jérémy DERUSSÉ (jderusse) + - Amrouche Hamza (simperfit) - Gábor Egyed (1ed) - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) @@ -70,16 +71,17 @@ Symfony is the result of the work of many people who made the code better - Eric Clemmons (ericclemmons) - Jáchym Toušek (enumag) - Charles Sarrazin (csarrazi) + - Titouan Galopin (tgalopin) + - Samuel ROZE (sroze) - Konstantin Myakshin (koc) - Christian Raue - Arnout Boks (aboks) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Titouan Galopin (tgalopin) + - Issei Murasawa (issei_m) - Douglas Greenshields (shieldo) - Tobias Nyholm (tobias) - - Issei Murasawa (issei_m) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) @@ -97,12 +99,11 @@ Symfony is the result of the work of many people who made the code better - Arnaud Le Blanc (arnaud-lb) - Maxime STEINHAUSSER - Michal Piotrowski (eventhorizon) - - Samuel ROZE (sroze) - Tim Nagel (merk) - - Amrouche Hamza (simperfit) + - Vladimir Reznichenko (kalessil) - Brice BERNARD (brikou) + - David Maicher (dmaicher) - Baptiste Clavié (talus) - - Vladimir Reznichenko (kalessil) - marc.weistroff - lenar - Alexander Schwenn (xelaris) @@ -118,17 +119,16 @@ Symfony is the result of the work of many people who made the code better - Tomáš Votruba (tomas_votruba) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) - - David Maicher (dmaicher) - Eric GELOEN (gelo) - Daniel Wehner (dawehner) - Tugdual Saunier (tucksaun) + - Grégoire Paris (greg0ire) - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) - Sebastiaan Stok (sstok) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - - Grégoire Paris (greg0ire) - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) - Tigran Azatyan (tigranazatyan) @@ -139,6 +139,8 @@ Symfony is the result of the work of many people who made the code better - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) - Andréia Bohner (andreia) + - Alex Pott + - Julien Falque (julienfalque) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - jwdeitch @@ -147,11 +149,9 @@ Symfony is the result of the work of many people who made the code better - Jérôme Vasseur (jvasseur) - Oleg Voronkovich - Philipp Wahala (hifi) - - Alex Pott - Vyacheslav Pavlov - Richard van Laak (rvanlaak) - Javier Spagnoletti (phansys) - - Julien Falque (julienfalque) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Rouven Weßling (realityking) @@ -174,6 +174,7 @@ Symfony is the result of the work of many people who made the code better - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - Daniel Espendiller + - Valentin Udaltsov (vudaltsov) - Possum - Dorian Villet (gnutix) - Sergey Linnik (linniksa) @@ -190,7 +191,6 @@ Symfony is the result of the work of many people who made the code better - Stepan Anchugov (kix) - bronze1man - sun (sun) - - Valentin Udaltsov (vudaltsov) - Larry Garfield (crell) - Martin Schuhfuß (usefulthink) - apetitpa @@ -247,11 +247,13 @@ Symfony is the result of the work of many people who made the code better - Alessandro Chitolina - Kristen Gilden (kgilden) - Pierre-Yves LEBECQ (pylebecq) + - Niels Keurentjes (curry684) - Jordan Samouh (jordansamouh) - Jakub Kucharovic (jkucharovic) - Uwe Jäger (uwej711) - Eugene Leonovich (rybakit) - Filippo Tessarotto + - Gabriel Ostrolucký - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) - GordonsLondon @@ -270,9 +272,11 @@ Symfony is the result of the work of many people who made the code better - DQNEO - jdhoek - Pavel Batanov (scaytrase) + - Bob den Otter (bopp) - Nikita Konstantinov - Wodor Wodorski - Oskar Stark (oskarstark) + - Dariusz - Thomas Lallement (raziel057) - Giorgio Premi - Matthieu Napoli (mnapoli) @@ -284,6 +288,7 @@ Symfony is the result of the work of many people who made the code better - Kim Hemsø Rasmussen (kimhemsoe) - Wouter Van Hecke - Jérôme Parmentier (lctrs) + - Michael Babker (mbabker) - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Marc Weistroff (futurecat) @@ -301,6 +306,7 @@ Symfony is the result of the work of many people who made the code better - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) - Jerzy Zawadzki (jzawadzki) + - Wouter J - Ismael Ambrosi (iambrosi) - Baptiste Lafontaine - Aurelijus Valeiša (aurelijus) @@ -311,7 +317,6 @@ Symfony is the result of the work of many people who made the code better - Tiago Ribeiro (fixe) - Hidde Boomsma (hboomsma) - John Bafford (jbafford) - - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) - Massimiliano Arione (garak) @@ -324,7 +329,6 @@ Symfony is the result of the work of many people who made the code better - Thierry Thuon (lepiaf) - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) - - Dariusz - Gennady Telegin (gtelegin) - Ben Davies (bendavies) - Erin Millard @@ -339,16 +343,15 @@ 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) - - Michael Babker (mbabker) - François-Xavier de Guillebon (de-gui_f) - Damien Alexandre (damienalexandre) - Felix Labrecque - Yaroslav Kiliba - Terje Bråten + - Yanick Witschi (toflar) - Robbert Klarenbeek (robbertkl) - Edi Modrić (emodric) - Thomas Calvet (fancyweb) - - Niels Keurentjes (curry684) - JhonnyL - David Badura (davidbadura) - hossein zolfi (ocean) @@ -414,6 +417,7 @@ Symfony is the result of the work of many people who made the code better - Jan Schumann - Niklas Fiekas - Markus Bachmann (baachi) + - Gabriel Caruso - lancergr - Mihai Stancu - Olivier Dolbeau (odolbeau) @@ -450,7 +454,6 @@ Symfony is the result of the work of many people who made the code better - Anton Bakai - Maxime Veber (nek-) - Alex Bakhturin - - Yanick Witschi (toflar) - Alexander Obuhovich (aik099) - boombatower - Fabrice Bernhard (fabriceb) @@ -478,7 +481,6 @@ Symfony is the result of the work of many people who made the code better - Roy Van Ginneken (rvanginneken) - ondrowan - Barry vd. Heuvel (barryvdh) - - Wouter J - Florent Mata - Evan S Kaufman (evanskaufman) - mcben @@ -562,6 +564,7 @@ Symfony is the result of the work of many people who made the code better - Max Rath (drak3) - Stéphane Escandell (sescandell) - Konstantin S. M. Möllers (ksmmoellers) + - Alessandro Lai (jean85) - James Johnston - Sinan Eldem - Alexandre Dupuy (satchette) @@ -617,6 +620,7 @@ Symfony is the result of the work of many people who made the code better - Antoine Corcy - Sascha Grossenbacher - Szijarto Tamas + - Robin Lehrmann (robinlehrmann) - Catalin Dan - Stephan Vock - Benjamin Zikarsky (bzikarsky) @@ -692,6 +696,7 @@ Symfony is the result of the work of many people who made the code better - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) + - Johann Pardanaud - Adam Szaraniec (mimol) - Yosmany Garcia (yosmanyga) - Wouter de Wild @@ -811,6 +816,7 @@ Symfony is the result of the work of many people who made the code better - Gábor Tóth - Daniel Cestari - David Lima + - Brian Freytag (brianfreytag) - Brunet Laurent (lbrunet) - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) @@ -843,9 +849,9 @@ Symfony is the result of the work of many people who made the code better - Colin O'Dell (colinodell) - xaav - Mahmoud Mostafa (mahmoud) - - Alessandro Lai - Pieter - Michael Tibben + - Billie Thompson - Sander Marechal - Radosław Benkel - jean pasqualini (darkilliant) @@ -898,10 +904,10 @@ Symfony is the result of the work of many people who made the code better - Goran Juric - Laurent Ghirardotti (laurentg) - Nicolas Macherey + - Guido Donnari - AKeeman (akeeman) - Lin Clark - Jeremy David (jeremy.david) - - Robin Lehrmann (robinlehrmann) - Troy McCabe - Ville Mattila - ilyes kooli @@ -952,6 +958,7 @@ Symfony is the result of the work of many people who made the code better - DerManoMann - Olaf Klischat - orlovv + - Haralan Dobrev (hkdobrev) - Jhonny Lidfors (jhonny) - Julien Bianchi (jubianchi) - Robert Meijers @@ -967,7 +974,6 @@ Symfony is the result of the work of many people who made the code better - Alex Bowers - Jeremy Bush - wizhippo - - Gabriel Ostrolucký - Viacheslav Sychov - Carlos Ortega Huetos - rpg600 @@ -1033,6 +1039,7 @@ Symfony is the result of the work of many people who made the code better - Marco - Marc Torres - Alberto Aldegheri + - Dalibor Karlović - heccjj - Alexandre Melard - Jay Klehr @@ -1042,6 +1049,7 @@ Symfony is the result of the work of many people who made the code better - Jakub Kulhan - Ilia (aliance) - Mo Di (modi) + - Pablo Schläpfer - Jelte Steijaert (jelte) - Quique Porta (quiqueporta) - stoccc @@ -1084,6 +1092,7 @@ Symfony is the result of the work of many people who made the code better - Grzegorz Zdanowski (kiler129) - sl_toto (sl_toto) - Walter Dal Mut (wdalmut) + - Matthieu - Albin Kerouaton - Sébastien HOUZÉ - Jingyu Wang @@ -1103,6 +1112,7 @@ Symfony is the result of the work of many people who made the code better - Jules Lamur - Renato Mendes Figueiredo - ShiraNai7 + - Antal Áron (antalaron) - Markus Fasselt (digilist) - Vašek Purchart (vasek-purchart) - Janusz Jabłoński (yanoosh) @@ -1144,6 +1154,7 @@ Symfony is the result of the work of many people who made the code better - Tomaz Ahlin - Marcus Stöhr (dafish) - Emmanuel Vella (emmanuel.vella) + - Jonathan Johnson (jrjohnson) - Carsten Nielsen (phreaknerd) - Mathieu Rochette - Jay Severson @@ -1218,6 +1229,7 @@ Symfony is the result of the work of many people who made the code better - Antoine Bellion (abellion) - Ramon Kleiss (akathos) - César Suárez (csuarez) + - Bjorn Twachtmann (dotbjorn) - Nicolas Badey (nico-b) - Shane Preece (shane) - Johannes Goslar @@ -1266,6 +1278,7 @@ Symfony is the result of the work of many people who made the code better - Stefan Hüsges (tronsha) - Dan Blows - Matt Wells + - Nicolas Appriou - stloyd - Chris Tickner - Andrew Coulton @@ -1281,7 +1294,9 @@ Symfony is the result of the work of many people who made the code better - Matthew Donadio - Andreas - Thomas Chmielowiec + - shdev - Andrey Ryaguzov + - Stefan - Peter Bex - Manatsawin Hanmongkolchai - Gunther Konig @@ -1350,6 +1365,7 @@ Symfony is the result of the work of many people who made the code better - Grinbergs Reinis (shima5) - Artem Lopata (bumz) - Nicole Cordes + - Roman Orlov - VolCh - Alexey Popkov - Gijs Kunze @@ -1372,12 +1388,13 @@ Symfony is the result of the work of many people who made the code better - Dmitry Korotovsky - mcorteel - Michael van Tricht + - Tim Strehle - Sam Ward - Walther Lalk - Adam + - Stéphan Kochen - devel - taiiiraaa - - Johann Pardanaud - Trevor Suarez - gedrox - Alan Bondarchuk @@ -1393,6 +1410,7 @@ Symfony is the result of the work of many people who made the code better - bertillon - Bertalan Attila - Yannick Bensacq (cibou) + - Frédéric G. Marand (fgm) - Freek Van der Herten (freekmurze) - Luca Genuzio (genuzio) - Hans Nilsson (hansnilsson) @@ -1440,9 +1458,11 @@ Symfony is the result of the work of many people who made the code better - Alex Pods - hadriengem - timaschew + - Jochen Mandl - Ian Phillips - Haritz - Matthieu Prat + - Ion Bazan - Grummfy - Filipe Guerra - Gerben Wijnja @@ -1469,6 +1489,7 @@ Symfony is the result of the work of many people who made the code better - Juan M Martínez - Gilles Gauthier - ddebree + - Kuba Werłos - Tomas Liubinas - Alex - Klaas Naaijkens @@ -1541,6 +1562,7 @@ Symfony is the result of the work of many people who made the code better - Kristof Van Cauwenbergh (kristofvc) - Paulius Jarmalavičius (pjarmalavicius) - Ramon Henrique Ornelas (ramonornela) + - Ricardo de Vries (ricknox) - Markus S. (staabm) - Till Klampaeckel (till) - Tobias Weinert (tweini) @@ -1548,6 +1570,7 @@ Symfony is the result of the work of many people who made the code better - Wotre - goohib - Xavier HAUSHERR + - Ron Gähler - Edwin Hageman - Mantas Urnieža - Cas @@ -1563,12 +1586,14 @@ Symfony is the result of the work of many people who made the code better - BenjaminBeck - Aurelijus Rožėnas - Vladimir Tsykun + - Jordan Hoff - znerol - Christian Eikermann - Antonio Angelino - Matt Fields - Niklas Keller - Vladimir Sazhin + - Tomas Kmieliauskas - Billie Thompson - lol768 - jamogon @@ -1582,6 +1607,7 @@ Symfony is the result of the work of many people who made the code better - patrick-mcdougle - Dariusz Czech - Anonymous User + - Paweł Tomulik - Eric J. Duran - Alexandru Bucur - cmfcmf @@ -1605,7 +1631,6 @@ Symfony is the result of the work of many people who made the code better - vlechemin - Brian Corrigan - Ladislav Tánczos - - Brian Freytag - Skorney - fmarchalemisys - mieszko4 @@ -1617,6 +1642,7 @@ Symfony is the result of the work of many people who made the code better - Markus Staab - Pierre-Louis LAUNAY - djama + - Michael Gwynne - Eduardo Conceição - Jon Cave - Sébastien HOUZE @@ -1626,6 +1652,7 @@ Symfony is the result of the work of many people who made the code better - Shude - Ondřej Führer - Sema + - Michael Käfer - Elan Ruusamäe - Thorsten Hallwas - Michael Squires @@ -1653,6 +1680,7 @@ Symfony is the result of the work of many people who made the code better - Diego Campoy - TeLiXj - Oncle Tom + - Sam Anthony - Christian Stocker - Dawid Nowak - Lesnykh Ilia @@ -1671,6 +1699,7 @@ Symfony is the result of the work of many people who made the code better - arduanov - sualko - Bilge + - ADmad - Nicolas Roudaire - Alfonso (afgar) - Andreas Forsblom (aforsblo) @@ -1764,6 +1793,7 @@ Symfony is the result of the work of many people who made the code better - Moritz Kraft (userfriendly) - Víctor Mateo (victormateo) - Vincent (vincent1870) + - Vincent CHALAMON (vincentchalamon) - Eugene Babushkin (warl) - Wouter Sioen (wouter_sioen) - Xavier Amado (xamado) @@ -1786,6 +1816,7 @@ Symfony is the result of the work of many people who made the code better - Michael - fh-github@fholzhauer.de - AbdElKader Bouadjadja + - DSeemiller - Jan Emrich - Mark Topper - Xavier REN @@ -1799,6 +1830,7 @@ Symfony is the result of the work of many people who made the code better - Marc Lemay (flug) - Henne Van Och (hennevo) - Jeroen De Dauw (jeroendedauw) + - Daniel Alejandro Castro Arellano (lexcast) - Maxime COLIN (maximecolin) - Muharrem Demirci (mdemirci) - Evgeny Z (meze) @@ -1808,3 +1840,4 @@ Symfony is the result of the work of many people who made the code better - Thomas BERTRAND (sevrahk) - Matej Žilák (teo_sk) - Vladislav Vlastovskiy (vlastv) + - RENAUDIN Xavier (xorrox) From f0467eb03a73ab3a041364d0abc04309c78e78cf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 06:16:01 +0100 Subject: [PATCH 03/74] updated VERSION for 2.7.40 --- 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 a8e6e88bfced..6fe8eb14905e 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.40-DEV'; + const VERSION = '2.7.40'; const VERSION_ID = 20740; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 40; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 05adcd07bd14f30dc1a8453c9a85cf312d520653 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 06:53:01 +0100 Subject: [PATCH 04/74] bumped Symfony version to 2.7.41 --- 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 6fe8eb14905e..afbd8159996f 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.40'; - const VERSION_ID = 20740; + const VERSION = '2.7.41-DEV'; + const VERSION_ID = 20741; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 40; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 41; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 1e160820800fea304167ba14ec8227def10c3c8f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 07:19:30 +0100 Subject: [PATCH 05/74] updated CHANGELOG for 2.8.33 --- CHANGELOG-2.8.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 2e8fc7e47079..ac8f7b376862 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,26 @@ 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.33 (2018-01-05) + + * bug #25532 [HttpKernel] Disable CSP header on exception pages (ostrolucky) + * bug #25491 [Routing] Use the default host even if context is empty (sroze) + * bug #25662 Dumper shouldn't use html format for phpdbg / cli-server (jhoff) + * bug #25529 [Validator] Fix access to root object when using composite constraint (ostrolucky) + * bug #25430 Fixes for Oracle in PdoSessionHandler (elislenio) + * bug #25599 Add application/ld+json format associated to json (vincentchalamon) + * bug #25407 [Console] Commands with an alias should not be recognized as ambiguous (Simperfit) + * bug #25521 [Console] fix a bug when you are passing a default value and passing -n would output the index (Simperfit) + * bug #25489 [FrameworkBundle] remove esi/ssi renderers if inactive (dmaicher) + * bug #25427 Preserve percent-encoding in URLs when performing redirects in the UrlMatcher (mpdude) + * bug #25480 [FrameworkBundle] add missing validation options to XSD file (xabbuh) + * bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit) + * bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque) + * bug #25408 [Debug] Fix catching fatal errors in case of nested error handlers (nicolas-grekas) + * bug #25330 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) (stephank) + * bug #25410 [HttpKernel] Fix logging of post-terminate errors/exceptions (nicolas-grekas) + * bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit) + * 2.8.32 (2017-12-04) * bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos) From 643eb0dfdd3f2ffa60899e60e531f0256fae0f2f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 07:19:35 +0100 Subject: [PATCH 06/74] updated VERSION for 2.8.33 --- 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 420e05f2436e..bd69c22d2157 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.33-DEV'; + const VERSION = '2.8.33'; const VERSION_ID = 20833; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 33; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 7949672e39786425975420d8d420e478b96102cc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 08:16:18 +0100 Subject: [PATCH 07/74] bumped Symfony version to 2.8.34 --- 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 bd69c22d2157..b721249e046c 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.33'; - const VERSION_ID = 20833; + const VERSION = '2.8.34-DEV'; + const VERSION_ID = 20834; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 33; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 34; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 9419535736ee10412f38bc9eb7844a826771a02e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 09:11:08 +0100 Subject: [PATCH 08/74] bumped Symfony version to 3.3.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 95238fdb7b07..06f58ee48bfa 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.15'; - const VERSION_ID = 30315; + const VERSION = '3.3.16-DEV'; + const VERSION_ID = 30316; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; - const RELEASE_VERSION = 15; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 16; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From f66f9a7b377d8eca20b2ba63e42446df10174877 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 5 Jan 2018 13:03:30 +0100 Subject: [PATCH 09/74] [FrameworkBundle] Fix using "annotations.cached_reader" in after-removing passes --- .../Compiler/AddAnnotationsCachedReaderPass.php | 13 ++++++------- .../DependencyInjection/FrameworkExtension.php | 4 +++- .../Bundle/FrameworkBundle/FrameworkBundle.php | 2 +- .../Functional/Bundle/TestBundle/TestBundle.php | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php index 508899379f69..35ea20a89acc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php @@ -13,7 +13,6 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; /** * @internal @@ -29,14 +28,14 @@ public function process(ContainerBuilder $container) // "annotation_reader" at build time don't get any cache if ($container->hasDefinition('annotations.cached_reader')) { $reader = $container->getDefinition('annotations.cached_reader'); - $tags = $reader->getTags(); + $properties = $reader->getProperties(); - if (isset($tags['annotations.cached_reader'][0]['provider'])) { - if ($container->hasAlias($provider = $tags['annotations.cached_reader'][0]['provider'])) { - $provider = (string) $container->getAlias($provider); - } + if (isset($properties['cacheProviderBackup'])) { + $provider = $properties['cacheProviderBackup']->getValues()[0]; + unset($properties['cacheProviderBackup']); + $reader->setProperties($properties); $container->set('annotations.cached_reader', null); - $container->setDefinition('annotations.cached_reader', $reader->replaceArgument(1, new Reference($provider))); + $container->setDefinition('annotations.cached_reader', $reader->replaceArgument(1, $provider)); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 8e561f96a0d5..bd1100c2385c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -25,6 +25,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -1131,7 +1132,8 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde $container ->getDefinition('annotations.cached_reader') ->replaceArgument(2, $config['debug']) - ->addTag('annotations.cached_reader', array('provider' => $cacheService)) + // temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs + ->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService))) ; $container->setAlias('annotation_reader', 'annotations.cached_reader'); $container->setAlias(Reader::class, new Alias('annotations.cached_reader', false)); diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index a090d9a99cc7..985b038786b6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -91,7 +91,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->addCompilerPass(new TemplatingPass()); $this->addCompilerPassIfExists($container, AddConstraintValidatorsPass::class, PassConfig::TYPE_BEFORE_REMOVING); - $container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_AFTER_REMOVING, -255); $this->addCompilerPassIfExists($container, AddValidatorInitializersPass::class); $this->addCompilerPassIfExists($container, AddConsoleCommandPass::class); $container->addCompilerPass(new TranslatorPass()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php index d63658bacf02..193442ff956c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\AnnotationReaderPass; use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig; @@ -27,6 +28,6 @@ public function build(ContainerBuilder $container) $extension->setCustomConfig(new CustomConfig()); - $container->addCompilerPass(new AnnotationReaderPass()); + $container->addCompilerPass(new AnnotationReaderPass(), PassConfig::TYPE_AFTER_REMOVING); } } From 7c9a6c3864a1b2dedf1ceebf80528083fc4f90fd Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sat, 6 Jan 2018 16:56:43 +0100 Subject: [PATCH 10/74] Run simple-phpunit with --no-suggest option --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index b3f302cd340b..be0839a9a407 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -76,7 +76,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.4-beta5@dev|^4.0-beta5@dev\""); $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); - $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true))); + $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-suggest --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true))); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); From 499d04fa92c526ea2bb045a20950a4b9d13b71e1 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sat, 6 Jan 2018 17:07:51 +0100 Subject: [PATCH 11/74] [Console] Improve phpdoc on StyleInterface::ask() --- src/Symfony/Component/Console/Style/StyleInterface.php | 6 +++--- src/Symfony/Component/Console/Style/SymfonyStyle.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Console/Style/StyleInterface.php b/src/Symfony/Component/Console/Style/StyleInterface.php index a9205e5a7062..475c268ffe40 100644 --- a/src/Symfony/Component/Console/Style/StyleInterface.php +++ b/src/Symfony/Component/Console/Style/StyleInterface.php @@ -91,7 +91,7 @@ public function table(array $headers, array $rows); * @param string|null $default * @param callable|null $validator * - * @return string + * @return mixed */ public function ask($question, $default = null, $validator = null); @@ -101,7 +101,7 @@ public function ask($question, $default = null, $validator = null); * @param string $question * @param callable|null $validator * - * @return string + * @return mixed */ public function askHidden($question, $validator = null); @@ -122,7 +122,7 @@ public function confirm($question, $default = true); * @param array $choices * @param string|int|null $default * - * @return string + * @return mixed */ public function choice($question, array $choices, $default = null); diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index bfb23ac8eb8b..bf25c0668700 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -314,7 +314,7 @@ public function createProgressBar($max = 0) } /** - * @return string + * @return mixed */ public function askQuestion(Question $question) { From a93861fef24b51903da1baa6dde42f0b144e7807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Votruba?= Date: Sun, 7 Jan 2018 00:30:09 +0100 Subject: [PATCH 12/74] [Form] AbstractLayoutTest - fix DOMDocument casing --- src/Symfony/Component/Form/Tests/AbstractLayoutTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 52aaacd15ac1..752cddbdd798 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -58,7 +58,7 @@ protected function assertXpathNodeValue(\DOMElement $element, $expression, $node protected function assertMatchesXpath($html, $expression, $count = 1) { - $dom = new \DomDocument('UTF-8'); + $dom = new \DOMDocument('UTF-8'); try { // Wrap in node so we can load HTML with multiple tags at // the top level From 053fa43add5c8a7cf364958eab426a39a564a2be Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Wed, 3 Jan 2018 14:12:06 +0000 Subject: [PATCH 13/74] [Security] Fail gracefully if the security token cannot be unserialized from the session --- .../Http/Firewall/ContextListener.php | 43 ++++++++++++++++++- .../Tests/Firewall/ContextListenerTest.php | 2 + 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index b446f57e4985..7a3483b2ecc8 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -39,6 +39,8 @@ class ContextListener implements ListenerInterface private $dispatcher; private $registered; + private static $unserializeExceptionCode = 0x37313bc; + public function __construct(TokenStorageInterface $tokenStorage, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { if (empty($contextKey)) { @@ -77,7 +79,7 @@ public function handle(GetResponseEvent $event) return; } - $token = unserialize($token); + $token = $this->safelyUnserialize($token); if (null !== $this->logger) { $this->logger->debug('Read existing security token from the session.', array('key' => $this->sessionKey)); @@ -171,4 +173,43 @@ protected function refreshUser(TokenInterface $token) throw new \RuntimeException(sprintf('There is no user provider for user "%s".', get_class($user))); } + + private function safelyUnserialize($serializedToken) + { + $e = $token = null; + $prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); + $prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) { + if (__FILE__ === $file) { + throw new \UnexpectedValueException($msg, self::$unserializeExceptionCode); + } + + return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false; + }); + + try { + $token = unserialize($serializedToken); + } catch (\Error $e) { + } catch (\Exception $e) { + } + restore_error_handler(); + ini_set('unserialize_callback_func', $prevUnserializeHandler); + if ($e) { + if (!$e instanceof \UnexpectedValueException || self::$unserializeExceptionCode !== $e->getCode()) { + throw $e; + } + if ($this->logger) { + $this->logger->warning('Failed to unserialize the security token from the session.', array('key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e)); + } + } + + return $token; + } + + /** + * @internal + */ + public static function handleUnserializeCallback($class) + { + throw new \UnexpectedValueException('Class not found: '.$class, self::$unserializeExceptionCode); + } } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index e3bb11caa9c8..2ecaa53c6929 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -169,6 +169,8 @@ public function testInvalidTokenInSession($token) public function provideInvalidToken() { return array( + array('foo'), + array('O:8:"NotFound":0:{}'), array(serialize(new \__PHP_Incomplete_Class())), array(serialize(null)), array(null), From e3de68f2ff12906b5ba6817d6e290dcbd030ad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Fr=C3=B6mer?= Date: Fri, 22 Dec 2017 16:28:45 +0100 Subject: [PATCH 14/74] Add type string to docblock for Process::setInput() --- src/Symfony/Component/Process/InputStream.php | 6 +++++- .../Component/Process/Pipes/AbstractPipes.php | 2 +- src/Symfony/Component/Process/Process.php | 2 +- src/Symfony/Component/Process/ProcessBuilder.php | 2 +- .../Serializer/Encoder/EncoderInterface.php | 2 +- .../Normalizer/DenormalizableInterface.php | 12 ++++++------ .../Serializer/Normalizer/NormalizableInterface.php | 2 +- .../Serializer/Normalizer/NormalizerInterface.php | 2 +- src/Symfony/Component/VarDumper/Cloner/Data.php | 2 +- .../Component/VarDumper/Cloner/DumperInterface.php | 6 +++--- 10 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Component/Process/InputStream.php b/src/Symfony/Component/Process/InputStream.php index 831b10932599..200eccacd5fe 100644 --- a/src/Symfony/Component/Process/InputStream.php +++ b/src/Symfony/Component/Process/InputStream.php @@ -20,12 +20,15 @@ */ class InputStream implements \IteratorAggregate { + /** @var null|callable */ private $onEmpty = null; private $input = array(); private $open = true; /** * Sets a callback that is called when the write buffer becomes empty. + * + * @param null|callable $onEmpty */ public function onEmpty(callable $onEmpty = null) { @@ -35,7 +38,8 @@ public function onEmpty(callable $onEmpty = null) /** * Appends an input to the write buffer. * - * @param resource|scalar|\Traversable|null The input to append as stream resource, scalar or \Traversable + * @param resource|int|string|bool|float|\Traversable|null The input to append as stream + * resource, scalar or \Traversable */ public function write($input) { diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index ba79c32702df..7d56632be913 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -27,7 +27,7 @@ abstract class AbstractPipes implements PipesInterface private $blocked = true; /** - * @param resource|scalar|\Iterator|null $input + * @param resource|int|string|bool|float|\Iterator|null $input */ public function __construct($input) { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index f01a9a1e24eb..860affbf6ea9 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1158,7 +1158,7 @@ public function getInput() * * This content will be passed to the underlying process standard input. * - * @param resource|scalar|\Traversable|null $input The content + * @param int|float|string|bool|resource|\Traversable|null $input The content * * @return self The current Process instance * diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index 2afedcc553ac..1021899a4ede 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -167,7 +167,7 @@ public function addEnvironmentVariables(array $variables) /** * Sets the input of the process. * - * @param resource|scalar|\Traversable|null $input The input content + * @param resource|int|string|bool|float|\Traversable|null $input The input content * * @return $this * diff --git a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php index f31870e1bf9a..eb1b46db3ba0 100644 --- a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php +++ b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php @@ -27,7 +27,7 @@ interface EncoderInterface * @param string $format Format name * @param array $context Options that normalizers/encoders have access to * - * @return scalar + * @return int|string|bool|float * * @throws UnexpectedValueException */ diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 702b1bcb59d8..52a63597039a 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -27,12 +27,12 @@ interface DenormalizableInterface * It is important to understand that the denormalize() call should denormalize * recursively all child objects of the implementor. * - * @param DenormalizerInterface $denormalizer The denormalizer is given so that you - * can use it to denormalize objects contained within this object - * @param array|scalar $data The data from which to re-create the object - * @param string|null $format The format is optionally given to be able to denormalize differently - * based on different input formats - * @param array $context Options for denormalizing + * @param DenormalizerInterface $denormalizer The denormalizer is given so that you + * can use it to denormalize objects contained within this object + * @param array|int|string|bool|float $data The data from which to re-create the object + * @param string|null $format The format is optionally given to be able to denormalize + * differently based on different input formats + * @param array $context Options for denormalizing * * @return object */ diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index b275228642e1..d8db0663a087 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -33,7 +33,7 @@ interface NormalizableInterface * based on different output formats * @param array $context Options for normalizing this object * - * @return array|scalar + * @return array|int|string|bool|float */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 7f26c0404e5a..071be21f8286 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -29,7 +29,7 @@ interface NormalizerInterface * @param string $format Format the normalization result will be encoded as * @param array $context Context options for the normalizer * - * @return array|scalar + * @return array|int|string|bool|float * * @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index 9f523d3bfa60..a4eb1b20937f 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -63,7 +63,7 @@ public function getType() /** * @param bool $recursive Whether values should be resolved recursively or not * - * @return scalar|array|null|Data[] A native representation of the original value + * @return int|string|bool|float|array|null|Data[] A native representation of the original value */ public function getValue($recursive = false) { diff --git a/src/Symfony/Component/VarDumper/Cloner/DumperInterface.php b/src/Symfony/Component/VarDumper/Cloner/DumperInterface.php index cb7981694f98..f7c3a5504872 100644 --- a/src/Symfony/Component/VarDumper/Cloner/DumperInterface.php +++ b/src/Symfony/Component/VarDumper/Cloner/DumperInterface.php @@ -21,9 +21,9 @@ interface DumperInterface /** * Dumps a scalar value. * - * @param Cursor $cursor The Cursor position in the dump - * @param string $type The PHP type of the value being dumped - * @param scalar $value The scalar value being dumped + * @param Cursor $cursor The Cursor position in the dump + * @param string $type The PHP type of the value being dumped + * @param int|string|bool|float $value The scalar value being dumped */ public function dumpScalar(Cursor $cursor, $type, $value); From bc80258a1e5f82e7abecaa51ef9dba5915391b6c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 7 Jan 2018 18:01:19 +0100 Subject: [PATCH 15/74] Tweaked some styles in the profiler tables --- .../Resources/views/Collector/events.html.twig | 2 +- .../Resources/views/Collector/translation.html.twig | 4 ++-- .../Resources/views/Profiler/profiler.css.twig | 4 ---- .../WebProfilerBundle/Resources/views/Router/panel.html.twig | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig index 24a1e3fff99a..4244652f24fe 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig @@ -74,7 +74,7 @@ {% endif %} - {{ listener.priority|default('-') }} + {{ listener.priority|default('-') }} {% if listener.type == 'Closure' %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig index da55ef919032..3b2e3f86551f 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig @@ -168,9 +168,9 @@ {% for message in messages %} - {{ message.locale }} + {{ message.locale }} {{ message.domain }} - {{ message.count }} + {{ message.count }} {{ message.id }} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index 56c02685f63d..373ad580d15a 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -174,10 +174,6 @@ table tbody td { border-width: 1px 0; } -table tbody td { - {{ mixins.break_long_words|raw }} -} - table tbody div { margin: .25em 0; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig index 1cfa08508968..ea8600a2d083 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig @@ -55,8 +55,8 @@ {% for trace in traces %} {{ loop.index }} - {{ trace.name }} - {{ trace.path }} + {{ trace.name }} + {{ trace.path }} {% if trace.level == 1 %} Path almost matches, but From e7e410bfeb2aced686ac0ea0174d38712ce09289 Mon Sep 17 00:00:00 2001 From: Vacheslav Silyutin Date: Wed, 13 Dec 2017 23:37:25 +0300 Subject: [PATCH 16/74] [Serializer] Fixed throwing exception with option JSON_PARTIAL_OUTPUT_ON_ERROR --- .../Serializer/Encoder/JsonEncode.php | 3 +- .../Tests/Encoder/JsonEncoderTest.php | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index e0c6eb560e10..ef415a3e2e4e 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -55,7 +55,8 @@ public function encode($data, $format, array $context = array()) $encodedJson = json_encode($data, $context['json_encode_options']); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { + $this->lastError = json_last_error(); + if (JSON_ERROR_NONE !== $this->lastError && (false === $encodedJson || \PHP_VERSION_ID < 50500 || !($context['json_encode_options'] & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new UnexpectedValueException(JsonEncoder::getLastErrorMessage()); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php index ad8d57065f72..c58363750a31 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php @@ -65,6 +65,47 @@ public function testOptions() $this->assertEquals($expected, $this->serializer->serialize($arr, 'json'), 'Context should not be persistent'); } + /** + * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException + */ + public function testEncodeNotUtf8WithoutPartialOnError() + { + $arr = array( + 'utf8' => 'Hello World!', + 'notUtf8' => "\xb0\xd0\xb5\xd0", + ); + + $this->encoder->encode($arr, 'json'); + } + + /** + * @requires PHP 5.5 + */ + public function testEncodeNotUtf8WithPartialOnError() + { + $context = array('json_encode_options' => JSON_PARTIAL_OUTPUT_ON_ERROR); + + $arr = array( + 'utf8' => 'Hello World!', + 'notUtf8' => "\xb0\xd0\xb5\xd0", + ); + + $result = $this->encoder->encode($arr, 'json', $context); + $jsonLastError = json_last_error(); + + $this->assertSame(JSON_ERROR_UTF8, $jsonLastError); + $this->assertEquals('{"utf8":"Hello World!","notUtf8":null}', $result); + + $this->assertEquals('0', $this->serializer->serialize(NAN, 'json', $context)); + } + + public function testDecodeFalseString() + { + $result = $this->encoder->decode('false', 'json'); + $this->assertSame(JSON_ERROR_NONE, json_last_error()); + $this->assertFalse($result); + } + protected function getJsonSource() { return '{"foo":"foo","bar":["a","b"],"baz":{"key":"val","key2":"val","A B":"bar","item":[{"title":"title1"},{"title":"title2"}],"Barry":{"FooBar":{"Baz":"Ed","@id":1}}},"qux":"1"}'; From 3e47c7102859a438da996cbcde02c743952660d6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Jan 2018 17:55:58 +0100 Subject: [PATCH 17/74] [HttpKernel] Turn bad hosts into 400 instead of 500 --- .../HttpKernel/EventListener/RouterListener.php | 7 ++++++- .../Tests/EventListener/RouterListenerTest.php | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php index 12cbd2b6a471..7cee6e8a7645 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\RequestStack; @@ -96,7 +97,11 @@ public function setRequest(Request $request = null) private function setCurrentRequest(Request $request = null) { if (null !== $request && $this->request !== $request) { - $this->context->fromRequest($request); + try { + $this->context->fromRequest($request); + } catch (\UnexpectedValueException $e) { + throw new BadRequestHttpException($e->getMessage(), $e, $e->getCode()); + } } $this->request = $request; diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 8376ba8f6fd1..a0882999a254 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -155,4 +155,19 @@ public function getLoggingParameterData() array(array(), 'Matched route "n/a".'), ); } + + /** + * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + */ + public function testSubRequestWithBadHost() + { + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $request = Request::create('http://bad host %22/'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); + + $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); + + $listener = new RouterListener($requestMatcher, new RequestContext(), null, $this->requestStack); + $listener->onKernelRequest($event); + } } From a3149310ac716b944518e022d9b34590285f8388 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Wed, 10 Jan 2018 17:16:33 +0000 Subject: [PATCH 18/74] Add the missing `enabled` session attribute --- .../FrameworkBundle/Resources/config/schema/symfony-1.0.xsd | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index cfcfb34da85d..3cc6646cdef3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -104,6 +104,7 @@ + From 5f397f8dcfbaa42e4c32b3e82752293ee1ab37cb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Jan 2018 19:03:23 +0100 Subject: [PATCH 19/74] [Debug] prevent infinite loop with faulty exception handlers --- src/Symfony/Component/Debug/ErrorHandler.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 704075614c68..c0f07e256d73 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -561,6 +561,8 @@ public static function handleFatalError(array $error = null) $handler = self::$reservedMemory = null; $handlers = array(); + $previousHandler = null; + $sameHandlerLimit = 10; while (!is_array($handler) || !$handler[0] instanceof self) { $handler = set_exception_handler('var_dump'); @@ -570,7 +572,14 @@ public static function handleFatalError(array $error = null) break; } restore_exception_handler(); - array_unshift($handlers, $handler); + + if ($handler !== $previousHandler) { + array_unshift($handlers, $handler); + $previousHandler = $handler; + } elseif (0 === --$sameHandlerLimit) { + $handler = null; + break; + } } foreach ($handlers as $h) { set_exception_handler($h); From e366772c0635742a236eabff47de6af6903d4a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 11 Jan 2018 10:34:39 +0100 Subject: [PATCH 20/74] [HttpKernel] Fixed test name --- .../HttpKernel/Tests/EventListener/RouterListenerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index a0882999a254..83517f2d9624 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -159,7 +159,7 @@ public function getLoggingParameterData() /** * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException */ - public function testSubRequestWithBadHost() + public function testRequestWithBadHost() { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $request = Request::create('http://bad host %22/'); From 0b03631e7f8cb5f9dffe8def783040008199004c Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 10 Jan 2018 17:43:14 +0000 Subject: [PATCH 21/74] Don't right trim the deprecation message --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- .../PhpUnit/Tests/DeprecationErrorHandler/default.phpt | 8 ++++---- .../weak_vendors_on_non_vendor.phpt | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index a108126a2eed..d13fc14c0c6b 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -223,7 +223,7 @@ public static function register($mode = 0) uasort($deprecations[$group], $cmp); foreach ($deprecations[$group] as $msg => $notices) { - echo "\n", rtrim($msg, '.'), ': ', $notices['count'], "x\n"; + echo "\n ", $notices['count'], 'x: ', $msg, "\n"; arsort($notices); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index cd733724870c..39a3e985865f 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -63,20 +63,20 @@ $foo->testNonLegacyBar(); --EXPECTF-- Unsilenced deprecation notices (3) -unsilenced foo deprecation: 2x + 2x: unsilenced foo deprecation 2x in FooTestCase::testLegacyFoo -unsilenced bar deprecation: 1x + 1x: unsilenced bar deprecation 1x in FooTestCase::testNonLegacyBar Remaining deprecation notices (1) -silenced bar deprecation: 1x + 1x: silenced bar deprecation 1x in FooTestCase::testNonLegacyBar Legacy deprecation notices (1) Other deprecation notices (1) -root deprecation: 1x + 1x: root deprecation diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt index 7568d54a9ce9..e20c7adf6ba1 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt @@ -55,20 +55,20 @@ $foo->testNonLegacyBar(); --EXPECTF-- Unsilenced deprecation notices (3) -unsilenced foo deprecation: 2x + 2x: unsilenced foo deprecation 2x in FooTestCase::testLegacyFoo -unsilenced bar deprecation: 1x + 1x: unsilenced bar deprecation 1x in FooTestCase::testNonLegacyBar Remaining deprecation notices (1) -silenced bar deprecation: 1x + 1x: silenced bar deprecation 1x in FooTestCase::testNonLegacyBar Legacy deprecation notices (1) Other deprecation notices (1) -root deprecation: 1x + 1x: root deprecation From efb8fa164ee01adbfc5ce180bddab6d18d5ec17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ch=C3=A1bek?= Date: Thu, 11 Jan 2018 11:25:41 +0100 Subject: [PATCH 22/74] Add missing @ in phpdoc return statement --- src/Symfony/Component/Cache/Adapter/AdapterInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php index 274ebec1ef44..41222c1ab57c 100644 --- a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php +++ b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php @@ -31,7 +31,7 @@ public function getItem($key); /** * {@inheritdoc} * - * return \Traversable|CacheItem[] + * @return \Traversable|CacheItem[] */ public function getItems(array $keys = array()); } From 74726f389673155d344cf080554ab595bcb322c8 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Sun, 3 Dec 2017 15:02:49 +0100 Subject: [PATCH 23/74] [Serializer] DateTimeNormalizer handling of null and empty values (returning null or empty instead of new object) --- .../Normalizer/DateTimeNormalizer.php | 4 ++++ .../Normalizer/DateTimeNormalizerTest.php | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index ff121deb807a..f78901132954 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -67,6 +67,10 @@ public function denormalize($data, $class, $format = null, array $context = arra { $dateTimeFormat = isset($context[self::FORMAT_KEY]) ? $context[self::FORMAT_KEY] : null; + if ('' === $data || null === $data) { + throw new UnexpectedValueException('The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string.'); + } + if (null !== $dateTimeFormat) { $object = \DateTime::class === $class ? \DateTime::createFromFormat($dateTimeFormat, $data) : \DateTimeImmutable::createFromFormat($dateTimeFormat, $data); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php index 6d622bbcc0e0..73d277b19083 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php @@ -91,6 +91,24 @@ public function testDenormalizeInvalidDataThrowsException() $this->normalizer->denormalize('invalid date', \DateTimeInterface::class); } + /** + * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException + * @expectedExceptionMessage The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string. + */ + public function testDenormalizeNullThrowsException() + { + $this->normalizer->denormalize(null, \DateTimeInterface::class); + } + + /** + * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException + * @expectedExceptionMessage The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string. + */ + public function testDenormalizeEmptyStringThrowsException() + { + $this->normalizer->denormalize('', \DateTimeInterface::class); + } + /** * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException */ From a53cc5ce91893d384d8c34b55746254374359de6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 11 Jan 2018 18:07:52 +0100 Subject: [PATCH 24/74] 19 digits VISA card numbers are valid --- .../Component/Validator/Constraints/CardSchemeValidator.php | 4 ++-- .../Validator/Tests/Constraints/CardSchemeValidatorTest.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index be54a0cf477b..14369c2365a5 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -79,9 +79,9 @@ class CardSchemeValidator extends ConstraintValidator '/^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. + // All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits. 'VISA' => array( - '/^4([0-9]{12}|[0-9]{15})$/', + '/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/', ), ); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php index dbe5166451a1..e12d201be0fc 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -111,6 +111,7 @@ public function getValidNumbers() array('VISA', '4111111111111111'), array('VISA', '4012888888881881'), array('VISA', '4222222222222'), + array('VISA', '4917610000000000003'), array(array('AMEX', 'VISA'), '4111111111111111'), array(array('AMEX', 'VISA'), '378282246310005'), array(array('JCB', 'MASTERCARD'), '5105105105105100'), From e52d977d124d008a13ff287147d2cf6b5f7688a3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 13 Jan 2018 10:54:37 +0100 Subject: [PATCH 25/74] fixed wrong description in a phpdoc --- src/Symfony/Component/Console/Input/StringInput.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Input/StringInput.php b/src/Symfony/Component/Console/Input/StringInput.php index 4e4c4a28b609..754d712cc33e 100644 --- a/src/Symfony/Component/Console/Input/StringInput.php +++ b/src/Symfony/Component/Console/Input/StringInput.php @@ -26,7 +26,7 @@ class StringInput extends ArgvInput const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')'; /** - * @param string $input An array of parameters from the CLI (in the argv format) + * @param string $input A string representing the parameters from the CLI * @param InputDefinition $definition A InputDefinition instance * * @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead From 8f095683d0ce6cf725abe93738075d33655af996 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 2 Jan 2018 16:28:00 +0100 Subject: [PATCH 26/74] [Security] Fix fatal error on non string username --- .../SimpleFormAuthenticationListener.php | 17 ++++++---- ...namePasswordFormAuthenticationListener.php | 15 +++++---- ...PasswordFormAuthenticationListenerTest.php | 32 +++++++++++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php index cf61d83d4334..9b6bfd1a3f3d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php @@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter; use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Security\Core\Exception\InvalidArgumentException; use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; use Symfony\Component\Security\Csrf\CsrfToken; @@ -107,15 +108,17 @@ protected function attemptAuthentication(Request $request) } } - if ($this->options['post_only']) { - $username = trim($request->request->get($this->options['username_parameter'], null, true)); - $password = $request->request->get($this->options['password_parameter'], null, true); - } else { - $username = trim($request->get($this->options['username_parameter'], null, true)); - $password = $request->get($this->options['password_parameter'], null, true); + $requestBag = $this->options['post_only'] ? $request->request : $request; + $username = $requestBag->get($this->options['username_parameter'], null, true); + $password = $requestBag->get($this->options['password_parameter'], null, true); + + if (!\is_string($username) || (\is_object($username) && !\method_exists($username, '__toString'))) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username))); } - if (strlen($username) > Security::MAX_USERNAME_LENGTH) { + $username = trim($username); + + if (\strlen($username) > Security::MAX_USERNAME_LENGTH) { throw new BadCredentialsException('Invalid username.'); } diff --git a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php index ba4329b0eadc..edcd3f2ef39b 100644 --- a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface; use Symfony\Component\HttpFoundation\Request; use Psr\Log\LoggerInterface; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Security\Csrf\CsrfToken; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; @@ -84,14 +85,16 @@ protected function attemptAuthentication(Request $request) } } - if ($this->options['post_only']) { - $username = trim($request->request->get($this->options['username_parameter'], null, true)); - $password = $request->request->get($this->options['password_parameter'], null, true); - } else { - $username = trim($request->get($this->options['username_parameter'], null, true)); - $password = $request->get($this->options['password_parameter'], null, true); + $requestBag = $this->options['post_only'] ? $request->request : $request; + $username = $requestBag->get($this->options['username_parameter'], null, true); + $password = $requestBag->get($this->options['password_parameter'], null, true); + + if (!\is_string($username) || (\is_object($username) && !\method_exists($username, '__toString'))) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username))); } + $username = trim($username); + if (strlen($username) > Security::MAX_USERNAME_LENGTH) { throw new BadCredentialsException('Invalid username.'); } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php index 62b4c48f9276..2e99f70e7e26 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php @@ -14,8 +14,15 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler; +use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener; use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; class UsernamePasswordFormAuthenticationListenerTest extends TestCase { @@ -69,6 +76,31 @@ public function testHandleWhenUsernameLength($username, $ok) $listener->handle($event); } + /** + * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException + * @expectedExceptionMessage The key "_username" must be a string, "array" given. + */ + public function testHandleNonStringUsername() + { + $request = Request::create('/login_check', 'POST', array('_username' => array())); + $request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock()); + + $listener = new UsernamePasswordFormAuthenticationListener( + new TokenStorage(), + $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(), + new SessionAuthenticationStrategy(SessionAuthenticationStrategy::NONE), + $httpUtils = new HttpUtils(), + 'foo', + new DefaultAuthenticationSuccessHandler($httpUtils), + new DefaultAuthenticationFailureHandler($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $httpUtils), + array('require_previous_session' => false) + ); + + $event = new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST); + + $listener->handle($event); + } + public function getUsernameForLength() { return array( From 939efd59b911281992d40be608ce81fd808c9992 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Sat, 13 Jan 2018 12:56:38 +0000 Subject: [PATCH 27/74] Remove polyfill-util dependency from fullstack and security --- composer.json | 3 +-- src/Symfony/Component/Security/composer.json | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 202e141f36c2..1ef01f1972e9 100644 --- a/composer.json +++ b/composer.json @@ -30,8 +30,7 @@ "symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php56": "~1.0", - "symfony/polyfill-php70": "~1.0", - "symfony/polyfill-util": "~1.0" + "symfony/polyfill-php70": "~1.0" }, "replace": { "symfony/asset": "self.version", diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index a9760c11ddf4..bd40fd48511d 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -22,7 +22,6 @@ "symfony/http-kernel": "~3.3", "symfony/polyfill-php56": "~1.0", "symfony/polyfill-php70": "~1.0", - "symfony/polyfill-util": "~1.0", "symfony/property-access": "~2.8|~3.0" }, "replace": { From e9bcd217df24e73df955b3f383b282d8e9daeb0a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 13 Jan 2018 15:03:33 +0100 Subject: [PATCH 28/74] fix merge --- .../HttpKernel/Tests/EventListener/RouterListenerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index cb30d0f98530..0d3c55854636 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -167,7 +167,7 @@ public function testRequestWithBadHost() $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $listener = new RouterListener($requestMatcher, new RequestContext(), null, $this->requestStack); + $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); $listener->onKernelRequest($event); } } From 70c8c2d47bd71861c8205985a17e68cedf828e1f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 11 Jan 2018 10:49:26 +0100 Subject: [PATCH 29/74] minor #25752 Don't right trim the deprecation message (alexpott) This PR was submitted for the 3.4 branch but it was squashed and merged into the 3.3 branch instead (closes #25752). Discussion ---------- Don't right trim the deprecation message | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | maybe yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... | License | MIT | Doc PR | symfony/symfony-docs#... The PhpUnit bridge lists deprecation messages after a test. In order to do this it outputs the message but it right trims the message - removing any fullstops. This is unexpected. It does this to add the number of time the message appears but this is not really necessary because the number of the times a deprecation message is triggered and from where is added below. Commits ------- 0b03631 Don't right trim the deprecation message --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- .../PhpUnit/Tests/DeprecationErrorHandler/default.phpt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 66b8762cff4e..dae4759134c2 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -134,7 +134,7 @@ public static function register($mode = false) uasort($deprecations[$group], $cmp); foreach ($deprecations[$group] as $msg => $notices) { - echo "\n", rtrim($msg, '.'), ': ', $notices['count'], "x\n"; + echo "\n ", $notices['count'], 'x: ', $msg, "\n"; arsort($notices); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index cd733724870c..39a3e985865f 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -63,20 +63,20 @@ $foo->testNonLegacyBar(); --EXPECTF-- Unsilenced deprecation notices (3) -unsilenced foo deprecation: 2x + 2x: unsilenced foo deprecation 2x in FooTestCase::testLegacyFoo -unsilenced bar deprecation: 1x + 1x: unsilenced bar deprecation 1x in FooTestCase::testNonLegacyBar Remaining deprecation notices (1) -silenced bar deprecation: 1x + 1x: silenced bar deprecation 1x in FooTestCase::testNonLegacyBar Legacy deprecation notices (1) Other deprecation notices (1) -root deprecation: 1x + 1x: root deprecation From 927a75ac3eb81853fafb211bc04b8356ad3b45d1 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Mon, 15 Jan 2018 10:33:10 +0000 Subject: [PATCH 30/74] Make sure we only build once and have one time the prefix when importing routes --- .../Routing/RouteCollectionBuilder.php | 6 ++--- .../Tests/RouteCollectionBuilderTest.php | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Routing/RouteCollectionBuilder.php b/src/Symfony/Component/Routing/RouteCollectionBuilder.php index 1d9c857aa2e9..e8a9a165d673 100644 --- a/src/Symfony/Component/Routing/RouteCollectionBuilder.php +++ b/src/Symfony/Component/Routing/RouteCollectionBuilder.php @@ -76,11 +76,11 @@ public function import($resource, $prefix = '/', $type = null) foreach ($collection->getResources() as $resource) { $builder->addResource($resource); } - - // mount into this builder - $this->mount($prefix, $builder); } + // mount into this builder + $this->mount($prefix, $builder); + return $builder; } diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php index 6fc592affc60..f6af600bd422 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php @@ -335,4 +335,30 @@ public function testAutomaticRouteNamesDoNotConflict() // there are 2 routes (i.e. with non-conflicting names) $this->assertCount(3, $collection->all()); } + + public function testAddsThePrefixOnlyOnceWhenLoadingMultipleCollections() + { + $firstCollection = new RouteCollection(); + $firstCollection->add('a', new Route('/a')); + + $secondCollection = new RouteCollection(); + $secondCollection->add('b', new Route('/b')); + + $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); + $loader->expects($this->any()) + ->method('supports') + ->will($this->returnValue(true)); + $loader + ->expects($this->any()) + ->method('load') + ->will($this->returnValue(array($firstCollection, $secondCollection))); + + $routeCollectionBuilder = new RouteCollectionBuilder($loader); + $routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob'); + $routes = $routeCollectionBuilder->build()->all(); + + $this->assertEquals(2, count($routes)); + $this->assertEquals('/other/a', $routes['a']->getPath()); + $this->assertEquals('/other/b', $routes['b']->getPath()); + } } From da21003459b462f1070c743a13b41ebe9e78af54 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Jan 2018 13:27:55 +0100 Subject: [PATCH 31/74] fix HHVM tests --- .../Component/HttpFoundation/Tests/RequestTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 4524f8b2347f..1b6426ae93aa 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -45,18 +45,18 @@ public function testGetLocale() public function testGetUser() { - $request = Request::create('http://user_test:password_test@test.com/'); + $request = Request::create('http://user:password@test.com'); $user = $request->getUser(); - $this->assertEquals('user_test', $user); + $this->assertEquals('user', $user); } public function testGetPassword() { - $request = Request::create('http://user_test:password_test@test.com/'); + $request = Request::create('http://user:password@test.com'); $password = $request->getPassword(); - $this->assertEquals('password_test', $password); + $this->assertEquals('password', $password); } public function testIsNoCache() From 0f79d09a100ab3dbff94cd4c6c04b6cfac227a37 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Mon, 15 Jan 2018 16:19:42 +0100 Subject: [PATCH 32/74] Fixed Request::__toString ignoring cookies --- src/Symfony/Component/HttpFoundation/Request.php | 14 +++++++++++++- .../Component/HttpFoundation/Tests/RequestTest.php | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 7a24f1cf8556..ce7258acd693 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -496,9 +496,21 @@ public function __toString() return trigger_error($e, E_USER_ERROR); } + $cookieHeader = ''; + $cookies = array(); + + foreach ($this->cookies as $k => $v) { + $cookies[] = $k.'='.$v; + } + + if (!empty($cookies)) { + $cookieHeader = 'Cookie: '.implode('; ', $cookies)."\r\n"; + } + return sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". - $this->headers."\r\n". + $this->headers. + $cookieHeader."\r\n". $content; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 1b6426ae93aa..5dad4057612d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1454,8 +1454,18 @@ public function testToString() $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); + $request->cookies->set('Foo', 'Bar'); - $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString()); + $asString = (string) $request; + + $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString); + $this->assertContains('Cookie: Foo=Bar', $asString); + + $request->cookies->set('Another', 'Cookie'); + + $asString = (string) $request; + + $this->assertContains('Cookie: Foo=Bar; Another=Cookie', $asString); } public function testIsMethod() From d76a545c0196a05ae7df2883ea30412cd37b20c0 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 15 Jan 2018 21:47:29 +0200 Subject: [PATCH 33/74] [Router] Skip anonymous classes when loading annotated routes --- .../Routing/Loader/AnnotationFileLoader.php | 10 ++++---- .../AnonymousClassInTrait.php | 24 +++++++++++++++++++ .../Tests/Loader/AnnotationFileLoaderTest.php | 11 +++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 9c5ab1b6ae63..ea203d4fea1c 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -107,22 +107,22 @@ protected function findClass($file) } if (T_CLASS === $token[0]) { - // Skip usage of ::class constant - $isClassConstant = false; + // Skip usage of ::class constant and anonymous classes + $skipClassToken = false; for ($j = $i - 1; $j > 0; --$j) { if (!isset($tokens[$j][1])) { break; } - if (T_DOUBLE_COLON === $tokens[$j][0]) { - $isClassConstant = true; + if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) { + $skipClassToken = true; break; } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { break; } } - if (!$isClassConstant) { + if (!$skipClassToken) { $class = true; } } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php b/src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php new file mode 100644 index 000000000000..de8789564949 --- /dev/null +++ b/src/Symfony/Component/Routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Tests\Fixtures\OtherAnnotatedClasses; + +trait AnonymousClassInTrait +{ + public function test() + { + return new class() { + public function foo() + { + } + }; + } +} diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index a022af44be4e..7665f71fdc00 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -58,6 +58,17 @@ public function testLoadVariadic() $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); } + /** + * @requires PHP 7.0 + */ + public function testLoadAnonymousClass() + { + $this->reader->expects($this->never())->method('getClassAnnotation'); + $this->reader->expects($this->never())->method('getMethodAnnotations'); + + $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php'); + } + public function testSupports() { $fixture = __DIR__.'/../Fixtures/annotated.php'; From aee9b1ea3ebea0c89fea215eca8ce2062c4a5b20 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 16 Jan 2018 18:12:50 +0100 Subject: [PATCH 34/74] Copied NO language files to the new NB locale. --- .../Resources/translations/validators.nb.xlf | 19 ++ .../Tests/Resources/TranslationFilesTest.php | 9 + .../Resources/translations/security.nb.xlf | 71 ++++ .../Tests/Resources/TranslationFilesTest.php | 9 + .../Resources/translations/security.nb.xlf | 71 ++++ .../Tests/Resources/TranslationFilesTest.php | 9 + .../Resources/translations/validators.nb.xlf | 319 ++++++++++++++++++ .../Tests/Resources/TranslationFilesTest.php | 9 + 8 files changed, 516 insertions(+) create mode 100644 src/Symfony/Component/Form/Resources/translations/validators.nb.xlf create mode 100644 src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf create mode 100644 src/Symfony/Component/Security/Resources/translations/security.nb.xlf create mode 100644 src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf new file mode 100644 index 000000000000..c64266c99189 --- /dev/null +++ b/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf @@ -0,0 +1,19 @@ + + + + + + This form should not contain extra fields. + Feltgruppen må ikke inneholde ekstra felter. + + + The uploaded file was too large. Please try to upload a smaller file. + Den opplastede filen var for stor. Vennligst last opp en mindre fil. + + + The CSRF token is invalid. + CSRF nøkkelen er ugyldig. + + + + diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php index ba19a6215a7b..6d3dae218caf 100644 --- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php @@ -36,4 +36,13 @@ function ($filePath) { return (array) $filePath; }, glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') ); } + + public function testNorwegianAlias() + { + $this->assertFileEquals( + dirname(dirname(__DIR__)).'/Resources/translations/validators.nb.xlf', + dirname(dirname(__DIR__)).'/Resources/translations/validators.no.xlf', + 'The NO locale should be an alias for the NB variant of the Norwegian language.' + ); + } } diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf new file mode 100644 index 000000000000..363591697147 --- /dev/null +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf @@ -0,0 +1,71 @@ + + + + + + An authentication exception occurred. + En autentiseringsfeil har skjedd. + + + Authentication credentials could not be found. + Påloggingsinformasjonen kunne ikke bli funnet. + + + Authentication request could not be processed due to a system problem. + Autentiserings forespørselen kunne ikke bli prosessert grunnet en system feil. + + + Invalid credentials. + Ugyldig påloggingsinformasjonen. + + + Cookie has already been used by someone else. + Cookie har allerede blitt brukt av noen andre. + + + Not privileged to request the resource. + Ingen tilgang til å be om gitt ressurs. + + + Invalid CSRF token. + Ugyldig CSRF token. + + + Digest nonce has expired. + Digest nonce er utløpt. + + + No authentication provider found to support the authentication token. + Ingen autentiserings tilbyder funnet som støtter gitt autentiserings token. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengelig, sesjonen er enten utløpt eller cookies ikke skrudd på. + + + No token could be found. + Ingen token kunne bli funnet. + + + Username could not be found. + Brukernavn kunne ikke bli funnet. + + + Account has expired. + Brukerkonto har utgått. + + + Credentials have expired. + Påloggingsinformasjon har utløpt. + + + Account is disabled. + Brukerkonto er deaktivert. + + + Account is locked. + Brukerkonto er sperret. + + + + diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php index 96a1307ed056..07c5e304b4ad 100644 --- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php @@ -36,4 +36,13 @@ function ($filePath) { return (array) $filePath; }, glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') ); } + + public function testNorwegianAlias() + { + $this->assertFileEquals( + dirname(dirname(__DIR__)).'/Resources/translations/security.nb.xlf', + dirname(dirname(__DIR__)).'/Resources/translations/security.no.xlf', + 'The NO locale should be an alias for the NB variant of the Norwegian language.' + ); + } } diff --git a/src/Symfony/Component/Security/Resources/translations/security.nb.xlf b/src/Symfony/Component/Security/Resources/translations/security.nb.xlf new file mode 100644 index 000000000000..363591697147 --- /dev/null +++ b/src/Symfony/Component/Security/Resources/translations/security.nb.xlf @@ -0,0 +1,71 @@ + + + + + + An authentication exception occurred. + En autentiseringsfeil har skjedd. + + + Authentication credentials could not be found. + Påloggingsinformasjonen kunne ikke bli funnet. + + + Authentication request could not be processed due to a system problem. + Autentiserings forespørselen kunne ikke bli prosessert grunnet en system feil. + + + Invalid credentials. + Ugyldig påloggingsinformasjonen. + + + Cookie has already been used by someone else. + Cookie har allerede blitt brukt av noen andre. + + + Not privileged to request the resource. + Ingen tilgang til å be om gitt ressurs. + + + Invalid CSRF token. + Ugyldig CSRF token. + + + Digest nonce has expired. + Digest nonce er utløpt. + + + No authentication provider found to support the authentication token. + Ingen autentiserings tilbyder funnet som støtter gitt autentiserings token. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengelig, sesjonen er enten utløpt eller cookies ikke skrudd på. + + + No token could be found. + Ingen token kunne bli funnet. + + + Username could not be found. + Brukernavn kunne ikke bli funnet. + + + Account has expired. + Brukerkonto har utgått. + + + Credentials have expired. + Påloggingsinformasjon har utløpt. + + + Account is disabled. + Brukerkonto er deaktivert. + + + Account is locked. + Brukerkonto er sperret. + + + + diff --git a/src/Symfony/Component/Security/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Tests/Resources/TranslationFilesTest.php index 30b9aed6ec87..e02a0648743f 100644 --- a/src/Symfony/Component/Security/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Security/Tests/Resources/TranslationFilesTest.php @@ -36,4 +36,13 @@ function ($filePath) { return (array) $filePath; }, glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') ); } + + public function testNorwegianAlias() + { + $this->assertFileEquals( + dirname(dirname(__DIR__)).'/Resources/translations/security.nb.xlf', + dirname(dirname(__DIR__)).'/Resources/translations/security.no.xlf', + 'The NO locale should be an alias for the NB variant of the Norwegian language.' + ); + } } diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf new file mode 100644 index 000000000000..250576531cfe --- /dev/null +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf @@ -0,0 +1,319 @@ + + + + + + This value should be false. + Verdien må være usann. + + + This value should be true. + Verdien må være sann. + + + This value should be of type {{ type }}. + Verdien skal ha typen {{ type }}. + + + This value should be blank. + Verdien skal være blank. + + + The value you selected is not a valid choice. + Den valgte verdien er ikke gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maks velge {{ limit }} valg. + + + One or more of the given values is invalid. + En eller flere av de oppgitte verdiene er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Verdien er ikke en gyldig dato/tid. + + + This value is not a valid email address. + Verdien er ikke en gyldig e-postadresse. + + + The file could not be found. + Filen kunne ikke finnes. + + + The file is not readable. + Filen er ikke lesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må være {{ limit }} tegn lang eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må ha {{ limit }} tegn eller mindre. + + + This value should be {{ limit }} or more. + Verdien må være {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} tegn eller flere. + + + This value should not be blank. + Verdien kan ikke være blank. + + + This value should not be null. + Verdien kan ikke være tom (null). + + + This value should be null. + Verdien skal være tom (null). + + + This value is not valid. + Verdien er ugyldig. + + + This value is not a valid time. + Verdien er ikke en gyldig tid. + + + This value is not a valid URL. + Verdien er ikke en gyldig URL. + + + The two values should be equal. + Verdiene skal være identiske. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelsen er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke lastes opp. + + + This value should be a valid number. + Verdien skal være et gyldig tall. + + + This file is not a valid image. + Denne filen er ikke et gyldig bilde. + + + This is not a valid IP address. + Dette er ikke en gyldig IP adresse. + + + This value is not a valid language. + Verdien er ikke et gyldig språk. + + + This value is not a valid locale. + Verdien er ikke en gyldig lokalitet. + + + This value is not a valid country. + Verdien er ikke et gyldig navn på land. + + + This value is already used. + Verdien er allerede brukt. + + + The size of the image could not be detected. + Bildestørrelsen kunne ikke oppdages. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bildebredden er for stor ({{ width }} piksler). Tillatt maksimumsbredde er {{ max_width }} piksler. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bildebredden er for liten ({{ width }} piksler). Forventet minimumsbredde er {{ min_width }} piksler. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bildehøyden er for stor ({{ height }} piksler). Tillatt maksimumshøyde er {{ max_height }} piksler. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bildehøyden er for liten ({{ height }} piksler). Forventet minimumshøyde er {{ min_height }} piksler. + + + This value should be the user's current password. + Verdien skal være brukerens sitt nåværende passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien skal være nøyaktig {{ limit }} tegn. + + + The file was only partially uploaded. + Filen var kun delvis opplastet. + + + No file was uploaded. + Ingen fil var lastet opp. + + + No temporary folder was configured in php.ini. + Den midlertidige mappen (tmp) er ikke konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikke skrive midlertidig fil til disk. + + + A PHP extension caused the upload to fail. + En PHP-utvidelse forårsaket en feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlingen må inneholde {{ limit }} element eller flere.|Denne samlingen må inneholde {{ limit }} elementer eller flere. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlingen må inneholde {{ limit }} element eller færre.|Denne samlingen må inneholde {{ limit }} elementer eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlingen må inneholde nøyaktig {{ limit }} element.|Denne samlingen må inneholde nøyaktig {{ limit }} elementer. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikke støttet eller kortnummeret er ugyldig. + + + This is not a valid International Bank Account Number (IBAN). + Dette er ikke et gyldig IBAN-nummer. + + + This value is not a valid ISBN-10. + Verdien er ikke en gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Verdien er ikke en gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Verdien er hverken en gyldig ISBN-10 eller ISBN-13. + + + This value is not a valid ISSN. + Verdien er ikke en gyldig ISSN. + + + This value is not a valid currency. + Verdien er ikke gyldig valuta. + + + This value should be equal to {{ compared_value }}. + Verdien skal være lik {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Verdien skal være større enn {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Verdien skal være større enn eller lik {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal være identisk med {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Verdien skal være mindre enn {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Verdien skal være mindre enn eller lik {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Verdien skal ikke være lik {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal ikke være identisk med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Bildeforholdet er for stort ({{ ratio }}). Tillatt bildeforhold er maks {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Bildeforholdet er for lite ({{ ratio }}). Forventet bildeforhold er minst {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bildet er en kvadrat ({{ width }}x{{ height }}px). Kvadratiske bilder er ikke tillatt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bildet er i liggende retning ({{ width }}x{{ height }}px). Bilder i liggende retning er ikke tillatt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bildet er i stående retning ({{ width }}x{{ height }}px). Bilder i stående retning er ikke tillatt. + + + An empty file is not allowed. + Tomme filer er ikke tilatt. + + + The host could not be resolved. + Vertsnavn kunne ikke løses. + + + This value does not match the expected {{ charset }} charset. + Verdien samsvarer ikke med forventet tegnsett {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dette er ikke en gyldig BIC. + + + + diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php index 96311cfeff32..d2b8a9901172 100644 --- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php @@ -36,4 +36,13 @@ function ($filePath) { return (array) $filePath; }, glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') ); } + + public function testNorwegianAlias() + { + $this->assertFileEquals( + dirname(dirname(__DIR__)).'/Resources/translations/validators.nb.xlf', + dirname(dirname(__DIR__)).'/Resources/translations/validators.no.xlf', + 'The NO locale should be an alias for the NB variant of the Norwegian language.' + ); + } } From 10e33acf4241d13de88da7f2f5e29dde2e460f76 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 16 Jan 2018 18:32:27 +0100 Subject: [PATCH 35/74] [appveyor] set memory_limit=-1 --- appveyor.yml | 1 + .../Component/Security/Http/Firewall/ContextListener.php | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6d869967263b..9ff140b0a280 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,6 +31,7 @@ install: - 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y >nul - cd .. - copy /Y php.ini-development php.ini-min + - echo memory_limit=-1 >> php.ini-min - echo serialize_precision=14 >> php.ini-min - echo max_execution_time=1200 >> php.ini-min - echo date.timezone="America/Los_Angeles" >> php.ini-min diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 7a3483b2ecc8..2c315b99448a 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -39,8 +39,6 @@ class ContextListener implements ListenerInterface private $dispatcher; private $registered; - private static $unserializeExceptionCode = 0x37313bc; - public function __construct(TokenStorageInterface $tokenStorage, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { if (empty($contextKey)) { @@ -180,7 +178,7 @@ private function safelyUnserialize($serializedToken) $prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); $prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) { if (__FILE__ === $file) { - throw new \UnexpectedValueException($msg, self::$unserializeExceptionCode); + throw new \UnexpectedValueException($msg, 0x37313bc); } return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false; @@ -194,7 +192,7 @@ private function safelyUnserialize($serializedToken) restore_error_handler(); ini_set('unserialize_callback_func', $prevUnserializeHandler); if ($e) { - if (!$e instanceof \UnexpectedValueException || self::$unserializeExceptionCode !== $e->getCode()) { + if (!$e instanceof \UnexpectedValueException || 0x37313bc !== $e->getCode()) { throw $e; } if ($this->logger) { @@ -210,6 +208,6 @@ private function safelyUnserialize($serializedToken) */ public static function handleUnserializeCallback($class) { - throw new \UnexpectedValueException('Class not found: '.$class, self::$unserializeExceptionCode); + throw new \UnexpectedValueException('Class not found: '.$class, 0x37313bc); } } From 70cc969537e39a95b03d0283f86b8b0fb6e13f5e Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Sat, 13 Jan 2018 02:38:52 +0100 Subject: [PATCH 36/74] [Form] Disallow transform dates beyond the year 9999 --- .../DateTimeToLocalizedStringTransformer.php | 3 +++ ...ateTimeToLocalizedStringTransformerTest.php | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index e2c553c507e4..816e6cad9282 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -123,6 +123,9 @@ public function reverseTransform($value) if (0 != intl_get_error_code()) { throw new TransformationFailedException(intl_get_error_message()); + } elseif ($timestamp > 253402214400) { + // This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years + throw new TransformationFailedException('Years beyond 9999 are not supported.'); } try { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index 1562071edfd1..60b83c222b7f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -343,4 +343,22 @@ public function testReverseTransformOutOfTimestampRange() $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC'); $transformer->reverseTransform('1789-07-14'); } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformFiveDigitYears() + { + $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd'); + $transformer->reverseTransform('20107-03-21'); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformFiveDigitYearsWithTimestamp() + { + $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss'); + $transformer->reverseTransform('20107-03-21 12:34:56'); + } } From 3e0c8ffb43183df95f556c10904814496d89eeda Mon Sep 17 00:00:00 2001 From: Boris Betzholz Date: Wed, 17 Jan 2018 09:29:55 +0100 Subject: [PATCH 37/74] Problem in phar see mergerequest #25579 --- .../Component/DependencyInjection/Loader/XmlFileLoader.php | 6 +++++- .../Component/Translation/Loader/XliffFileLoader.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 710fee58ffac..60b8c956eb52 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -458,16 +458,20 @@ public function validateSchema(\DOMDocument $dom) $imports = ''; foreach ($schemaLocations as $namespace => $location) { $parts = explode('/', $location); + $locationstart = 'file:///'; if (0 === stripos($location, 'phar://')) { $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); if ($tmpfile) { copy($location, $tmpfile); $tmpfiles[] = $tmpfile; $parts = explode('/', str_replace('\\', '/', $tmpfile)); + } else { + array_shift($parts); + $locationstart = 'phar:///'; } } $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; - $location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts)); + $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); $imports .= sprintf(' '."\n", $namespace, $location); } diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 38f30714efaf..7e76678cf2c2 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -129,15 +129,19 @@ private function parseFile($file) $location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd'; $parts = explode('/', $location); + $locationstart = 'file:///'; if (0 === stripos($location, 'phar://')) { $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); if ($tmpfile) { copy($location, $tmpfile); $parts = explode('/', str_replace('\\', '/', $tmpfile)); + } else { + array_shift($parts); + $locationstart = 'phar:///'; } } $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; - $location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts)); + $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); $source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd'); $source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source); From 9b4b7d0d3a45c6e0a1a0f4e48f2823eb9dd9194b Mon Sep 17 00:00:00 2001 From: Gunnstein Lye Date: Tue, 16 Jan 2018 15:49:04 +0100 Subject: [PATCH 38/74] Add nn (Norwegian Nynorsk) translation files, and improve existing file --- .../Resources/translations/validators.nn.xlf | 19 +++++ .../Resources/translations/security.nn.xlf | 71 +++++++++++++++++++ .../Resources/translations/security.nn.xlf | 71 +++++++++++++++++++ .../Resources/translations/validators.nn.xlf | 30 ++++---- 4 files changed, 176 insertions(+), 15 deletions(-) create mode 100644 src/Symfony/Component/Form/Resources/translations/validators.nn.xlf create mode 100644 src/Symfony/Component/Security/Core/Resources/translations/security.nn.xlf create mode 100644 src/Symfony/Component/Security/Resources/translations/security.nn.xlf diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf new file mode 100644 index 000000000000..2f5da23444d0 --- /dev/null +++ b/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf @@ -0,0 +1,19 @@ + + + + + + This form should not contain extra fields. + Feltgruppa må ikkje innehalde ekstra felt. + + + The uploaded file was too large. Please try to upload a smaller file. + Fila du lasta opp var for stor. Last opp ei mindre fil. + + + The CSRF token is invalid. + CSRF-nøkkelen er ikkje gyldig. + + + + diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.nn.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.nn.xlf new file mode 100644 index 000000000000..c48ce4650573 --- /dev/null +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.nn.xlf @@ -0,0 +1,71 @@ + + + + + + An authentication exception occurred. + Innlogginga har feila. + + + Authentication credentials could not be found. + Innloggingsinformasjonen vart ikkje funnen. + + + Authentication request could not be processed due to a system problem. + Innlogginga vart ikkje fullført på grunn av ein systemfeil. + + + Invalid credentials. + Ugyldig innloggingsinformasjon. + + + Cookie has already been used by someone else. + Informasjonskapselen er allereie brukt av ein annan brukar. + + + Not privileged to request the resource. + Du har ikkje åtgang til å be om denne ressursen. + + + Invalid CSRF token. + Ugyldig CSRF-teikn. + + + Digest nonce has expired. + Digest nonce er ikkje lenger gyldig. + + + No authentication provider found to support the authentication token. + Fann ingen innloggingstilbydar som støttar dette innloggingsteiknet. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengeleg. Sesjonen er anten ikkje lenger gyldig, eller informasjonskapslar er ikke skrudd på i nettlesaren. + + + No token could be found. + Fann ingen innloggingsteikn. + + + Username could not be found. + Fann ikkje brukarnamnet. + + + Account has expired. + Brukarkontoen er utgjengen. + + + Credentials have expired. + Innloggingsinformasjonen er utgjengen. + + + Account is disabled. + Brukarkontoen er deaktivert. + + + Account is locked. + Brukarkontoen er sperra. + + + + diff --git a/src/Symfony/Component/Security/Resources/translations/security.nn.xlf b/src/Symfony/Component/Security/Resources/translations/security.nn.xlf new file mode 100644 index 000000000000..c48ce4650573 --- /dev/null +++ b/src/Symfony/Component/Security/Resources/translations/security.nn.xlf @@ -0,0 +1,71 @@ + + + + + + An authentication exception occurred. + Innlogginga har feila. + + + Authentication credentials could not be found. + Innloggingsinformasjonen vart ikkje funnen. + + + Authentication request could not be processed due to a system problem. + Innlogginga vart ikkje fullført på grunn av ein systemfeil. + + + Invalid credentials. + Ugyldig innloggingsinformasjon. + + + Cookie has already been used by someone else. + Informasjonskapselen er allereie brukt av ein annan brukar. + + + Not privileged to request the resource. + Du har ikkje åtgang til å be om denne ressursen. + + + Invalid CSRF token. + Ugyldig CSRF-teikn. + + + Digest nonce has expired. + Digest nonce er ikkje lenger gyldig. + + + No authentication provider found to support the authentication token. + Fann ingen innloggingstilbydar som støttar dette innloggingsteiknet. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengeleg. Sesjonen er anten ikkje lenger gyldig, eller informasjonskapslar er ikke skrudd på i nettlesaren. + + + No token could be found. + Fann ingen innloggingsteikn. + + + Username could not be found. + Fann ikkje brukarnamnet. + + + Account has expired. + Brukarkontoen er utgjengen. + + + Credentials have expired. + Innloggingsinformasjonen er utgjengen. + + + Account is disabled. + Brukarkontoen er deaktivert. + + + Account is locked. + Brukarkontoen er sperra. + + + + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf index ea01c63ee4aa..e5881330e8eb 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf @@ -20,15 +20,15 @@ The value you selected is not a valid choice. - Verdien du valgte er ikkje gyldig. + Verdien du valde er ikkje gyldig. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du må velge minst {{ limit }} valg. + Du må gjere minst {{ limit }} val. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan maksimalt gjere {{ limit }} valg. + Du kan maksimalt gjere {{ limit }} val. One or more of the given values is invalid. @@ -36,7 +36,7 @@ This field was not expected. - Dette feltet var ikke forventet. + Dette feltet var ikke forventa. This field is missing. @@ -56,7 +56,7 @@ The file could not be found. - Fila kunne ikkje finnes. + Fila er ikkje funnen. The file is not readable. @@ -64,11 +64,11 @@ The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + Fila er for stor ({{ size }} {{ suffix }}). Maksimal storleik er {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + Mime-typen av fila er ugyldig ({{ type }}). Tillatne mime-typar er {{ types }}. This value should be {{ limit }} or less. @@ -88,11 +88,11 @@ This value should not be blank. - Verdien må ikkje vere blank. + Verdien kan ikkje vere blank. This value should not be null. - Verdien må ikkje vere tom (null). + Verdien kan ikkje vere tom (null). This value should be null. @@ -104,7 +104,7 @@ This value is not a valid time. - Verdien er ikkje gyldig tidseining. + Verdien er ikkje ei gyldig tidseining. This value is not a valid URL. @@ -116,7 +116,7 @@ The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + Fila er for stor. Den maksimale storleiken er {{ limit }} {{ suffix }}. The file is too large. @@ -160,7 +160,7 @@ The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. + Biletbreidda er for stor, ({{ width }} pikslar). Tillaten maksimumsbreidde er {{ max_width }} pikslar. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. @@ -168,7 +168,7 @@ The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. + Bilethøgda er for stor, ({{ height }} pikslar). Tillaten maksimumshøgde er {{ max_height }} pikslar. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. @@ -184,7 +184,7 @@ The file was only partially uploaded. - Fila vart kun delvis opplasta. + Fila vart berre delvis lasta opp. No file was uploaded. @@ -220,7 +220,7 @@ Unsupported card type or invalid card number. - Korttypen er ikkje støtta eller ugyldig kortnummer. + Korttypen er ikkje støtta, eller kortnummeret er ugyldig. From c707c4c4556d87e508737110bdf2dadce587ee0f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 17 Jan 2018 14:30:10 +0100 Subject: [PATCH 39/74] [Cache] Fix handling of apcu_fetch() edgy behavior --- .../Component/Cache/Tests/Adapter/ApcuAdapterTest.php | 2 +- src/Symfony/Component/Cache/Traits/ApcuTrait.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php index 75b3fa299ec2..72df12e4b593 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php @@ -29,7 +29,7 @@ public function createCachePool($defaultLifetime = 0) } if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) { if ('testWithCliSapi' !== $this->getName()) { - $this->markTestSkipped('APCu extension is required.'); + $this->markTestSkipped('apc.enable_cli=1 is required.'); } } if ('\\' === DIRECTORY_SEPARATOR) { diff --git a/src/Symfony/Component/Cache/Traits/ApcuTrait.php b/src/Symfony/Component/Cache/Traits/ApcuTrait.php index 5614b390cf2f..fe7dfbab7d8c 100644 --- a/src/Symfony/Component/Cache/Traits/ApcuTrait.php +++ b/src/Symfony/Component/Cache/Traits/ApcuTrait.php @@ -52,7 +52,11 @@ private function init($namespace, $defaultLifetime, $version) protected function doFetch(array $ids) { try { - return apcu_fetch($ids) ?: array(); + foreach (apcu_fetch($ids, $ok) ?: array() as $k => $v) { + if (null !== $v || $ok) { + yield $k => $v; + } + } } catch (\Error $e) { throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } From 717663aac1f2c20e8859ed5f0834c82b4b6e6098 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jan 2018 09:58:59 -0800 Subject: [PATCH 40/74] Fixing a bug where the dump() function depended on bundle ordering --- .../DependencyInjection/Compiler/ExtensionPass.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index c829cfa4377f..e3f700f45728 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -85,7 +85,11 @@ public function process(ContainerBuilder $container) if ($container->getParameter('kernel.debug')) { $container->getDefinition('twig.extension.profiler')->addTag('twig.extension'); - $container->getDefinition('twig.extension.debug')->addTag('twig.extension'); + + // only register if the improved version from DebugBundle is *not* present + if (!$container->has('twig.extension.dump')) { + $container->getDefinition('twig.extension.debug')->addTag('twig.extension'); + } } $twigLoader = $container->getDefinition('twig.loader.native_filesystem'); From a6a330dcd9603ed3431e8608ae74f5693b85e3c1 Mon Sep 17 00:00:00 2001 From: Mateusz Sip Date: Sat, 13 Jan 2018 04:34:06 +0100 Subject: [PATCH 41/74] Enableable ArrayNodeDefinition is disabled for empty configuration --- .../Builder/ArrayNodeDefinition.php | 4 +++- .../Builder/ArrayNodeDefinitionTest.php | 15 +++++++++++++++ .../Definition/Builder/TreeBuilderTest.php | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index a0ad77edd079..607f1d1fe743 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -226,7 +226,9 @@ public function canBeEnabled() ->beforeNormalization() ->ifArray() ->then(function ($v) { - $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true; + if (!isset($v['enabled'])) { + $v['enabled'] = !empty($v); + } return $v; }) diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 16a38c30b0f9..4b6f4d7fd101 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -207,6 +207,20 @@ public function testCanBeDisabled() $this->assertTrue($this->getField($enabledNode, 'defaultValue')); } + public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized() + { + $config = array(); + + $node = new ArrayNodeDefinition('root'); + $node->canBeEnabled(); + + $this->assertEquals( + array('enabled' => false), + $node->getNode()->normalize($config), + 'An enableable node is disabled by default' + ); + } + public function testIgnoreExtraKeys() { $node = new ArrayNodeDefinition('root'); @@ -240,6 +254,7 @@ public function getEnableableNodeFixtures() array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'), array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'), array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'), + array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'), ); } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php index 0a9312346e98..6e99469a4e48 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -131,4 +132,22 @@ public function testDefinitionExampleGetsTransferredToNode() $this->assertInternalType('array', $tree->getExample()); $this->assertEquals('example', $children['child']->getExample()); } + + public function testRootNodeThatCanBeEnabledIsDisabledByDefault() + { + $builder = new TreeBuilder(); + + $builder->root('test') + ->canBeEnabled(); + + $tree = $builder->buildTree(); + $children = $tree->getChildren(); + + $this->assertFalse($children['enabled']->getDefaultValue()); + + $processor = new Processor(); + $result = $processor->process($tree, array()); + + $this->assertEquals(array('enabled' => false), $result); + } } From 205d7ae3f715095d1ec71ede7ff05f0c1b6c9fae Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 Jan 2018 09:54:17 +0100 Subject: [PATCH 42/74] [Debug] Always decorate existing exception handlers to deal with fatal errors --- src/Symfony/Component/Debug/ErrorHandler.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index c0f07e256d73..6a15f7b36830 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -147,11 +147,14 @@ public static function register($handler = null, $replace = true) $handler = $prev[0]; $replace = false; } - if ($replace || !$prev) { - $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException'))); - } else { + if (!$replace && $prev) { restore_error_handler(); } + if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) { + restore_exception_handler(); + } else { + $handler->setExceptionHandler($prev); + } $handler->throwAt($levels & $handler->thrownErrors, true); From a986efef0a47abdd5b7a4b3136bb547fffdb0aae Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 18 Jan 2018 12:52:12 +0100 Subject: [PATCH 43/74] fix the Composer API being used --- .github/build-packages.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/build-packages.php b/.github/build-packages.php index 56112b753ad3..b67a699609d6 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -49,8 +49,8 @@ $packages[$package->name][$package->version] = $package; - $versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json'); - $versions = json_decode($versions)->package->versions; + $versions = file_get_contents('https://packagist.org/p/'.$package->name.'.json'); + $versions = json_decode($versions)->packages->{$package->name}; if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { unset($versions->{'dev-master'}); From 13fa0454e434a67dc708f4af3fe1a07afc2acfd2 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 18 Jan 2018 14:55:12 +0100 Subject: [PATCH 44/74] [SecurityBundle] Don't register in memory users as services --- .../Security/UserProvider/InMemoryFactory.php | 13 ++++--------- .../CompleteConfigurationTest.php | 4 ---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php index b184385f221f..4d889cb523ff 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php @@ -14,7 +14,6 @@ use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; /** * InMemoryFactory creates services for the memory provider. @@ -27,17 +26,13 @@ class InMemoryFactory implements UserProviderFactoryInterface public function create(ContainerBuilder $container, $id, $config) { $definition = $container->setDefinition($id, new DefinitionDecorator('security.user.provider.in_memory')); + $users = array(); foreach ($config['users'] as $username => $user) { - $userId = $id.'_'.$username; - - $container - ->setDefinition($userId, new DefinitionDecorator('security.user.provider.in_memory.user')) - ->setArguments(array($username, (string) $user['password'], $user['roles'])) - ; - - $definition->addMethodCall('createUser', array(new Reference($userId))); + $users[$username] = array('password' => (string) $user['password'], 'roles' => $user['roles']); } + + $definition->addArgument($users); } public function getKey() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index e73110148656..855bed9b6899 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -44,12 +44,8 @@ public function testUserProviders() $expectedProviders = array( 'security.user.provider.concrete.default', - 'security.user.provider.concrete.default_foo', 'security.user.provider.concrete.digest', - 'security.user.provider.concrete.digest_foo', 'security.user.provider.concrete.basic', - 'security.user.provider.concrete.basic_foo', - 'security.user.provider.concrete.basic_bar', 'security.user.provider.concrete.service', 'security.user.provider.concrete.chain', ); From a4ddcc298d152bd3293163ea600fa59999f019a6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 Jan 2018 09:54:17 +0100 Subject: [PATCH 45/74] [HttpKernel] DebugHandlersListener should always replace the existing exception handler --- .travis.yml | 2 +- .../Debug/Tests/ErrorHandlerTest.php | 9 ++++ .../Tests/phpt/decorate_exception_hander.phpt | 47 +++++++++++++++++++ .../phpt/fatal_with_nested_handlers.phpt | 2 +- .../EventListener/DebugHandlersListener.php | 10 ++-- .../DebugHandlersListenerTest.php | 24 +++++++++- 6 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt diff --git a/.travis.yml b/.travis.yml index e34ba5a8bcaa..2a3e94569514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -181,7 +181,7 @@ install: elif [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" elif [[ $PHP = hhvm* ]]; then - $PHPUNIT --exclude-group benchmark,intl-data + $PHPUNIT --exclude-group no-hhvm,benchmark,intl-data else echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}" tfold tty-group $PHPUNIT --group tty diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index fd9ac577ee73..264dc701e7e2 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -293,6 +293,9 @@ public function testHandleDeprecation() @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); } + /** + * @group no-hhvm + */ public function testHandleException() { try { @@ -375,6 +378,9 @@ public function testErrorStacking() } } + /** + * @group no-hhvm + */ public function testHandleFatalError() { try { @@ -434,6 +440,9 @@ public function testHandleErrorException() $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); } + /** + * @group no-hhvm + */ public function testHandleFatalErrorOnHHVM() { try { diff --git a/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt b/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt new file mode 100644 index 000000000000..7ce7b9dc6f7d --- /dev/null +++ b/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- + +--EXPECTF-- +Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d +object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { + ["message":protected]=> + string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". +Did you forget a "use" statement for another namespace?" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(%d) "%s" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(0) { + } + ["previous":"Exception":private]=> + NULL + ["severity":protected]=> + int(1) +} diff --git a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt index 6a17648a2a61..897be3eb64be 100644 --- a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -35,7 +35,7 @@ array(1) { [0]=> string(37) "Error and exception handlers do match" } -object(Symfony\Component\Debug\Exception\FatalErrorException)#4 (8) { +object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (8) { ["message":protected]=> string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)" %a diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 0bcef55df9ae..b560e24d725a 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -117,9 +117,13 @@ public function configure(Event $event = null) } if ($this->exceptionHandler) { if ($handler instanceof ErrorHandler) { - $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler; - $handler->setExceptionHandler($h); - $handler = is_array($h) ? $h[0] : null; + $h = $handler->setExceptionHandler('var_dump'); + if (is_array($h) && $h[0] instanceof ExceptionHandler) { + $handler->setExceptionHandler($h); + $handler = $h[0]; + } else { + $handler->setExceptionHandler($this->exceptionHandler); + } } if ($handler instanceof ExceptionHandler) { $handler->setHandler($this->exceptionHandler); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php index d1349906bbe6..467b8dde8849 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -29,8 +29,6 @@ use Symfony\Component\HttpKernel\KernelEvents; /** - * DebugHandlersListenerTest. - * * @author Nicolas Grekas */ class DebugHandlersListenerTest extends TestCase @@ -132,4 +130,26 @@ public function testConsoleEvent() $xHandler(new \Exception()); } + + public function testReplaceExistingExceptionHandler() + { + $userHandler = function () {}; + $listener = new DebugHandlersListener($userHandler); + $eHandler = new ErrorHandler(); + $eHandler->setExceptionHandler('var_dump'); + + $exception = null; + set_exception_handler(array($eHandler, 'handleException')); + try { + $listener->configure(); + } catch (\Exception $exception) { + } + restore_exception_handler(); + + if (null !== $exception) { + throw $exception; + } + + $this->assertSame($userHandler, $eHandler->setExceptionHandler('var_dump')); + } } From 1cb8f6918f6d34be3a6875479ff083a7bacfcede Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jan 2018 12:05:40 +0100 Subject: [PATCH 46/74] [FrameworkBundle] fix DI extension tests The failing tests relied on the assets integration being enabled. Since we never did enable this explicitly, the assets related definitions are removed now that #25789 was merged which fixed #25760. --- .../DependencyInjection/Fixtures/php/templating_no_assets.php | 3 +++ .../DependencyInjection/Fixtures/xml/templating_no_assets.xml | 1 + .../DependencyInjection/Fixtures/yml/templating_no_assets.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php index bf12a8bc47e5..6c924433a520 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php @@ -1,6 +1,9 @@ loadFromExtension('framework', array( + 'assets' => array( + 'enabled' => true, + ), 'templating' => array( 'engines' => array('php', 'twig'), ), diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml index d579ed4c0a18..67eafc5e554e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml @@ -6,6 +6,7 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> + php twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml index 393477aeb49a..9e37c6d76f32 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml @@ -1,3 +1,5 @@ framework: + assets: + enabled: true templating: engines: [php, twig] From bcb79a39ef869ecf94f380d5bcc9fb2a4bce80cb Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Fri, 19 Jan 2018 12:39:28 +0100 Subject: [PATCH 47/74] [Validator] add missing parent isset and add test --- src/Symfony/Component/Validator/Constraint.php | 10 ++++++++++ .../Component/Validator/Tests/Constraints/FileTest.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 673b12ac00b3..ce7064bb4017 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -214,6 +214,16 @@ public function __get($option) throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); } + /** + * @param string $option The option name + * + * @return bool + */ + public function __isset($option) + { + return 'groups' === $option; + } + /** * Adds the given group if this constraint is in the Default group. * diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php index 8f05b827ef04..0f0e0ab6be69 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php @@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat) $this->assertSame($bytes, $file->maxSize); $this->assertSame($binaryFormat, $file->binaryFormat); + $this->assertTrue($file->__isset('maxSize')); + } + + public function testMagicIsset() + { + $file = new File(array('maxSize' => 1)); + + $this->assertTrue($file->__isset('maxSize')); + $this->assertTrue($file->__isset('groups')); + $this->assertFalse($file->__isset('toto')); } /** From 72d8e8adb0d76da3559e4942ae53eee981fea5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Sat, 20 Jan 2018 00:08:53 +0100 Subject: [PATCH 48/74] [Validator] Conflict with egulias/email-validator 2.0 --- composer.json | 1 + src/Symfony/Component/Validator/composer.json | 3 +++ 2 files changed, 4 insertions(+) diff --git a/composer.json b/composer.json index f263c15d4532..8a81a9f90df6 100644 --- a/composer.json +++ b/composer.json @@ -85,6 +85,7 @@ "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { + "egulias/email-validator": ">=2.0", "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "autoload": { diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index e6db2e6907f0..fc5f3c813721 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -42,6 +42,9 @@ "symfony/property-access": "For using the 2.4 Validator API", "symfony/expression-language": "For using the 2.4 Expression validator" }, + "conflict": { + "egulias/email-validator": ">=2.0" + }, "autoload": { "psr-4": { "Symfony\\Component\\Validator\\": "" }, "exclude-from-classmap": [ From ad8aff4203fe060ae5b736b9481fb57f343fc90e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 20 Jan 2018 09:34:19 +0100 Subject: [PATCH 49/74] [DI] compilation perf tweak --- .../DependencyInjection/Compiler/AbstractRecursivePass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php index 8ded4ba6d1cd..8576ed207ab9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php @@ -49,7 +49,7 @@ public function process(ContainerBuilder $container) */ protected function processValue($value, $isRoot = false) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { if ($isRoot) { $this->currentId = $k; From 1a1aaa74d666f203c9c76faebc20e22cebba8f8c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jan 2018 13:12:25 +0100 Subject: [PATCH 50/74] Revert "bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)" This reverts commit f1f18ad6082e8cd2f7ece5bc756545e50bd167ea, reversing changes made to 8e8ee0974720b52dbde2976bdd8942e4265e4408. --- composer.json | 1 - src/Symfony/Component/Validator/composer.json | 3 --- 2 files changed, 4 deletions(-) diff --git a/composer.json b/composer.json index 8a81a9f90df6..f263c15d4532 100644 --- a/composer.json +++ b/composer.json @@ -85,7 +85,6 @@ "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { - "egulias/email-validator": ">=2.0", "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "autoload": { diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index fc5f3c813721..e6db2e6907f0 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -42,9 +42,6 @@ "symfony/property-access": "For using the 2.4 Validator API", "symfony/expression-language": "For using the 2.4 Expression validator" }, - "conflict": { - "egulias/email-validator": ">=2.0" - }, "autoload": { "psr-4": { "Symfony\\Component\\Validator\\": "" }, "exclude-from-classmap": [ From 845eb88f3b5b165f89f69e5325334aa16aaf2e5d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jan 2018 16:04:53 +0100 Subject: [PATCH 51/74] don't split lines on carriage returns when dumping --- src/Symfony/Component/Yaml/Dumper.php | 2 +- src/Symfony/Component/Yaml/Tests/DumperTest.php | 8 +++++++- .../Tests/Fixtures/multiple_lines_as_literal_block.yml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 121edcf391f1..1ab58871a955 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -95,7 +95,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) $dumpAsMap = Inline::isHash($input); foreach ($input as $key => $value) { - if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) { + if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r\n")) { $output .= sprintf("%s%s%s |\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', ''); foreach (preg_split('/\n|\r\n/', $value) as $row) { diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index 1c80bec6506c..9d470b5b1fac 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -443,7 +443,8 @@ public function testDumpMultiLineStringAsScalarBlock() $data = array( 'data' => array( 'single_line' => 'foo bar baz', - 'multi_line' => "foo\nline with trailing spaces:\n \nbar\r\ninteger like line:\n123456789\nempty line:\n\nbaz", + 'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz", + 'multi_line_with_carriage_return' => "foo\nbar\r\nbaz", 'nested_inlined_multi_line_string' => array( 'inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz", ), @@ -453,6 +454,11 @@ public function testDumpMultiLineStringAsScalarBlock() $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } + public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock() + { + $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(array("a\r\nb\nc"), 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + } + /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The indentation must be greater than zero diff --git a/src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml b/src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml index b4903d30a11c..9d72f09be8a4 100644 --- a/src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml +++ b/src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml @@ -10,4 +10,5 @@ data: empty line: baz + multi_line_with_carriage_return: "foo\nbar\r\nbaz" nested_inlined_multi_line_string: { inlined_multi_line: "foo\nbar\r\nempty line:\n\nbaz" } From dc6d5e108399c3c70727ec9f4d7f708f2af6d551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82asiak?= Date: Sat, 20 Jan 2018 23:34:15 +0100 Subject: [PATCH 52/74] Formatting fix in upgrade 3.0 document --- UPGRADE-3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 147f98c67add..05c9b402b6bf 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1098,7 +1098,7 @@ UPGRADE FROM 2.x to 3.0 'http_digest' => array('secret' => '%secret%'), ), )); - ``` + ``` * The `AbstractVoter` class was removed. Instead, extend the new `Voter` class, introduced in 2.8, and move your voting logic to the to the `supports($attribute, $subject)` From 9312f794e8bdc85c1cf0fd94796e3a4761f8f1de Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 21 Jan 2018 08:24:24 +0100 Subject: [PATCH 53/74] Revert "bug #25789 Enableable ArrayNodeDefinition is disabled for empty configuration (kejwmen)" This reverts commit 132cec44f237b4688e345daf6954b7c5c750be83, reversing changes made to d41130153ea4e5627350855ac36552a824ae9197. --- .../Builder/ArrayNodeDefinition.php | 4 +--- .../Builder/ArrayNodeDefinitionTest.php | 15 --------------- .../Definition/Builder/TreeBuilderTest.php | 19 ------------------- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 607f1d1fe743..a0ad77edd079 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -226,9 +226,7 @@ public function canBeEnabled() ->beforeNormalization() ->ifArray() ->then(function ($v) { - if (!isset($v['enabled'])) { - $v['enabled'] = !empty($v); - } + $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true; return $v; }) diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 4b6f4d7fd101..16a38c30b0f9 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -207,20 +207,6 @@ public function testCanBeDisabled() $this->assertTrue($this->getField($enabledNode, 'defaultValue')); } - public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized() - { - $config = array(); - - $node = new ArrayNodeDefinition('root'); - $node->canBeEnabled(); - - $this->assertEquals( - array('enabled' => false), - $node->getNode()->normalize($config), - 'An enableable node is disabled by default' - ); - } - public function testIgnoreExtraKeys() { $node = new ArrayNodeDefinition('root'); @@ -254,7 +240,6 @@ public function getEnableableNodeFixtures() array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'), array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'), array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'), - array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'), ); } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php index 6e99469a4e48..0a9312346e98 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -132,22 +131,4 @@ public function testDefinitionExampleGetsTransferredToNode() $this->assertInternalType('array', $tree->getExample()); $this->assertEquals('example', $children['child']->getExample()); } - - public function testRootNodeThatCanBeEnabledIsDisabledByDefault() - { - $builder = new TreeBuilder(); - - $builder->root('test') - ->canBeEnabled(); - - $tree = $builder->buildTree(); - $children = $tree->getChildren(); - - $this->assertFalse($children['enabled']->getDefaultValue()); - - $processor = new Processor(); - $result = $processor->process($tree, array()); - - $this->assertEquals(array('enabled' => false), $result); - } } From 2daf4f98ffa0e994817b61e0003c0947f39342be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Sun, 21 Jan 2018 12:04:49 +0100 Subject: [PATCH 54/74] [Process] Skip environment variables with false value in Process --- src/Symfony/Component/Process/Process.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 6caa46b3562c..1d03297a33b6 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -331,7 +331,9 @@ public function start(callable $callback = null/*, array $env = array()*/) } else { $envPairs = array(); foreach ($env as $k => $v) { - $envPairs[] = $k.'='.$v; + if (false !== $v) { + $envPairs[] = $k.'='.$v; + } } } From d1a96ca9d35e41b2f26181e58db499099cb94fbb Mon Sep 17 00:00:00 2001 From: Jack Wright Date: Fri, 10 Nov 2017 11:21:24 +0000 Subject: [PATCH 55/74] [HttpFoundation] Added "resource" type on Request::create docblock --- src/Symfony/Component/HttpFoundation/Request.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ce7258acd693..297f036a2f09 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -294,13 +294,13 @@ public static function createFromGlobals() * The information contained in the URI always take precedence * over the other information (server and parameters). * - * @param string $uri The URI - * @param string $method The HTTP method - * @param array $parameters The query (GET) or request (POST) parameters - * @param array $cookies The request cookies ($_COOKIE) - * @param array $files The request files ($_FILES) - * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data + * @param string $uri The URI + * @param string $method The HTTP method + * @param array $parameters The query (GET) or request (POST) parameters + * @param array $cookies The request cookies ($_COOKIE) + * @param array $files The request files ($_FILES) + * @param array $server The server parameters ($_SERVER) + * @param string|resource $content The raw body data * * @return static */ From 6b608e8a5a611041ab6c308d23bdb60e1c97e6a5 Mon Sep 17 00:00:00 2001 From: AmsTaFFix Date: Wed, 15 Nov 2017 15:24:59 +0300 Subject: [PATCH 56/74] [HttpFoundation] fixed return type of method HeaderBag::get --- src/Symfony/Component/HttpFoundation/HeaderBag.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index a797d7a2e68f..d1065e797740 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -101,11 +101,11 @@ public function add(array $headers) /** * Returns a header value by name. * - * @param string $key The header name - * @param mixed $default The default value - * @param bool $first Whether to return the first value or all header values + * @param string $key The header name + * @param string|string[] $default The default value + * @param bool $first Whether to return the first value or all header values * - * @return string|array The first header value if $first is true, an array of values otherwise + * @return string|string[] The first header value or default value if $first is true, an array of values otherwise */ public function get($key, $default = null, $first = true) { @@ -129,9 +129,9 @@ public function get($key, $default = null, $first = true) /** * Sets a header by name. * - * @param string $key The key - * @param string|array $values The value or an array of values - * @param bool $replace Whether to replace the actual value or not (true by default) + * @param string $key The key + * @param string|string[] $values The value or an array of values + * @param bool $replace Whether to replace the actual value or not (true by default) */ public function set($key, $values, $replace = true) { From 9ce0ae23aee0cc32bbedb0436a47f267900017c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 7 Nov 2017 21:11:22 +0100 Subject: [PATCH 57/74] Have weak_vendors ignore deprecations from outside phar:// and eval() can execute code that may or may not come from the vendors. --- .../PhpUnit/DeprecationErrorHandler.php | 7 +++-- .../DeprecationErrorHandler/deprecation.phar | Bin 0 -> 6828 bytes .../deprecation/deprecation.php | 3 +++ .../DeprecationErrorHandler/generate_phar.php | 4 +++ .../weak_vendors_on_eval_d_deprecation.phpt | 23 ++++++++++++++++ .../weak_vendors_on_phar_deprecation.phpt | 25 ++++++++++++++++++ 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation.phar create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation/deprecation.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/generate_phar.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index d13fc14c0c6b..3fde9ab28b10 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -75,9 +75,12 @@ public static function register($mode = 0) } } } - $path = realpath($path) ?: $path; + $realPath = realpath($path); + if (false === $realPath && '-' !== $path && 'Standard input code' !== $path) { + return true; + } foreach ($vendors as $vendor) { - if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) { + if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) { return true; } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation.phar b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation.phar new file mode 100644 index 0000000000000000000000000000000000000000..20e1203bd058af00544b7ea3159cc4979546afd0 GIT binary patch literal 6828 zcmb_h%W~Vu6?L-Y#>o#%wOAMfibzqEWO+h8EZL%MRV0f;(MrXP3Izg95+l3DqoO4$dBX~vdtpr_5%V%&@+q3C5wG=-+lYu)8O9gWSZ1!#w{PQeP;TR$M4ob zGIwh=f6OdDvYj+_?kzK!I;q)US)Otyv?n~bZ&N2pc$!(OtL()K<_1od+5FDW^2{=O zl6?cueyq`=)A6I6r!G(OcYeU%%_0|)yR{6O{KySv9=8)GpGr%eR?B4T%(ma1oOW#+ zAA3iG5B5d3cho-`ocBQ>7v=<4p-oysH1xrWW+}xIW zE(S;a!EP<(`7DigYd^`H99n(`uPp=a^e?;pq1o?#|EYU1us`)r%qx+MWgKVS!H4r> z#Z;j|KWF>cjrZMw$-aDHi-zXddgm7db5$gI-u+2z<>`zgb|dsdo?(aOX4a5{Bs1Cm z0o!cUOjmp|bAFe%lECpJlZe&SB&lRxTdN{_xmQJ=RuO}EQbkUqN^*XeS8?BEl?JJx zDcCmRLKzgFof}_jx$!+7w`d8DQK(|{LubNUw4{7wGGQ`Jv;uMBkEH_1N=s0uc_^tO zqgVxs8Z04~HEVX?jmxUyvzl_%-RBN>k=bn^*anZyYWeAmhSIBMNB ze{gP`%uW3yCzYY^sq{EA&yQPTE$LF_6LPF_ugF*ub9^J2@xkY z2OSp0O_wMQ7S6J~nerPa@I5EzbqHyhUg}Ij=aHG7)r^so@yH1|&c6O=>8=U}>hUY+ z=}DYbbR*Hv&_K1M=rQip^HXcS(-=7q6H+G|xoElNzG);m9LQ!Pm|AYKkcYxIM|OpO|8%@wo8?Vj&_4>Z)~%Van9bwv&f?;xjT(neUBQ?!Ji|xM-udb z?d5(R@BQgswhk~dhrB;NvykXAxaLze5Mlo1x8 zbotRZrZCmcs-Zd>nwV5P%FwhhNojj^kaS|Od(FXp!aJ-q&`O)Bc}{sW$)|El#|Sa= zA7oCca2=0G(zf17frsSe7vpqj%zGkTAuc&?7oMXY_gS0#EzXJa81>HyZi+zt$uz)k zZZG;*odi_u5_kR|IRPXRxQ~^~ul8dt%P~`2Ci(&}o?6AJKSA~G*4#MCa`yf+_Icy3 zy|J;ONpC)H3fg9gc6M~}2SMB_5d|~@bq=yhwWr;Wc(AkcatjSmnH~df(vV}oM25t3 z;2AqX##iC4F-~Y1C+H};J2se^j_7=hGtRFqumJt?VBG1z0LaEEL}pRqxYw3>31}=% z`j~1*GH(+gH9~Ni1gE_i8xPx#2g-Nt-*3vQHcp4_E1VbI&q6xW^jNel#lFZSS_>u> z_0^J1pjfD9b#%#_o zEJpz*L6d?oSs`z&GOe6NoO@sy$Ei@#bmK5dIXZ*KaCdUjOa`T{3nfoc-OF7aJ$PJe zTJ(1G;3u0u>uy=c5|2j@n_qEQ9N1zX@-U%UuWMpOKE)(j@iSci{G4)S$>A@`HA5C~ z%BXh>C1Pb~fK~Et2Tj!GP#gdp=#wRW42j+PDqBH|RL8RXl(Y%-@Kk8IsQMObV0bu}+nGz;(>ZJD!Lfp+`e9B|m7`ity+J3qFI+JC+ zveZch!|60z#H}P-=DJ2%UZVG>xW zs5P8JHB&2BDg7GPlT5n-M>oLm6X?A-N5Yq(?vUizDh2?iz$0EQZ(k9#kdr3h&QFYE zdZDTPT&|Ru+!j@Cv?rE&ATomSHBLm7?lg=s!4`7>%R4(eWLf;H$&0{z@u=AopZv zY2A5TcZq=V z+Qu6W>d}Or4VOX^&xhoCO(9yt6|IKuTy7aR3sKD2!!kB@DPg1tC0cY(5Ski~ON&p$ z1Qw?dG@g@QltPvORJ;2K83hG4r7h937GxD9)WUNBu8^OHi;!#Eu0;mfYT*e9f;y%7!TsWk3#EJ7C`t$K-I-7;ym)$Rhk*04& zG`f_!mO!KN94=DhRhy!b1pSLxLWQP-RVCV;`vwEoUC7$@hojSh{r3E*ZF7qyH?+c{z+Q!vnRewI?Qp& zpYYTcm1dbI43`>?J8B&M`>%gz&e%y;Smzimu4{k77bx~|w}-c1M}zJ$JpJbE`Tp~7 cw*T?wzpbmoPuFLMfBVn(zlQGjZ_eKQ4>9=~j{pDw literal 0 HcmV?d00001 diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation/deprecation.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation/deprecation.php new file mode 100644 index 000000000000..b9e23e769215 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/deprecation/deprecation.php @@ -0,0 +1,3 @@ +buildFromDirectory(__DIR__.DIRECTORY_SEPARATOR.'deprecation'); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt new file mode 100644 index 000000000000..6bba1c86be5a --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_eval_d_deprecation.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation +--FILE-- + +--EXPECTF-- + +Other deprecation notices (1) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt new file mode 100644 index 000000000000..4c4879e61156 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_phar_deprecation.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation +The phar can be regenerated by running php src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/generate_phar.php +--FILE-- + +--EXPECTF-- + +Other deprecation notices (1) From ecdbea2ba97ffc09084db89d6f5381e002d3e333 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Sun, 21 Jan 2018 20:33:21 +0100 Subject: [PATCH 58/74] Improve phpdoc to make it more explicit It confused me a lot that the method took an array and that the phpdoc said we should pass a string instead of an array. This small change should clear up the confusion. --- src/Symfony/Component/Process/Process.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index c267f6896c26..b5eb7f77d553 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1000,7 +1000,7 @@ public function getEnv() /** * Sets the environment variables. * - * An environment variable value should be a string. + * Each environment variable value should be a string. * If it is an array, the variable is ignored. * * That happens in PHP when 'argv' is registered into From 36cd267590738bc85ce9c7ab4626c434f7c1c55e Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 22 Jan 2018 02:52:01 +0100 Subject: [PATCH 59/74] [VarDumper] Fix docblock --- src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index cd892a9687e0..6d2d7873fa77 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -114,9 +114,9 @@ public function setCharset($charset) /** * Sets the indentation pad string. * - * @param string $pad A string the will be prepended to dumped lines, repeated by nesting level + * @param string $pad A string that will be prepended to dumped lines, repeated by nesting level * - * @return string The indent pad + * @return string The previous indent pad */ public function setIndentPad($pad) { From fb1be51a5c4f3ea8f09ed0af93d29d38a534557e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jan 2018 14:11:18 +0100 Subject: [PATCH 60/74] revert useless tests fixtures changes This will revert #25847. Basically, the changes done in #25847 were not wrong per se. However, those changes were not necessary as the tests were not failing because of the missing "assets" config, but due to an issue introduced in the Config component. Furthermore, removing this part of the config fixtures gives us the benefit that our before normalization logic that enables assets support when the templating integration is enabled is properly tested. --- .../DependencyInjection/Fixtures/php/templating_no_assets.php | 3 --- .../DependencyInjection/Fixtures/xml/templating_no_assets.xml | 1 - .../DependencyInjection/Fixtures/yml/templating_no_assets.yml | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php index 6c924433a520..bf12a8bc47e5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/templating_no_assets.php @@ -1,9 +1,6 @@ loadFromExtension('framework', array( - 'assets' => array( - 'enabled' => true, - ), 'templating' => array( 'engines' => array('php', 'twig'), ), diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml index 67eafc5e554e..d579ed4c0a18 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/templating_no_assets.xml @@ -6,7 +6,6 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - php twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml index 9e37c6d76f32..393477aeb49a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/templating_no_assets.yml @@ -1,5 +1,3 @@ framework: - assets: - enabled: true templating: engines: [php, twig] From 52dd825bf1033a6674433698a768af219c976526 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jan 2018 21:35:04 +0100 Subject: [PATCH 61/74] allow null values for root nodes in YAML configs --- .../DependencyInjection/ContainerBuilder.php | 6 +++++- .../DependencyInjection/Loader/YamlFileLoader.php | 2 +- .../Tests/Fixtures/includes/ProjectExtension.php | 9 ++++++++- .../Tests/Fixtures/yaml/null_config.yml | 1 + .../Tests/Loader/YamlFileLoaderTest.php | 11 +++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/null_config.yml diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 59f8cc7d0dcb..626cda2e24b3 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -271,12 +271,16 @@ public function addClassResource(\ReflectionClass $class) * @throws BadMethodCallException When this ContainerBuilder is frozen * @throws \LogicException if the container is frozen */ - public function loadFromExtension($extension, array $values = array()) + public function loadFromExtension($extension, array $values = null) { if ($this->isFrozen()) { throw new BadMethodCallException('Cannot load from an extension on a frozen container.'); } + if (func_num_args() < 2) { + $values = array(); + } + $namespace = $this->getExtension($extension)->getAlias(); $this->extensionConfigs[$namespace][] = $values; diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index b6b9e93a86ca..c5c4f89784c6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -425,7 +425,7 @@ private function loadFromExtensions(array $content) continue; } - if (!is_array($values)) { + if (!is_array($values) && null !== $values) { $values = array(); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php index c9f801026871..ba07d7c44cbd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php @@ -8,7 +8,14 @@ class ProjectExtension implements ExtensionInterface { public function load(array $configs, ContainerBuilder $configuration) { - $config = call_user_func_array('array_merge', $configs); + $configuration->setParameter('project.configs', $configs); + $configs = array_filter($configs); + + if ($configs) { + $config = call_user_func_array('array_merge', $configs); + } else { + $config = array(); + } $configuration->setDefinition('project.service.bar', new Definition('FooClass')); $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/null_config.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/null_config.yml new file mode 100644 index 000000000000..e88e12e2f286 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/null_config.yml @@ -0,0 +1 @@ +project: ~ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 85c74b572d08..54e340757e9d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -207,6 +207,17 @@ public function testExtensions() } } + public function testExtensionWithNullConfig() + { + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectExtension()); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('null_config.yml'); + $container->compile(); + + $this->assertSame(array(null), $container->getParameter('project.configs')); + } + public function testSupports() { $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator()); From 609372252f973a0d1a701a330ee18e6f4c36182c Mon Sep 17 00:00:00 2001 From: Vladimir Reznichenko Date: Tue, 23 Jan 2018 12:06:14 +0100 Subject: [PATCH 62/74] SCA: get rid of repetitive calls --- .../Bundle/FrameworkBundle/Console/Application.php | 9 +++++---- .../FrameworkBundle/Console/Descriptor/Descriptor.php | 7 ++++--- .../DependencyInjection/FrameworkExtension.php | 3 ++- .../Bundle/FrameworkBundle/HttpCache/HttpCache.php | 5 +++-- .../EventListener/AddRequestFormatsListener.php | 3 ++- src/Symfony/Component/Validator/ExecutionContext.php | 3 ++- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 54383aad94aa..53d2b1370b88 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -35,10 +35,11 @@ public function __construct(KernelInterface $kernel) parent::__construct('Symfony', Kernel::VERSION.' - '.$kernel->getName().'/'.$kernel->getEnvironment().($kernel->isDebug() ? '/debug' : '')); - $this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.')); - $this->getDefinition()->addOption(new InputOption('--process-isolation', null, InputOption::VALUE_NONE, 'Launch commands from shell as a separate process.')); - $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment())); - $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.')); + $inputDefinition = $this->getDefinition(); + $inputDefinition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.')); + $inputDefinition->addOption(new InputOption('--process-isolation', null, InputOption::VALUE_NONE, 'Launch commands from shell as a separate process.')); + $inputDefinition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment())); + $inputDefinition->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.')); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 3d1bbd831da1..32b1f751a813 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -110,9 +110,10 @@ protected function write($content, $decorated = false) protected function renderTable(Table $table, $decorated = false) { if (!$decorated) { - $table->getStyle()->setCellRowFormat('%s'); - $table->getStyle()->setCellRowContentFormat('%s'); - $table->getStyle()->setCellHeaderFormat('%s'); + $tableStyle = $table->getStyle(); + $tableStyle->setCellRowFormat('%s'); + $tableStyle->setCellRowContentFormat('%s'); + $tableStyle->setCellHeaderFormat('%s'); } $table->render(); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index dff3d0a62e58..7430f3723ae9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -463,8 +463,9 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB if (1 === count($engines)) { $container->setAlias('templating', (string) reset($engines)); } else { + $templateEngineDefinition = $container->getDefinition('templating.engine.delegating'); foreach ($engines as $engine) { - $container->getDefinition('templating.engine.delegating')->addMethodCall('addEngine', array($engine)); + $templateEngineDefinition->addMethodCall('addEngine', array($engine)); } $container->setAlias('templating', 'templating.engine.delegating'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php index d50598bb1db0..6827ae20fcca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php +++ b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php @@ -52,8 +52,9 @@ public function __construct(HttpKernelInterface $kernel, $cacheDir = null) protected function forward(Request $request, $raw = false, Response $entry = null) { $this->getKernel()->boot(); - $this->getKernel()->getContainer()->set('cache', $this); - $this->getKernel()->getContainer()->set($this->getSurrogate()->getName(), $this->getSurrogate()); + $container = $this->getKernel()->getContainer(); + $container->set('cache', $this); + $container->set($this->getSurrogate()->getName(), $this->getSurrogate()); return parent::forward($request, $raw, $entry); } diff --git a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php index ecf6f5919049..f21fc6ab7c78 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php @@ -34,8 +34,9 @@ public function __construct(array $formats) */ public function onKernelRequest(GetResponseEvent $event) { + $request = $event->getRequest(); foreach ($this->formats as $format => $mimeTypes) { - $event->getRequest()->setFormat($format, $mimeTypes); + $request->setFormat($format, $mimeTypes); } } diff --git a/src/Symfony/Component/Validator/ExecutionContext.php b/src/Symfony/Component/Validator/ExecutionContext.php index 0603ffb62f93..b4cb99ca9ebf 100644 --- a/src/Symfony/Component/Validator/ExecutionContext.php +++ b/src/Symfony/Component/Validator/ExecutionContext.php @@ -197,8 +197,9 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals { $propertyPath = $this->getPropertyPath($subPath); + $visitor = $this->globalContext->getVisitor(); foreach ($this->resolveGroups($groups) as $group) { - $this->globalContext->getVisitor()->validate($value, $group, $propertyPath, $traverse, $deep); + $visitor->validate($value, $group, $propertyPath, $traverse, $deep); } } From 4683f6d45447924709d2c7c9c166d504fb82b33d Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 23 Jan 2018 18:17:18 -0200 Subject: [PATCH 63/74] Improve assertions --- .../DependencyInjection/MainConfigurationTest.php | 4 ++-- .../Compiler/ResolveDefinitionTemplatesPassTest.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php index c22ef76a6b56..b70ad2a21c8c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php @@ -84,9 +84,9 @@ public function testCsrfAliases() $processor = new Processor(); $configuration = new MainConfiguration(array(), array()); $processedConfig = $processor->processConfiguration($configuration, array($config)); - $this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_generator'])); + $this->assertArrayHasKey('csrf_token_generator', $processedConfig['firewalls']['stub']['logout']); $this->assertEquals('a_token_generator', $processedConfig['firewalls']['stub']['logout']['csrf_token_generator']); - $this->assertTrue(isset($processedConfig['firewalls']['stub']['logout']['csrf_token_id'])); + $this->assertArrayHasKey('csrf_token_id', $processedConfig['firewalls']['stub']['logout']); $this->assertEquals('a_token_id', $processedConfig['firewalls']['stub']['logout']['csrf_token_id']); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php index ec7633feeaf4..1626e0ab1c60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php @@ -280,23 +280,23 @@ public function testDeepDefinitionsResolving() $this->process($container); $configurator = $container->getDefinition('sibling')->getConfigurator(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($configurator)); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $configurator); $this->assertSame('parentClass', $configurator->getClass()); $factory = $container->getDefinition('sibling')->getFactory(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($factory[0])); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $factory[0]); $this->assertSame('parentClass', $factory[0]->getClass()); $argument = $container->getDefinition('sibling')->getArgument(0); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($argument)); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $argument); $this->assertSame('parentClass', $argument->getClass()); $properties = $container->getDefinition('sibling')->getProperties(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($properties['prop'])); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $properties['prop']); $this->assertSame('parentClass', $properties['prop']->getClass()); $methodCalls = $container->getDefinition('sibling')->getMethodCalls(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($methodCalls[0][1][0])); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $methodCalls[0][1][0]); $this->assertSame('parentClass', $methodCalls[0][1][0]->getClass()); } From 8ecfeb1e31f8d0a8239ec47235bf4fd39d3d1b49 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Wed, 24 Jan 2018 17:32:05 +0100 Subject: [PATCH 64/74] Restore RoleInterface import --- .../Core/Authentication/Token/PreAuthenticatedToken.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php index a2c6e0e4f9f1..84fdb4b00c08 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Security\Core\Authentication\Token; +use Symfony\Component\Security\Core\Role\RoleInterface; + /** * PreAuthenticatedToken implements a pre-authenticated token. * From 3d90a2217dd339187eaba2eb100431e13919c8bc Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 23 Jan 2018 17:04:24 -0200 Subject: [PATCH 65/74] Improve assertions --- src/Symfony/Component/Finder/Tests/FinderTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index f445c79c5ef2..6e13e9c3832d 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Finder\Tests; use Symfony\Component\Finder\Adapter\AdapterInterface; -use Symfony\Component\Finder\Adapter\GnuFindAdapter; use Symfony\Component\Finder\Adapter\PhpAdapter; use Symfony\Component\Finder\Finder; @@ -610,15 +609,15 @@ public function testAdapterSelection() { // test that by default, PhpAdapter is selected $adapters = Finder::create()->getAdapters(); - $this->assertTrue($adapters[0] instanceof PhpAdapter); + $this->assertInstanceOf('Symfony\Component\Finder\Adapter\PhpAdapter', $adapters[0]); // test another adapter selection $adapters = Finder::create()->setAdapter('gnu_find')->getAdapters(); - $this->assertTrue($adapters[0] instanceof GnuFindAdapter); + $this->assertInstanceOf('Symfony\Component\Finder\Adapter\GnuFindAdapter', $adapters[0]); // test that useBestAdapter method removes selection $adapters = Finder::create()->useBestAdapter()->getAdapters(); - $this->assertFalse($adapters[0] instanceof PhpAdapter); + $this->assertNotInstanceOf('Symfony\Component\Finder\Adapter\PhpAdapter', $adapters[0]); } public function getTestPathData() From 9f0c7bf549669dfba434073be00c039a451acc48 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Thu, 25 Jan 2018 02:37:16 +0100 Subject: [PATCH 66/74] Fixed Button::setParent() when already submitted --- src/Symfony/Component/Form/Button.php | 4 ++++ .../Component/Form/Tests/ButtonTest.php | 20 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index 3dbe110fcb08..d7832753131d 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -106,6 +106,10 @@ public function offsetUnset($offset) */ public function setParent(FormInterface $parent = null) { + if ($this->submitted) { + throw new AlreadySubmittedException('You cannot set the parent of a submitted button'); + } + $this->parent = $parent; } diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php index 08d2d74e65b3..a81c2db5511c 100644 --- a/src/Symfony/Component/Form/Tests/ButtonTest.php +++ b/src/Symfony/Component/Form/Tests/ButtonTest.php @@ -30,6 +30,20 @@ protected function setUp() $this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(); } + /** + * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException + */ + public function testSetParentOnSubmittedButton() + { + $button = $this->getButtonBuilder('button') + ->getForm() + ; + + $button->submit(''); + + $button->setParent($this->getFormBuilder('form')->getForm()); + } + /** * @dataProvider getDisabledStates */ @@ -37,11 +51,13 @@ public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, { $form = $this->getFormBuilder('form') ->setDisabled($parentDisabled) - ->getForm(); + ->getForm() + ; $button = $this->getButtonBuilder('button') ->setDisabled($buttonDisabled) - ->getForm(); + ->getForm() + ; $button->setParent($form); From 804b2a1a4720a81ce92ab6d2a852363975e67f17 Mon Sep 17 00:00:00 2001 From: HeahDude Date: Mon, 18 Sep 2017 17:34:11 +0200 Subject: [PATCH 67/74] Fixed submitting disabled buttons --- src/Symfony/Component/Form/SubmitButton.php | 6 +++++ .../Component/Form/Tests/CompoundFormTest.php | 22 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Symfony/Component/Form/SubmitButton.php b/src/Symfony/Component/Form/SubmitButton.php index ae69e0426d6b..2422e11cd898 100644 --- a/src/Symfony/Component/Form/SubmitButton.php +++ b/src/Symfony/Component/Form/SubmitButton.php @@ -43,6 +43,12 @@ public function isClicked() */ public function submit($submittedData, $clearMissing = true) { + if ($this->getConfig()->getDisabled()) { + $this->clicked = false; + + return $this; + } + parent::submit($submittedData, $clearMissing); $this->clicked = null !== $submittedData; diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 5f638b68fe43..7975570cccc6 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -1066,6 +1066,28 @@ public function testClickedButtonFromParentForm() $this->assertSame($button, $this->form->getClickedButton()); } + public function testDisabledButtonIsNotSubmitted() + { + $button = new SubmitButtonBuilder('submit'); + $submit = $button + ->setDisabled(true) + ->getForm(); + + $form = $this->createForm() + ->add($this->getBuilder('text')->getForm()) + ->add($submit) + ; + + $form->submit(array( + 'text' => '', + 'submit' => '', + )); + + $this->assertTrue($submit->isDisabled()); + $this->assertFalse($submit->isClicked()); + $this->assertFalse($submit->isSubmitted()); + } + protected function createForm() { return $this->getBuilder() From b77538c2fe168941060965898826cf327f1f23e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Fri, 26 Jan 2018 02:31:46 +0100 Subject: [PATCH 68/74] Disable CSP header on exception pages only in debug Same condition is used by default TwigBridge ExceptionController to evaluate if styled exception page is supposed to be shown. --- src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml | 1 + .../HttpKernel/EventListener/ExceptionListener.php | 6 ++++-- .../Tests/EventListener/ExceptionListenerTest.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index 0e5f6ec9a4a3..c0a15e5152ce 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -129,6 +129,7 @@ %twig.exception_listener.controller% + %kernel.debug% diff --git a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index b42418e7a294..32d0a130ffd0 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -32,11 +32,13 @@ class ExceptionListener implements EventSubscriberInterface { protected $controller; protected $logger; + protected $debug; - public function __construct($controller, LoggerInterface $logger = null) + public function __construct($controller, LoggerInterface $logger = null, $debug = false) { $this->controller = $controller; $this->logger = $logger; + $this->debug = $debug; } public function onKernelException(GetResponseForExceptionEvent $event) @@ -71,7 +73,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) $event->setResponse($response); - if ($eventDispatcher instanceof EventDispatcherInterface) { + if ($this->debug && $eventDispatcher instanceof EventDispatcherInterface) { $cspRemovalListener = function (FilterResponseEvent $event) use (&$cspRemovalListener, $eventDispatcher) { $event->getResponse()->headers->remove('Content-Security-Policy'); $eventDispatcher->removeListener(KernelEvents::RESPONSE, $cspRemovalListener); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index db34f9187bd1..3cb0b298bb07 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -134,7 +134,7 @@ public function testCSPHeaderIsRemoved() return new Response($request->getRequestFormat()); })); - $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock()); + $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true); $dispatcher->addSubscriber($listener); From 667b9295f86d15023cb03e9cec9c9b88619aea03 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Jan 2018 16:23:25 +0100 Subject: [PATCH 69/74] Revert "bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit)" This reverts commit ccc93678fdca348d3bf23d17013c45f39eadafd9, reversing changes made to e77545ab8d1382387a1ba9512d1d3affb20617ad. --- src/Symfony/Component/Console/Input/ArgvInput.php | 2 -- src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 23430edde6f7..4493a5bafc3b 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -284,8 +284,6 @@ public function hasParameterOption($values) } if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) { - $noValue = explode('=', $token); - $token = $noValue[0]; $searchableToken = str_replace('-', '', $token); $searchableValue = str_replace('-', '', $value); if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) { diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 8ded178bbeb6..85fb533715b6 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -299,9 +299,6 @@ public function testHasParameterOption() $input = new ArgvInput(array('cli.php', '-fh')); $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '-e=test')); - $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo', 'foo')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); From 4f47bb73a0727d865461ddb51dcb56414e37577f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Jan 2018 16:25:25 +0100 Subject: [PATCH 70/74] Revert "bug #24987 [Console] Fix global console flag when used in chain (Simperfit)" This reverts commit 9107fb0afd7369618c9d3e293e323a4894f8cbd0, reversing changes made to abe6e92593aef46cfc8de13b998209862d8fbc62. --- src/Symfony/Component/Console/Input/ArgvInput.php | 8 -------- .../Component/Console/Tests/Input/ArgvInputTest.php | 3 --- 2 files changed, 11 deletions(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 4493a5bafc3b..c2f533eb3679 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -282,14 +282,6 @@ public function hasParameterOption($values) if ($token === $value || 0 === strpos($token, $value.'=')) { return true; } - - if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) { - $searchableToken = str_replace('-', '', $token); - $searchableValue = str_replace('-', '', $value); - if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) { - return true; - } - } } } diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 85fb533715b6..1fe21d0f6c1a 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -296,9 +296,6 @@ public function testHasParameterOption() $input = new ArgvInput(array('cli.php', '-f', 'foo')); $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '-fh')); - $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo', 'foo')); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); From 5b73d1c1e6bd3cc4ac905ef3ee49e0ec02561db4 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 27 Jan 2018 12:01:42 +0100 Subject: [PATCH 71/74] Removed assertDateTimeEquals() methods. --- .../Component/Form/Test/TypeTestCase.php | 5 ----- .../Core/DataTransformer/DateTimeTestCase.php | 22 ------------------- .../DateTimeToArrayTransformerTest.php | 11 +++++----- ...teTimeToLocalizedStringTransformerTest.php | 19 ++++++++-------- .../DateTimeToRfc3339TransformerTest.php | 7 +++--- .../DateTimeToStringTransformerTest.php | 7 +++--- .../DateTimeToTimestampTransformerTest.php | 7 +++--- .../Extension/Core/Type/DateTimeTypeTest.php | 10 ++++----- .../Extension/Core/Type/DateTypeTest.php | 14 ++++++------ .../Extension/Core/Type/TimeTypeTest.php | 2 +- 10 files changed, 41 insertions(+), 63 deletions(-) delete mode 100644 src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php index a1e360de1191..28779acfa025 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -33,9 +33,4 @@ protected function setUp() $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); } - - public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) - { - self::assertEquals($expected->format('c'), $actual->format('c')); - } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php deleted file mode 100644 index c6d1a07cd780..000000000000 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; - -use PHPUnit\Framework\TestCase; - -abstract class DateTimeTestCase extends TestCase -{ - public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) - { - self::assertEquals($expected->format('U'), $actual->format('U')); - } -} diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php index 3a653b30002c..c3f2aac53eff 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; +use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; -class DateTimeToArrayTransformerTest extends DateTimeTestCase +class DateTimeToArrayTransformerTest extends TestCase { public function testTransform() { @@ -163,7 +164,7 @@ public function testReverseTransform() $output = new \DateTime('2010-02-03 04:05:06 UTC'); - $this->assertDateTimeEquals($output, $transformer->reverseTransform($input)); + $this->assertEquals($output, $transformer->reverseTransform($input)); } public function testReverseTransformWithSomeZero() @@ -181,7 +182,7 @@ public function testReverseTransformWithSomeZero() $output = new \DateTime('2010-02-03 04:00:00 UTC'); - $this->assertDateTimeEquals($output, $transformer->reverseTransform($input)); + $this->assertEquals($output, $transformer->reverseTransform($input)); } public function testReverseTransformCompletelyEmpty() @@ -326,7 +327,7 @@ public function testReverseTransformDifferentTimezones() $output = new \DateTime('2010-02-03 04:05:06 Asia/Hong_Kong'); $output->setTimezone(new \DateTimeZone('America/New_York')); - $this->assertDateTimeEquals($output, $transformer->reverseTransform($input)); + $this->assertEquals($output, $transformer->reverseTransform($input)); } public function testReverseTransformToDifferentTimezone() @@ -345,7 +346,7 @@ public function testReverseTransformToDifferentTimezone() $output = new \DateTime('2010-02-03 04:05:06 UTC'); $output->setTimezone(new \DateTimeZone('Asia/Hong_Kong')); - $this->assertDateTimeEquals($output, $transformer->reverseTransform($input)); + $this->assertEquals($output, $transformer->reverseTransform($input)); } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index 60b83c222b7f..8e596ac33a1c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; +use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer; use Symfony\Component\Intl\Util\IntlTestHelper; -class DateTimeToLocalizedStringTransformerTest extends DateTimeTestCase +class DateTimeToLocalizedStringTransformerTest extends TestCase { protected $dateTime; protected $dateTimeWithoutSeconds; @@ -226,7 +227,7 @@ public function testReverseTransformFullTime() { $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL); - $this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('03.02.2010, 04:05:06 GMT+00:00')); + $this->assertEquals($this->dateTime, $transformer->reverseTransform('03.02.2010, 04:05:06 GMT+00:00')); } public function testReverseTransformFromDifferentLocale() @@ -235,7 +236,7 @@ public function testReverseTransformFromDifferentLocale() $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC'); - $this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM')); + $this->assertEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM')); } public function testReverseTransformWithDifferentTimezones() @@ -245,7 +246,7 @@ public function testReverseTransformWithDifferentTimezones() $dateTime = new \DateTime('2010-02-03 04:05:00 Asia/Hong_Kong'); $dateTime->setTimezone(new \DateTimeZone('America/New_York')); - $this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('03.02.2010, 04:05')); + $this->assertEquals($dateTime, $transformer->reverseTransform('03.02.2010, 04:05')); } public function testReverseTransformOnlyDateWithDifferentTimezones() @@ -254,21 +255,21 @@ public function testReverseTransformOnlyDateWithDifferentTimezones() $dateTime = new \DateTime('2017-01-10 11:00', new \DateTimeZone('Europe/Berlin')); - $this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('2017-01-10')); + $this->assertEquals($dateTime, $transformer->reverseTransform('2017-01-10')); } public function testReverseTransformWithDifferentPatterns() { $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'MM*yyyy*dd HH|mm|ss'); - $this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('02*2010*03 04|05|06')); + $this->assertEquals($this->dateTime, $transformer->reverseTransform('02*2010*03 04|05|06')); } public function testReverseTransformDateOnlyWithDstIssue() { $transformer = new DateTimeToLocalizedStringTransformer('Europe/Rome', 'Europe/Rome', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy'); - $this->assertDateTimeEquals( + $this->assertEquals( new \DateTime('1978-05-28', new \DateTimeZone('Europe/Rome')), $transformer->reverseTransform('28/05/1978') ); @@ -278,7 +279,7 @@ public function testReverseTransformDateOnlyWithDstIssueAndEscapedText() { $transformer = new DateTimeToLocalizedStringTransformer('Europe/Rome', 'Europe/Rome', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, "'day': dd 'month': MM 'year': yyyy"); - $this->assertDateTimeEquals( + $this->assertEquals( new \DateTime('1978-05-28', new \DateTimeZone('Europe/Rome')), $transformer->reverseTransform('day: 28 month: 05 year: 1978') ); @@ -332,7 +333,7 @@ public function testReverseTransformWithNonExistingDate() { $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::SHORT); - $this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05')); + $this->assertEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05')); } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index 331dfea14ed2..c02d3dd6950b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; +use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer; -class DateTimeToRfc3339TransformerTest extends DateTimeTestCase +class DateTimeToRfc3339TransformerTest extends TestCase { protected $dateTime; protected $dateTimeWithoutSeconds; @@ -107,9 +108,9 @@ public function testReverseTransform($toTz, $fromTz, $to, $from) $transformer = new DateTimeToRfc3339Transformer($toTz, $fromTz); if (null !== $to) { - $this->assertDateTimeEquals(new \DateTime($to), $transformer->reverseTransform($from)); + $this->assertEquals(new \DateTime($to), $transformer->reverseTransform($from)); } else { - $this->assertSame($to, $transformer->reverseTransform($from)); + $this->assertNull($transformer->reverseTransform($from)); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php index e2389ebf003a..a927f200f0fd 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; +use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; -class DateTimeToStringTransformerTest extends DateTimeTestCase +class DateTimeToStringTransformerTest extends TestCase { public function dataProvider() { @@ -126,7 +127,7 @@ public function testReverseTransform($format, $input, $output) $output = new \DateTime($output); - $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input)); + $this->assertEquals($output, $reverseTransformer->reverseTransform($input)); } public function testReverseTransformEmpty() @@ -144,7 +145,7 @@ public function testReverseTransformWithDifferentTimezones() $input = $output->format('Y-m-d H:i:s'); $output->setTimezone(new \DateTimeZone('America/New_York')); - $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input)); + $this->assertEquals($output, $reverseTransformer->reverseTransform($input)); } public function testReverseTransformExpectsString() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php index 44c37723cabf..056f1279dc6e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; +use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; -class DateTimeToTimestampTransformerTest extends DateTimeTestCase +class DateTimeToTimestampTransformerTest extends TestCase { public function testTransform() { @@ -86,7 +87,7 @@ public function testReverseTransform() $output = new \DateTime('2010-02-03 04:05:06 UTC'); $input = $output->format('U'); - $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input)); + $this->assertEquals($output, $reverseTransformer->reverseTransform($input)); } public function testReverseTransformEmpty() @@ -104,7 +105,7 @@ public function testReverseTransformWithDifferentTimezones() $input = $output->format('U'); $output->setTimezone(new \DateTimeZone('Asia/Hong_Kong')); - $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input)); + $this->assertEquals($output, $reverseTransformer->reverseTransform($input)); } public function testReverseTransformExpectsValidTimestamp() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index 48c1b764bdda..1c48a777edc9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -49,7 +49,7 @@ public function testSubmitDateTime() $dateTime = new \DateTime('2010-06-02 03:04:00 UTC'); - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); } public function testSubmitString() @@ -133,7 +133,7 @@ public function testSubmitWithoutMinutes() $form->submit($input); - $this->assertDateTimeEquals(new \DateTime('2010-06-02 03:00:00 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-06-02 03:00:00 UTC'), $form->getData()); } public function testSubmitWithSeconds() @@ -165,7 +165,7 @@ public function testSubmitWithSeconds() $form->submit($input); - $this->assertDateTimeEquals(new \DateTime('2010-06-02 03:04:05 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-06-02 03:04:05 UTC'), $form->getData()); } public function testSubmitDifferentTimezones() @@ -215,7 +215,7 @@ public function testSubmitDifferentTimezonesDateTime() $outputTime->setTimezone(new \DateTimeZone('America/New_York')); - $this->assertDateTimeEquals($outputTime, $form->getData()); + $this->assertEquals($outputTime, $form->getData()); $this->assertEquals('2010-06-02T03:04:00-10:00', $form->getViewData()); } @@ -266,7 +266,7 @@ public function testSubmitDifferentPattern() 'time' => '03:04', )); - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); } public function testInitializeWithDateTime() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 21962d12adb8..1457ff30c6c2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -64,7 +64,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() $form->submit('2010-06-02'); - $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); $this->assertEquals('2010-06-02', $form->getViewData()); } @@ -80,7 +80,7 @@ public function testSubmitFromSingleTextDateTimeWithCustomFormat() $form->submit('2010'); - $this->assertDateTimeEquals(new \DateTime('2010-01-01 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-01-01 UTC'), $form->getData()); $this->assertEquals('2010', $form->getViewData()); } @@ -101,7 +101,7 @@ public function testSubmitFromSingleTextDateTime() $form->submit('2.6.2010'); - $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); $this->assertEquals('02.06.2010', $form->getViewData()); } @@ -194,7 +194,7 @@ public function testSubmitFromText() $dateTime = new \DateTime('2010-06-02 UTC'); - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); $this->assertEquals($text, $form->getViewData()); } @@ -217,7 +217,7 @@ public function testSubmitFromChoice() $dateTime = new \DateTime('2010-06-02 UTC'); - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); $this->assertEquals($text, $form->getViewData()); } @@ -254,7 +254,7 @@ public function testSubmitFromInputDateTimeDifferentPattern() $form->submit('06*2010*02'); - $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); + $this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); $this->assertEquals('06*2010*02', $form->getViewData()); } @@ -468,7 +468,7 @@ public function testSetDataWithNegativeTimezoneOffsetDateTimeInput() // 2010-06-02 00:00:00 UTC // 2010-06-01 20:00:00 UTC-4 - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); $this->assertEquals('01.06.2010', $form->getViewData()); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 8f7d13961f1d..cb218822de38 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -315,7 +315,7 @@ public function testSetDataDifferentTimezonesDateTime() 'second' => (int) $outputTime->format('s'), ); - $this->assertDateTimeEquals($dateTime, $form->getData()); + $this->assertEquals($dateTime, $form->getData()); $this->assertEquals($displayedData, $form->getViewData()); } From 826dfbd496bf6be050aa703c750dc716b251eb42 Mon Sep 17 00:00:00 2001 From: Cosmin-Romeo TANASE Date: Thu, 25 Jan 2018 06:29:19 +0000 Subject: [PATCH 72/74] [HttpFoundation] Use the correct syntax for session gc based on Pdo driver --- .../Session/Storage/Handler/PdoSessionHandler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 15945644a462..dfd66516062c 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -375,7 +375,11 @@ public function close() $this->gcCalled = false; // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol"; + if ('mysql' === $this->driver) { + $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; + } else { + $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol"; + } $stmt = $this->pdo->prepare($sql); $stmt->bindValue(':time', time(), \PDO::PARAM_INT); From 0c3890fe638f108090f208f4f631b3bdca53a411 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Jan 2018 12:41:59 +0100 Subject: [PATCH 73/74] updated CHANGELOG for 3.3.16 --- CHANGELOG-3.3.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index fe698c1e6dc3..950150a68acf 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -7,6 +7,43 @@ in 3.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1 +* 3.3.16 (2018-01-29) + + * bug #25922 [HttpFoundation] Use the correct syntax for session gc based on Pdo driver (tanasecosminromeo) + * bug #25933 Disable CSP header on exception pages only in debug (ostrolucky) + * bug #25926 [Form] Fixed Button::setParent() when already submitted (HeahDude) + * bug #25927 [Form] Fixed submitting disabled buttons (HeahDude) + * bug #25891 [DependencyInjection] allow null values for root nodes in YAML configs (xabbuh) + * bug #24864 Have weak_vendors ignore deprecations from outside (greg0ire) + * bug #25848 [Validator] add missing parent isset and add test (Simperfit) + * bug #25869 [Process] Skip environment variables with false value in Process (francoispluchino) + * bug #25864 [Yaml] don't split lines on carriage returns when dumping (xabbuh) + * bug #25861 do not conflict with egulias/email-validator 2.0+ (xabbuh) + * bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric) + * bug #25837 [SecurityBundle] Don't register in memory users as services (chalasr) + * bug #25835 [HttpKernel] DebugHandlersListener should always replace the existing exception handler (nicolas-grekas) + * bug #25829 [Debug] Always decorate existing exception handlers to deal with fatal errors (nicolas-grekas) + * bug #25824 Fixing a bug where the dump() function depended on bundle ordering (weaverryan) + * bug #25789 Enableable ArrayNodeDefinition is disabled for empty configuration (kejwmen) + * bug #25822 [Cache] Fix handling of apcu_fetch() edgy behavior (nicolas-grekas) + * bug #25816 Problem in phar see mergerequest #25579 (betzholz) + * bug #25781 [Form] Disallow transform dates beyond the year 9999 (curry684) + * bug #25287 [Serializer] DateTimeNormalizer handling of null and empty values (returning it instead of new object) (Simperfit) + * bug #25812 Copied NO language files to the new NB locale (derrabus) + * bug #25801 [Router] Skip anonymous classes when loading annotated routes (pierredup) + * bug #25657 [Security] Fix fatal error on non string username (chalasr) + * bug #25791 [Routing] Make sure we only build routes once (sroze) + * bug #25799 Fixed Request::__toString ignoring cookies (Toflar) + * bug #25755 [Debug] prevent infinite loop with faulty exception handlers (nicolas-grekas) + * bug #25771 [Validator] 19 digits VISA card numbers are valid (xabbuh) + * bug #25751 [FrameworkBundle] Add the missing `enabled` session attribute (sroze) + * bug #25750 [HttpKernel] Turn bad hosts into 400 instead of 500 (nicolas-grekas) + * bug #25490 [Serializer] Fixed throwing exception with option JSON_PARTIAL_OUTPUT_ON_ERROR (diversantvlz) + * bug #25709 Tweaked some styles in the profiler tables (javiereguiluz) + * bug #25696 [FrameworkBundle] Fix using "annotations.cached_reader" in after-removing passes (nicolas-grekas) + * feature #25669 [Security] Fail gracefully if the security token cannot be unserialized from the session (thewilkybarkid) + * bug #25700 Run simple-phpunit with --no-suggest option (ro0NL) + * 3.3.15 (2018-01-05) * bug #25532 [HttpKernel] Disable CSP header on exception pages (ostrolucky) From 909c9ae5e74e90773ef4fe4c5c1d7782e66493b4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Jan 2018 12:42:05 +0100 Subject: [PATCH 74/74] updated VERSION for 3.3.16 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 06f58ee48bfa..0476c416dbbc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,12 +61,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.16-DEV'; + const VERSION = '3.3.16'; const VERSION_ID = 30316; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 16; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018';