From 02b7edb8255fac4f505d7c65e5ae21d6faf500b3 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Thu, 23 Nov 2017 06:39:55 +0100 Subject: [PATCH 001/107] [TwigBridge][WIP] Pass the form-check-inline in parent --- .../Twig/Resources/views/Form/bootstrap_4_layout.html.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index 96ca4be4d68a7..34cfe896b35e7 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -74,6 +74,10 @@ {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} {% if 'checkbox-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} + {% elseif 'form-check-inline' in parent_label_class %} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
{% else -%}
{{- form_label(form, null, { widget: parent() }) -}} From 30922a2d3258552dc06ccfab22b26a4b7dc18153 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 06:15:53 +0100 Subject: [PATCH 002/107] 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 916ce96ddb47b..16c5342500901 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 003/107] 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 30d8ae3f828ed..85b3003b2abc6 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 004/107] 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 a8e6e88bfcedb..6fe8eb14905e4 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 005/107] 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 6fe8eb14905e4..afbd8159996f3 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 006/107] 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 2e8fc7e47079d..ac8f7b3768625 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 007/107] 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 420e05f2436ea..bd69c22d21572 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 008/107] 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 bd69c22d21572..b721249e046c9 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 40144bbd4572cd25e260bc781a56d6662dd3a3ad Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 08:28:38 +0100 Subject: [PATCH 009/107] updated CHANGELOG for 3.3.15 --- CHANGELOG-3.3.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index eeb42846f5f5e..fe698c1e6dc39 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.15 (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 #25672 [WebServerBundle] use interface_exists instead of class_exists (kbond) + * 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 #25623 [HttpFoundation] Fix false-positive ConflictingHeadersException (nicolas-grekas) + * bug #25624 [WebServerBundle] Fix escaping of php binary with arguments (nicolas-grekas) + * bug #25567 [Process] Fix setting empty env vars (nicolas-grekas) + * bug #25407 [Console] Commands with an alias should not be recognized as ambiguous (Simperfit) + * bug #25523 [WebServerBundle] fix a bug where require would not require the good file because of env (Simperfit) + * bug #25559 [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions (nicolas-grekas) + * bug #25552 [WebProfilerBundle] Let fetch() cast URL to string (ro0NL) + * 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 #25425 When available use AnnotationRegistry::registerUniqueLoader (jrjohnson) + * bug #24594 [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files (BjornTwachtmann) + * bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque) + * bug #25413 [HttpKernel] detect deprecations thrown by container initialization during tests (nicolas-grekas) + * bug #25408 [Debug] Fix catching fatal errors in case of nested error handlers (nicolas-grekas) + * bug #25330 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) (stephank) + * bug #25378 [VarDumper] Fixed file links leave blank pages when ide is configured (antalaron) + * bug #25410 [HttpKernel] Fix logging of post-terminate errors/exceptions (nicolas-grekas) + * bug #25417 [Process] Dont rely on putenv(), it fails on ZTS PHP (nicolas-grekas) + * bug #25333 [DI] Impossible to set an environment variable and then an array as container parameter (Phantas0s) + * bug #25438 [Yaml] empty lines don't count for indent detection (xabbuh) + * bug #25389 [Yaml] fix some edge cases with indented blocks (xabbuh) + * bug #25340 [Serializer] Unset attributes when creating child context (dunglas) + * bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit) + * bug #25364 [DependencyInjection] Prevent a loop in aliases within the `findDefinition` method (sroze) + * 3.3.14 (2017-12-04) * bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox) From c04fa7bf3f01bc59181c85634be030c515fa2afb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 08:28:45 +0100 Subject: [PATCH 010/107] updated VERSION for 3.3.15 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 74d8129a5ff67..95238fdb7b070 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-DEV'; + const VERSION = '3.3.15'; const VERSION_ID = 30315; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; const RELEASE_VERSION = 15; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018'; const END_OF_LIFE = '07/2018'; From 9419535736ee10412f38bc9eb7844a826771a02e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 09:11:08 +0100 Subject: [PATCH 011/107] 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 95238fdb7b070..06f58ee48bfaa 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 d1cd997300f9c72bdafd07925ca85e9282ab8d8a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 09:32:54 +0100 Subject: [PATCH 012/107] updated CHANGELOG for 3.4.3 --- CHANGELOG-3.4.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 24620ba3a50fb..38a2d7c9a7a33 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,37 @@ in 3.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.4.0...v3.4.1 +* 3.4.3 (2018-01-05) + + * bug #25685 Use triggering file to determine weak vendors if when the test is run in a separate process (alexpott) + * bug #25671 Remove randomness from dumped containers (nicolas-grekas) + * bug #25532 [HttpKernel] Disable CSP header on exception pages (ostrolucky) + * bug #25678 [WebProfilerBundle] set the var in the right scope (Jochen Mandl) + * bug #25491 [Routing] Use the default host even if context is empty (sroze) + * bug #25672 [WebServerBundle] use interface_exists instead of class_exists (kbond) + * 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 #25404 [Form] Remove group options without data on debug:form command (yceruto) + * bug #25430 Fixes for Oracle in PdoSessionHandler (elislenio) + * bug #25117 [FrameworkBundle] Make cache:clear "atomic" and consistent with cache:warmup (hkdobrev) + * bug #25583 [HttpKernel] Call Response->setPrivate() instead of sending raw header() when session is started (Toflar) + * bug #25601 [TwigBundle/Brige] catch missing requirements to throw meaningful exceptions (nicolas-grekas) + * bug #25547 [DX][DependencyInjection] Suggest to write an implementation if the interface cannot be autowired (sroze) + * bug #25599 Add application/ld+json format associated to json (vincentchalamon) + * bug #25623 [HttpFoundation] Fix false-positive ConflictingHeadersException (nicolas-grekas) + * bug #25624 [WebServerBundle] Fix escaping of php binary with arguments (nicolas-grekas) + * bug #25604 Add check for SecurityBundle in createAccessDeniedException (FGM) + * bug #25591 [HttpKernel] fix cleaning legacy containers (nicolas-grekas) + * bug #25526 [WebProfilerBundle] Fix panel break when stopwatch component is not installed. (umulmrum, javiereguiluz) + * bug #25606 Updating message to inform the user how to install the component (weaverryan) + * bug #25571 [SecurityBundle] allow auto_wire for SessionAuthenticationStrategy class (xavren) + * bug #25567 [Process] Fix setting empty env vars (nicolas-grekas) + * bug #25407 [Console] Commands with an alias should not be recognized as ambiguous (Simperfit) + * bug #25523 [WebServerBundle] fix a bug where require would not require the good file because of env (Simperfit) + * bug #25559 [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions (nicolas-grekas) + * bug #25552 [WebProfilerBundle] Let fetch() cast URL to string (ro0NL) + * bug #25521 [Console] fix a bug when you are passing a default value and passing -n would output the index (Simperfit) + * 3.4.2 (2017-12-15) * bug #25489 [FrameworkBundle] remove esi/ssi renderers if inactive (dmaicher) From c49f69383078fc6799bd427d5c37cf390025a684 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 09:33:00 +0100 Subject: [PATCH 013/107] updated VERSION for 3.4.3 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index f2042d3d802c7..363dc3d032482 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.3-DEV'; + const VERSION = '3.4.3'; const VERSION_ID = 30403; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 3; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From f95ac4f8090f12283ef4efcccb2e05d2fef87bea Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 09:53:28 +0100 Subject: [PATCH 014/107] bumped Symfony version to 3.4.4 --- 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 363dc3d032482..a8a2b71c1322d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.3'; - const VERSION_ID = 30403; + const VERSION = '3.4.4-DEV'; + const VERSION_ID = 30404; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 3; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 4; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 37788a4774125b9edacf8d423c243991f712507c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jan 2018 10:03:37 +0100 Subject: [PATCH 015/107] bumped Symfony version to 4.0.4 --- 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 4dd748c82ac0b..cc03ab9ef9cd8 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -63,12 +63,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.0.3'; - const VERSION_ID = 40003; + const VERSION = '4.0.4-DEV'; + const VERSION_ID = 40004; const MAJOR_VERSION = 4; const MINOR_VERSION = 0; - const RELEASE_VERSION = 3; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 4; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2018'; const END_OF_LIFE = '01/2019'; From f66f9a7b377d8eca20b2ba63e42446df10174877 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 5 Jan 2018 13:03:30 +0100 Subject: [PATCH 016/107] [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 508899379f691..35ea20a89accd 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 8e561f96a0d5c..bd1100c2385cd 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 a090d9a99cc7a..985b038786b67 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 d63658bacf021..193442ff956cc 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 017/107] 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 b3f302cd340bf..be0839a9a4075 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 018/107] [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 a9205e5a70623..475c268ffe403 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 bfb23ac8eb8b2..bf25c0668700d 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 019/107] [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 52aaacd15ac12..752cddbdd798a 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 020/107] [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 b446f57e49852..7a3483b2ecc81 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 e3bb11caa9c87..2ecaa53c6929b 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 021/107] 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 831b10932599d..200eccacd5fe4 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 ba79c32702df8..7d56632be913c 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 f01a9a1e24ebd..860affbf6ea94 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 2afedcc553ac2..1021899a4ede5 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 f31870e1bf9a2..eb1b46db3ba07 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 702b1bcb59d8c..52a63597039a9 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 b275228642e1b..d8db0663a0879 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 7f26c0404e5a6..071be21f82864 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 9f523d3bfa608..a4eb1b20937f6 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 cb7981694f981..f7c3a55048725 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 022/107] 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 24a1e3fff99a8..4244652f24feb 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 da55ef9190323..3b2e3f86551f1 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 56c02685f63dd..373ad580d15ad 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 1cfa085089685..ea8600a2d083b 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 83f257943fb25bf9cf9698d816cf916a4d9ee438 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Mon, 8 Jan 2018 16:06:02 +0000 Subject: [PATCH 023/107] Uses cookies to track the requests redirection --- .../DataCollector/RequestDataCollector.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 1bd3da4547b49..54d17d28c7cac 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpKernel\DataCollector; +use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -128,21 +129,24 @@ public function collect(Request $request, Response $response, \Exception $except unset($this->controllers[$request]); } - if (null !== $session) { - if ($request->attributes->has('_redirected')) { - $this->data['redirect'] = $session->remove('sf_redirect'); - } + if ($request->attributes->has('_redirected') && $redirectCookie = $request->cookies->get('sf_redirect')) { + $this->data['redirect'] = json_decode($redirectCookie, true); + + $response->headers->clearCookie('sf_redirect'); + } - if ($response->isRedirect()) { - $session->set('sf_redirect', array( + if ($response->isRedirect()) { + $response->headers->setCookie(new Cookie( + 'sf_redirect', + json_encode(array( 'token' => $response->headers->get('x-debug-token'), 'route' => $request->attributes->get('_route', 'n/a'), 'method' => $request->getMethod(), 'controller' => $this->parseController($request->attributes->get('_controller')), 'status_code' => $statusCode, 'status_text' => Response::$statusTexts[(int) $statusCode], - )); - } + )) + )); } $this->data['identifier'] = $this->data['route'] ?: (is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']); @@ -312,11 +316,11 @@ public function onKernelController(FilterControllerEvent $event) public function onKernelResponse(FilterResponseEvent $event) { - if (!$event->isMasterRequest() || !$event->getRequest()->hasSession()) { + if (!$event->isMasterRequest()) { return; } - if ($event->getRequest()->getSession()->has('sf_redirect')) { + if ($event->getRequest()->cookies->has('sf_redirect')) { $event->getRequest()->attributes->set('_redirected', true); } } From 7b4f5a15e76acc31b1f354744741a17859ae4c02 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Mon, 8 Jan 2018 19:15:25 +0000 Subject: [PATCH 024/107] Add tests for the HttpKernel request collector and redirection via cookies --- .../RequestDataCollectorTest.php | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php index 2ff1ed4cee645..69bef76d41352 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; @@ -195,6 +196,56 @@ public function testItIgnoresInvalidCallables() $this->assertSame('n/a', $c->getController()); } + public function testItAddsRedirectedAttributesWhenRequestContainsSpecificCookie() + { + $request = $this->createRequest(); + $request->cookies->add(array( + 'sf_redirect' => '{}', + )); + + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); + + $c = new RequestDataCollector(); + $c->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $this->createResponse())); + + $this->assertTrue($request->attributes->get('_redirected')); + } + + public function testItSetsARedirectCookieIfTheResponseIsARedirection() + { + $c = new RequestDataCollector(); + + $response = $this->createResponse(); + $response->setStatusCode(302); + $response->headers->set('Location', '/somewhere-else'); + + $c->collect($request = $this->createRequest(), $response); + $c->lateCollect(); + + $cookie = $this->getCookieByName($response, 'sf_redirect'); + + $this->assertNotEmpty($cookie->getValue()); + } + + public function testItCollectsTheRedirectionAndClearTheCookie() + { + $c = new RequestDataCollector(); + + $request = $this->createRequest(); + $request->attributes->set('_redirected', true); + $request->cookies->add(array( + 'sf_redirect' => '{"method": "POST"}', + )); + + $c->collect($request, $response = $this->createResponse()); + $c->lateCollect(); + + $this->assertEquals('POST', $c->getRedirect()['method']); + + $cookie = $this->getCookieByName($response, 'sf_redirect'); + $this->assertNull($cookie->getValue()); + } + protected function createRequest($routeParams = array('name' => 'foo')) { $request = Request::create('http://test.com/foo?bar=baz'); @@ -269,4 +320,15 @@ public function __invoke() { throw new \LogicException('Unexpected method call'); } + + private function getCookieByName(Response $response, $name) + { + foreach ($response->headers->getCookies() as $cookie) { + if ($cookie->getName() == $name) { + return $cookie; + } + } + + throw new \InvalidArgumentException(sprintf('Cookie named "%s" is not in response', $name)); + } } From 9e8231ff0b85b42a9f57fcf6d4f488a0535deedd Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 15 Dec 2017 06:43:42 +0100 Subject: [PATCH 025/107] [FrameworkBundle] Automatically enable the CSRF if component *+ session* are loaded --- .../DependencyInjection/Configuration.php | 10 +++++++++- .../DependencyInjection/FrameworkExtension.php | 9 +++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index d5030fc9fe7cf..9430c8775dd82 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -21,6 +21,7 @@ use Symfony\Component\Form\Form; use Symfony\Component\Lock\Lock; use Symfony\Component\Lock\Store\SemaphoreStore; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\Validation; @@ -142,7 +143,14 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode) $rootNode ->children() ->arrayNode('csrf_protection') - ->canBeEnabled() + ->treatFalseLike(array('enabled' => false)) + ->treatTrueLike(array('enabled' => true)) + ->treatNullLike(array('enabled' => true)) + ->addDefaultsIfNotSet() + ->children() + // defaults to framework.session.enabled && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) + ->booleanNode('enabled')->defaultNull()->end() + ->end() ->end() ->end() ; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 6f972ceaf4663..ac0aa7e703925 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -17,6 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader; +use Symfony\Bundle\FullStack; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; @@ -63,6 +64,7 @@ use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; use Symfony\Component\Routing\Loader\AnnotationFileLoader; use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; @@ -229,6 +231,11 @@ public function load(array $configs, ContainerBuilder $container) $this->registerRequestConfiguration($config['request'], $container, $loader); } + if (null === $config['csrf_protection']['enabled']) { + $config['csrf_protection']['enabled'] = $this->sessionConfigEnabled && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class); + } + $this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader); + if ($this->isConfigEnabled($container, $config['form'])) { if (!class_exists('Symfony\Component\Form\Form')) { throw new LogicException('Form support cannot be enabled as the Form component is not installed.'); @@ -249,8 +256,6 @@ public function load(array $configs, ContainerBuilder $container) $container->removeDefinition('console.command.form_debug'); } - $this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader); - if ($this->isConfigEnabled($container, $config['assets'])) { if (!class_exists('Symfony\Component\Asset\Package')) { throw new LogicException('Asset support cannot be enabled as the Asset component is not installed.'); From 8c3eadb1b188200ce84f2f38747d54a570c88136 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 9 Jan 2018 15:42:43 +0100 Subject: [PATCH 026/107] [HttpKernel] Fix compile error when a legacy container is fresh again --- src/Symfony/Component/HttpKernel/Kernel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index a8a2b71c1322d..ad9f6ecb7ce67 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -851,6 +851,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } + @unlink(dirname($dir.$file).'.legacy'); $cache->write($rootCode, $container->getResources()); } From e5e2d5ddd2753ef24a2fdb73d8626a58f162b213 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 9 Jan 2018 14:54:39 +0100 Subject: [PATCH 027/107] [HttpFoundation] Always call proxied handler::destroy() in StrictSessionHandler --- .../Storage/Handler/StrictSessionHandler.php | 14 ++++++++++++++ .../Storage/Handler/StrictSessionHandlerTest.php | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php index 1bad0641e81b1..228119297d85a 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php @@ -19,6 +19,7 @@ class StrictSessionHandler extends AbstractSessionHandler { private $handler; + private $doDestroy; public function __construct(\SessionHandlerInterface $handler) { @@ -63,11 +64,24 @@ protected function doWrite($sessionId, $data) return $this->handler->write($sessionId, $data); } + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->doDestroy = true; + $destroyed = parent::destroy($sessionId); + + return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed; + } + /** * {@inheritdoc} */ protected function doDestroy($sessionId) { + $this->doDestroy = false; + return $this->handler->destroy($sessionId); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php index 8e978487632e1..b02c41ae89866 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php @@ -118,7 +118,7 @@ public function testWriteEmptyNewSession() $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); $handler->expects($this->never())->method('write'); - $handler->expects($this->never())->method('destroy'); + $handler->expects($this->once())->method('destroy')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertFalse($proxy->validateId('id')); @@ -154,7 +154,7 @@ public function testDestroyNewSession() $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->once())->method('read') ->with('id')->willReturn(''); - $handler->expects($this->never())->method('destroy'); + $handler->expects($this->once())->method('destroy')->willReturn(true); $proxy = new StrictSessionHandler($handler); $this->assertSame('', $proxy->read('id')); From 9db699bd8d242ab0056dc19de9f10f13758a5747 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Jan 2018 13:43:49 +0100 Subject: [PATCH 028/107] swap filter/function and package names --- src/Symfony/Bridge/Twig/UndefinedCallableHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php index 2a86b0d53679f..77c78ce38f530 100644 --- a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php +++ b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php @@ -62,7 +62,7 @@ public static function onUndefinedFilter($name) } // Twig will append the source context to the message, so that it will end up being like "[...] Unknown filter "%s" in foo.html.twig on line 123." - throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown filter "%s".', $name, self::$filterComponents[$name])); + throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown filter "%s".', self::$filterComponents[$name], $name)); } public static function onUndefinedFunction($name) @@ -71,6 +71,6 @@ public static function onUndefinedFunction($name) return false; } - throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown function "%s".', $name, self::$functionComponents[$name])); + throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown function "%s".', self::$functionComponents[$name], $name)); } } From f8727b882731e8f6b6d3bc2d7b001abf83803ab7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 6 Jan 2018 08:55:13 +0100 Subject: [PATCH 029/107] [HttpKernel] Fix session handling: decouple "save" from setting response "private" --- .../HttpFoundation/Session/Session.php | 15 +++- .../Session/SessionBagProxy.php | 5 +- .../EventListener/AbstractSessionListener.php | 22 ++++++ .../AbstractTestSessionListener.php | 16 ++-- .../EventListener/SaveSessionListener.php | 4 - .../EventListener/SaveSessionListenerTest.php | 6 +- .../EventListener/SessionListenerTest.php | 79 +++++++++++++++++++ .../Component/HttpKernel/composer.json | 2 +- 8 files changed, 130 insertions(+), 19 deletions(-) create mode 100644 src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 0c3371fab6c6d..a46cffbb8dbd6 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -29,6 +29,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable private $flashName; private $attributeName; private $data = array(); + private $hasBeenStarted; /** * @param SessionStorageInterface $storage A SessionStorageInterface instance @@ -140,6 +141,16 @@ public function count() return count($this->getAttributeBag()->all()); } + /** + * @return bool + * + * @internal + */ + public function hasBeenStarted() + { + return $this->hasBeenStarted; + } + /** * @return bool * @@ -227,7 +238,7 @@ public function getMetadataBag() */ public function registerBag(SessionBagInterface $bag) { - $this->storage->registerBag(new SessionBagProxy($bag, $this->data)); + $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->hasBeenStarted)); } /** @@ -257,6 +268,6 @@ public function getFlashBag() */ private function getAttributeBag() { - return $this->storage->getBag($this->attributeName)->getBag(); + return $this->getBag($this->attributeName); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php index 6c4cab6716456..307836d5f9461 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php @@ -20,11 +20,13 @@ final class SessionBagProxy implements SessionBagInterface { private $bag; private $data; + private $hasBeenStarted; - public function __construct(SessionBagInterface $bag, array &$data) + public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted) { $this->bag = $bag; $this->data = &$data; + $this->hasBeenStarted = &$hasBeenStarted; } /** @@ -56,6 +58,7 @@ public function getName() */ public function initialize(array &$array) { + $this->hasBeenStarted = true; $this->data[$this->bag->getStorageKey()] = &$array; $this->bag->initialize($array); diff --git a/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php index 7a6c20734bf90..dff29ee80b418 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php @@ -11,7 +11,9 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -38,10 +40,30 @@ public function onKernelRequest(GetResponseEvent $event) $request->setSession($session); } + public function onKernelResponse(FilterResponseEvent $event) + { + if (!$event->isMasterRequest()) { + return; + } + + if (!$session = $event->getRequest()->getSession()) { + return; + } + + if ($session->isStarted() || ($session instanceof Session && $session->hasBeenStarted())) { + $event->getResponse() + ->setPrivate() + ->setMaxAge(0) + ->headers->addCacheControlDirective('must-revalidate'); + } + } + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 128), + // low priority to come after regular response listeners, same as SaveSessionListener + KernelEvents::RESPONSE => array('onKernelResponse', -1000), ); } diff --git a/src/Symfony/Component/HttpKernel/EventListener/AbstractTestSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/AbstractTestSessionListener.php index 2531db66790d2..5f0ea5c0a9c08 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AbstractTestSessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AbstractTestSessionListener.php @@ -58,13 +58,17 @@ public function onKernelResponse(FilterResponseEvent $event) return; } - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { + if (!$session = $event->getRequest()->getSession()) { + return; + } + + if ($wasStarted = $session->isStarted()) { $session->save(); - if (!$session instanceof Session || !\method_exists($session, 'isEmpty') || !$session->isEmpty()) { - $params = session_get_cookie_params(); - $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); - } + } + + if ($session instanceof Session ? !$session->isEmpty() : $wasStarted) { + $params = session_get_cookie_params(); + $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); } } diff --git a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php index 1cee45e59a9d3..36809b59af914 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php @@ -53,10 +53,6 @@ public function onKernelResponse(FilterResponseEvent $event) $session = $event->getRequest()->getSession(); if ($session && $session->isStarted()) { $session->save(); - $event->getResponse() - ->setPrivate() - ->setMaxAge(0) - ->headers->addCacheControlDirective('must-revalidate'); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SaveSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SaveSessionListenerTest.php index 80200881c5a05..5492c3d784805 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/SaveSessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SaveSessionListenerTest.php @@ -32,7 +32,7 @@ public function testOnlyTriggeredOnMasterRequest() $listener->onKernelResponse($event); } - public function testSessionSavedAndResponsePrivate() + public function testSessionSaved() { $listener = new SaveSessionListener(); $kernel = $this->getMockBuilder(HttpKernelInterface::class)->disableOriginalConstructor()->getMock(); @@ -45,9 +45,5 @@ public function testSessionSavedAndResponsePrivate() $request->setSession($session); $response = new Response(); $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); - - $this->assertTrue($response->headers->hasCacheControlDirective('private')); - $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate')); - $this->assertSame('0', $response->headers->getCacheControlDirective('max-age')); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php new file mode 100644 index 0000000000000..34598363c8914 --- /dev/null +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\EventListener; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener; +use Symfony\Component\HttpKernel\EventListener\SessionListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +class SessionListenerTest extends TestCase +{ + public function testOnlyTriggeredOnMasterRequest() + { + $listener = $this->getMockForAbstractClass(AbstractSessionListener::class); + $event = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock(); + $event->expects($this->once())->method('isMasterRequest')->willReturn(false); + $event->expects($this->never())->method('getRequest'); + + // sub request + $listener->onKernelRequest($event); + } + + public function testSessionIsSet() + { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); + + $container = new Container(); + $container->set('session', $session); + + $request = new Request(); + $listener = new SessionListener($container); + + $event = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock(); + $event->expects($this->once())->method('isMasterRequest')->willReturn(true); + $event->expects($this->once())->method('getRequest')->willReturn($request); + + $listener->onKernelRequest($event); + + $this->assertTrue($request->hasSession()); + $this->assertSame($session, $request->getSession()); + } + + public function testResponseIsPrivate() + { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); + $session->expects($this->once())->method('isStarted')->willReturn(false); + $session->expects($this->once())->method('hasBeenStarted')->willReturn(true); + + $container = new Container(); + $container->set('session', $session); + + $listener = new SessionListener($container); + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->disableOriginalConstructor()->getMock(); + + $request = new Request(); + $response = new Response(); + $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); + $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); + + $this->assertTrue($response->headers->hasCacheControlDirective('private')); + $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate')); + $this->assertSame('0', $response->headers->getCacheControlDirective('max-age')); + } +} diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 2d134e5b14943..b33675763f6e5 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^5.5.9|>=7.0.8", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-foundation": "^3.4.4|^4.0.4", "symfony/debug": "~2.8|~3.0|~4.0", "psr/log": "~1.0" }, From e7e410bfeb2aced686ac0ea0174d38712ce09289 Mon Sep 17 00:00:00 2001 From: Vacheslav Silyutin Date: Wed, 13 Dec 2017 23:37:25 +0300 Subject: [PATCH 030/107] [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 e0c6eb560e102..ef415a3e2e4e9 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 ad8d57065f721..c58363750a31d 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 821ca5286812d0fb51d667767d914b8259ca737e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 10 Jan 2018 14:30:03 +0100 Subject: [PATCH 031/107] [FrameworkBundle] fix tests Add a public alias so that we can retrieve the private aliased annotation_reader service in an after removing compiler pass. --- .../TestBundle/DependencyInjection/AnnotationReaderPass.php | 2 +- .../Bundle/TestBundle/DependencyInjection/TestExtension.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php index 2de08632fa144..53555fd664174 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php @@ -19,6 +19,6 @@ class AnnotationReaderPass implements CompilerPassInterface public function process(ContainerBuilder $container) { // simulate using "annotation_reader" in a compiler pass - $container->get('annotation_reader'); + $container->get('test.annotation_reader'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index 38ce8d3990514..66489374f6220 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; +use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -26,6 +27,8 @@ public function load(array $configs, ContainerBuilder $container) { $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); + + $container->setAlias('test.annotation_reader', new Alias('annotation_reader', true)); } /** From 3e47c7102859a438da996cbcde02c743952660d6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Jan 2018 17:55:58 +0100 Subject: [PATCH 032/107] [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 12cbd2b6a4716..7cee6e8a7645f 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 8376ba8f6fd18..a0882999a254b 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 033/107] 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 cfcfb34da85d9..3cc6646cdef35 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 d9b135d11b387924f2ba8bfee85152c361aca37c Mon Sep 17 00:00:00 2001 From: Nikolay Labinskiy Date: Wed, 10 Jan 2018 16:27:23 +0100 Subject: [PATCH 034/107] Prefer composer install instead for using Symfony Installer --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 16a7e1b489c4d..9db99a74c0cc0 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ Drupal and Magento). Installation ------------ -* [Install Symfony][4] with Composer or with our own installer (see - [requirements details][3]). +* [Install Symfony][4] with Composer (see [requirements details][3]). * Symfony follows the [semantic versioning][5] strictly, publishes "Long Term Support" (LTS) versions and has a [release process][6] that is predictable and business-friendly. From 6088dd328d3464a10bb3f2d0b2d68580976eb822 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 10 Jan 2018 14:30:03 +0100 Subject: [PATCH 035/107] [FrameworkBundle] fix tests Add a public alias so that we can retrieve the private aliased annotation_reader service in an after removing compiler pass. --- .../TestBundle/DependencyInjection/AnnotationReaderPass.php | 2 +- .../Bundle/TestBundle/DependencyInjection/TestExtension.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php index 2de08632fa144..53555fd664174 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/AnnotationReaderPass.php @@ -19,6 +19,6 @@ class AnnotationReaderPass implements CompilerPassInterface public function process(ContainerBuilder $container) { // simulate using "annotation_reader" in a compiler pass - $container->get('annotation_reader'); + $container->get('test.annotation_reader'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index 38ce8d3990514..66489374f6220 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; +use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -26,6 +27,8 @@ public function load(array $configs, ContainerBuilder $container) { $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); + + $container->setAlias('test.annotation_reader', new Alias('annotation_reader', true)); } /** From cc215f734725d5fa06c9e275462acf3255059738 Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Thu, 11 Jan 2018 08:39:01 +0100 Subject: [PATCH 036/107] Fix options resolver with array allowed types --- .../Component/OptionsResolver/OptionsResolver.php | 9 +++++++-- .../OptionsResolver/Tests/OptionsResolverTest.php | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index f5b84f05b4d5c..95a492de94bb8 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -883,7 +883,7 @@ private function verifyTypes($type, $value, array &$invalidTypes) $invalidValues = array_filter( // Filter out valid values, keeping invalid values in the resulting array $value, function ($value) use ($type) { - return (function_exists($isFunction = 'is_'.$type) && !$isFunction($value)) || !$value instanceof $type; + return !self::isValueValidType($type, $value); } ); @@ -896,7 +896,7 @@ function ($value) use ($type) { return false; } - if ((function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type) { + if (self::isValueValidType($type, $value)) { return true; } @@ -1073,4 +1073,9 @@ private function formatValues(array $values) return implode(', ', $values); } + + private static function isValueValidType($type, $value) + { + return (function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; + } } diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index fb15b1843b809..440af8b5787e6 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -486,6 +486,15 @@ public function testSetAllowedTypesFailsIfUnknownOption() $this->resolver->setAllowedTypes('foo', 'string'); } + public function testResolveTypedArray() + { + $this->resolver->setDefined('foo'); + $this->resolver->setAllowedTypes('foo', 'string[]'); + $options = $this->resolver->resolve(array('foo' => array('bar', 'baz'))); + + $this->assertSame(array('foo' => array('bar', 'baz')), $options); + } + /** * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException */ From 5f397f8dcfbaa42e4c32b3e82752293ee1ab37cb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Jan 2018 19:03:23 +0100 Subject: [PATCH 037/107] [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 704075614c684..c0f07e256d738 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 038/107] [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 a0882999a254b..83517f2d96247 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 039/107] 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 a108126a2eed8..d13fc14c0c6bb 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 cd733724870cd..39a3e985865fd 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 7568d54a9ce91..e20c7adf6ba1f 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 040/107] 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 274ebec1ef445..41222c1ab57ce 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 041/107] [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 ff121deb807a2..f789011329546 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 6d622bbcc0e05..73d277b190832 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 042/107] 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 be54a0cf477bd..14369c2365a52 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 dbe5166451a15..e12d201be0fc0 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 043/107] 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 4e4c4a28b6095..754d712cc33eb 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 044/107] [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 cf61d83d4334c..9b6bfd1a3f3d2 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 ba4329b0eadc4..edcd3f2ef39b8 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 62b4c48f92764..2e99f70e7e26b 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 045/107] 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 202e141f36c28..1ef01f1972e9e 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 a9760c11ddf48..bd40fd48511d6 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 046/107] 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 cb30d0f985304..0d3c55854636d 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 047/107] 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 66b8762cff4e9..dae4759134c2f 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 cd733724870cd..39a3e985865fd 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 048/107] 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 1d9c857aa2e9f..e8a9a165d6734 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 6fc592affc607..f6af600bd4221 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 049/107] 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 4524f8b2347fe..1b6426ae93aad 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 686d4f7043732a91015dff09236c3e13092fcbc1 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 15 Jan 2018 14:24:34 +0200 Subject: [PATCH 050/107] [Console] Add placeholder for line number in console exception fixtures --- .../Component/Console/Tests/ApplicationTest.php | 10 +++++----- .../application_renderexception_doublewidth1.txt | 2 +- ...plication_renderexception_doublewidth1decorated.txt | 2 +- .../application_renderexception_doublewidth2.txt | 2 +- .../application_renderexception_escapeslines.txt | 2 +- .../application_renderexception_linebreaks.txt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index f207ce0d4fb24..38389b1b4b14c 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -728,10 +728,10 @@ public function testRenderExceptionWithDoubleWidthCharacters() $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); + $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); $tester->run(array('command' => 'foo'), array('decorated' => true, 'capture_stderr_separately' => true)); - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); + $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); $application = new Application(); $application->setAutoExit(false); @@ -741,7 +741,7 @@ public function testRenderExceptionWithDoubleWidthCharacters() }); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal'); + $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal'); putenv('COLUMNS=120'); } @@ -756,7 +756,7 @@ public function testRenderExceptionEscapesLines() $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false)); - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting'); + $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting'); putenv('COLUMNS=120'); } @@ -773,7 +773,7 @@ public function testRenderExceptionLineBreaks() $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo'), array('decorated' => false)); - $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); + $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); } public function testRun() diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt index 99f4b370572b3..4677c18e36573 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt @@ -1,5 +1,5 @@ -In ApplicationTest.php line 726: +In ApplicationTest.php line %d: エラーメッセージ diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt index 14886bd37e939..33d3265563a3f 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt @@ -1,5 +1,5 @@ -In ApplicationTest.php line 726: +In ApplicationTest.php line %d:    エラーメッセージ    diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt index 01ec1b30e08c3..2ee72e22cbdd0 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt @@ -1,5 +1,5 @@ -In ApplicationTest.php line 740: +In ApplicationTest.php line %d: コマンドの実行中にエラーが 発生しました。 diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_escapeslines.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_escapeslines.txt index 24513d4ef5b3b..ff7b7b39c207a 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_escapeslines.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_escapeslines.txt @@ -1,5 +1,5 @@ -In ApplicationTest.php line 754: +In ApplicationTest.php line %d: dont break here < info>! diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_linebreaks.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_linebreaks.txt index 7664b9e35420d..0e5c4b166c7fc 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_linebreaks.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception_linebreaks.txt @@ -1,5 +1,5 @@ -In ApplicationTest.php line 771: +In ApplicationTest.php line %d: line 1 with extra spaces line 2 From 0f79d09a100ab3dbff94cd4c6c04b6cfac227a37 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Mon, 15 Jan 2018 16:19:42 +0100 Subject: [PATCH 051/107] 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 7a24f1cf85568..ce7258acd6931 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 1b6426ae93aad..5dad4057612d0 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 db5f8deba9dfc0e24539458ff6aa0baf59edaaad Mon Sep 17 00:00:00 2001 From: dtonder Date: Tue, 16 Jan 2018 11:03:48 +0100 Subject: [PATCH 052/107] allow dashes in cwd pathname when running the tests --- src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index a26a994d91050..00a7901f3a4ac 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -55,7 +55,7 @@ public function testLoadFile() XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertRegExp('/The XML file "[\w:\/\\\.]+" is not valid\./', $e->getMessage()); + $this->assertRegExp('/The XML file "[\w:\/\\\.-]+" is not valid\./', $e->getMessage()); } $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate'))); From d76a545c0196a05ae7df2883ea30412cd37b20c0 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 15 Jan 2018 21:47:29 +0200 Subject: [PATCH 053/107] [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 9c5ab1b6ae636..ea203d4fea1c0 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 0000000000000..de87895649491 --- /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 a022af44be4e5..7665f71fdc005 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 054/107] 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 0000000000000..c64266c99189b --- /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 ba19a6215a7b4..6d3dae218caf6 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 0000000000000..3635916971476 --- /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 96a1307ed056b..07c5e304b4ad1 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 0000000000000..3635916971476 --- /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 30b9aed6ec873..e02a0648743f3 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 0000000000000..250576531cfe4 --- /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 96311cfeff326..d2b8a99011721 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 3fa1ad9c81c96b826da5973883fce204e5389973 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Jan 2018 18:47:32 +0100 Subject: [PATCH 055/107] [Console] Fix restoring exception handler --- src/Symfony/Component/Console/Application.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index be283aad16f38..627be50679644 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -163,7 +163,12 @@ public function run(InputInterface $input = null, OutputInterface $output = null $exitCode = 1; } } finally { + // if the exception handler changed, keep it + // otherwise, unregister $renderException if (!$phpHandler) { + if (set_exception_handler($renderException) === $renderException) { + restore_exception_handler(); + } restore_exception_handler(); } elseif (!$debugHandler) { $phpHandler[0]->setExceptionHandler(null); From 00964492d270b8b06ea88d645ea59674f787e3c2 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 12 Jan 2018 14:11:07 +0100 Subject: [PATCH 056/107] [Console] Keep the modified exception handler --- src/Symfony/Component/Console/Application.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 627be50679644..107c1ed6caaa9 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -171,7 +171,10 @@ public function run(InputInterface $input = null, OutputInterface $output = null } restore_exception_handler(); } elseif (!$debugHandler) { - $phpHandler[0]->setExceptionHandler(null); + $finalHandler = $phpHandler[0]->setExceptionHandler(null); + if ($finalHandler !== $renderException) { + $phpHandler[0]->setExceptionHandler($finalHandler); + } } } From 10e33acf4241d13de88da7f2f5e29dde2e460f76 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 16 Jan 2018 18:32:27 +0100 Subject: [PATCH 057/107] [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 6d869967263bd..9ff140b0a280c 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 7a3483b2ecc81..2c315b99448a5 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 368edd82819fcec2202f453df9ddd79714b001d0 Mon Sep 17 00:00:00 2001 From: TeLiXj Date: Fri, 1 Dec 2017 14:56:56 +0100 Subject: [PATCH 058/107] Avoid button label translation when it's set to false Improve my previous contribution to hide button label when it's set to false (#24148) because a missing translation error appear --- .../Twig/Resources/views/Form/form_div_layout.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 2a7d58c0f878e..f85aad1c68b9a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -216,12 +216,14 @@ {%- endblock range_widget %} {%- block button_widget -%} - {%- if label is not same as(false) and label is empty -%} + {%- if label is empty -%} {%- if label_format is not empty -%} {% set label = label_format|replace({ '%name%': name, '%id%': id, }) %} + {%- elseif label is same as(false) -%} + {% set translation_domain = false %} {%- else -%} {% set label = name|humanize %} {%- endif -%} From 70cc969537e39a95b03d0283f86b8b0fb6e13f5e Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Sat, 13 Jan 2018 02:38:52 +0100 Subject: [PATCH 059/107] [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 e2c553c507e4f..816e6cad92829 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 1562071edfd12..60b83c222b7fc 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 060/107] 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 710fee58ffacd..60b8c956eb52d 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 38f30714efaf1..7e76678cf2c2b 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 061/107] 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 0000000000000..2f5da23444d0b --- /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 0000000000000..c48ce46505738 --- /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 0000000000000..c48ce46505738 --- /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 ea01c63ee4aa4..e5881330e8eb8 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 062/107] [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 75b3fa299ec29..72df12e4b593f 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 5614b390cf2f4..fe7dfbab7d8c0 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 063/107] 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 c829cfa4377fb..e3f700f457283 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 064/107] 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 a0ad77edd0796..607f1d1fe743d 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 16a38c30b0f9d..4b6f4d7fd1013 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 0a9312346e989..6e99469a4e48c 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 065/107] [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 c0f07e256d738..6a15f7b368307 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 6aa2b7cce071aaef5d0d95beb2d60c5aa05b413e Mon Sep 17 00:00:00 2001 From: Giovanni Albero Date: Wed, 17 Jan 2018 12:33:26 +0100 Subject: [PATCH 066/107] [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used --- .../Core/Authorization/ExpressionLanguage.php | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php b/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php index d4c8f33e06491..0778ba78d4869 100644 --- a/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php +++ b/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php @@ -13,23 +13,27 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; -/** - * Adds some function to the default ExpressionLanguage. - * - * @author Fabien Potencier - * - * @see ExpressionLanguageProvider - */ -class ExpressionLanguage extends BaseExpressionLanguage -{ +if (!class_exists(BaseExpressionLanguage::class)) { + throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', ExpressionLanguage::class)); +} else { /** - * {@inheritdoc} + * Adds some function to the default ExpressionLanguage. + * + * @author Fabien Potencier + * + * @see ExpressionLanguageProvider */ - public function __construct($cache = null, array $providers = array()) + class ExpressionLanguage extends BaseExpressionLanguage { - // prepend the default provider to let users override it easily - array_unshift($providers, new ExpressionLanguageProvider()); + /** + * {@inheritdoc} + */ + public function __construct($cache = null, array $providers = array()) + { + // prepend the default provider to let users override it easily + array_unshift($providers, new ExpressionLanguageProvider()); - parent::__construct($cache, $providers); + parent::__construct($cache, $providers); + } } } From a986efef0a47abdd5b7a4b3136bb547fffdb0aae Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 18 Jan 2018 12:52:12 +0100 Subject: [PATCH 067/107] 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 56112b753ad32..b67a699609d66 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 068/107] [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 b184385f221fa..4d889cb523ff9 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 e731101486562..855bed9b6899d 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 069/107] [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 e34ba5a8bcaaf..2a3e945695143 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 fd9ac577ee73a..264dc701e7e2e 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 0000000000000..7ce7b9dc6f7dd --- /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 6a17648a2a61f..897be3eb64be7 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 0bcef55df9aef..b560e24d725a5 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 d1349906bbe69..467b8dde8849a 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 6cab7763164bd6fa09a9b690041deb45b25496df Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 19 Jan 2018 10:38:27 +0100 Subject: [PATCH 070/107] Fix translation test --- .../Security/Core/Resources/translations/security.nb.xlf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf index 3635916971476..c5ab83efc5906 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.nb.xlf @@ -30,10 +30,6 @@ 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. From 39557e25c4c7837dc6b9ca518276c0c03413bd2e Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 19 Jan 2018 11:06:48 +0100 Subject: [PATCH 071/107] fix merge --- .../Security/UserProvider/InMemoryFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php index 1a6736b1e0c8e..6b0800953b4ec 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php @@ -31,7 +31,7 @@ public function create(ContainerBuilder $container, $id, $config) $users = array(); foreach ($config['users'] as $username => $user) { - $users[$username] = array('password' => (string) $user['password'], 'roles' => $user['roles']); + $users[$username] = array('password' => null !== $user['password'] ? (string) $user['password'] : $defaultPassword, 'roles' => $user['roles']); } $definition->addArgument($users); From 1cb8f6918f6d34be3a6875479ff083a7bacfcede Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jan 2018 12:05:40 +0100 Subject: [PATCH 072/107] [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 bf12a8bc47e5f..6c924433a520f 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 d579ed4c0a181..67eafc5e554e7 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 393477aeb49ac..9e37c6d76f320 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 bc7b5d294355da2a237f51fdc6535e72d7d789ba Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 19 Jan 2018 11:34:14 +0100 Subject: [PATCH 073/107] [Serializer] fix undefined class --- .../Component/Serializer/Normalizer/DateTimeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index 1887028117dbd..aedd84a31f7a2 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -84,7 +84,7 @@ public function denormalize($data, $class, $format = null, array $context = arra $timezone = $this->getTimezone($context); 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.'); + throw new NotNormalizableValueException('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) { From bcb79a39ef869ecf94f380d5bcc9fb2a4bce80cb Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Fri, 19 Jan 2018 12:39:28 +0100 Subject: [PATCH 074/107] [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 673b12ac00b3e..ce7064bb4017c 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 8f05b827ef046..0f0e0ab6be692 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 075/107] [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 f263c15d45324..8a81a9f90df61 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 e6db2e6907f0e..fc5f3c8137212 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 076/107] [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 8ded4ba6d1cdf..8576ed207ab9a 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 077/107] 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 8a81a9f90df61..f263c15d45324 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 fc5f3c8137212..e6db2e6907f0e 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 5e70ee898e326a5022525bb2664adc71778c959d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jan 2018 15:02:12 +0100 Subject: [PATCH 078/107] trim spaces from unquoted scalar values --- src/Symfony/Component/Yaml/Inline.php | 1 + src/Symfony/Component/Yaml/Tests/InlineTest.php | 8 ++++---- src/Symfony/Component/Yaml/Tests/ParserTest.php | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 87c67ee0546e0..abab86903b8d3 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -286,6 +286,7 @@ public static function parseScalar(string $scalar, int $flags = 0, array $delimi } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { $output = $match[1]; $i += strlen($output); + $output = trim($output); } else { throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); } diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index f4fc9062bb25c..2cadfe36b8dce 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -252,9 +252,9 @@ public function testParseUnquotedScalarStartingWithReservedIndicator($indicator) { if (method_exists($this, 'expectExceptionMessage')) { $this->expectException(ParseException::class); - $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo").', $indicator)); } else { - $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo").', $indicator)); } Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); @@ -272,9 +272,9 @@ public function testParseUnquotedScalarStartingWithScalarIndicator($indicator) { if (method_exists($this, 'expectExceptionMessage')) { $this->expectException(ParseException::class); - $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo").', $indicator)); } else { - $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator)); + $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo").', $indicator)); } Inline::parse(sprintf('{ foo: %sfoo }', $indicator)); diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index aca5d05cf3145..fe3f07986028b 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -1602,6 +1602,10 @@ public function taggedValuesProvider() - !quz {foo: bar, quz: !bar {one: bar}} YAML ), + 'spaces-around-tag-value-in-sequence' => array( + array(new TaggedValue('foo', 'bar')), + '[ !foo bar ]', + ), ); } From 845eb88f3b5b165f89f69e5325334aa16aaf2e5d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jan 2018 16:04:53 +0100 Subject: [PATCH 079/107] 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 121edcf391f12..1ab58871a955f 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 1c80bec6506c2..9d470b5b1fac9 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 b4903d30a11c0..9d72f09be8a4c 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 080/107] 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 147f98c67addc..05c9b402b6bfd 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 081/107] 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 607f1d1fe743d..a0ad77edd0796 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 4b6f4d7fd1013..16a38c30b0f9d 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 6e99469a4e48c..0a9312346e989 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 5e750ec4b5fb4bf779aa8b52d390db0bfa96f840 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 20 Jan 2018 11:46:59 +0100 Subject: [PATCH 082/107] [DI] Fix initialization of legacy containers by delaying include_once --- .../DependencyInjection/Container.php | 7 ++ .../DependencyInjection/Dumper/PhpDumper.php | 6 +- .../Fixtures/php/services_inline_requires.php | 10 +- src/Symfony/Component/HttpKernel/Kernel.php | 115 ++++++++++-------- 4 files changed, 79 insertions(+), 59 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 91e0ecbf232d7..aa714728cd33a 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -167,6 +167,13 @@ public function setParameter($name, $value) */ public function set($id, $service) { + // Runs the internal initializer; used by the dumped container to include always-needed files + if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof \Closure) { + $initialize = $this->privates['service_container']; + unset($this->privates['service_container']); + $initialize(); + } + $id = $this->normalizeId($id); if ('service_container' === $id) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 4ff85f51b374b..26a98b581a5dd 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1243,16 +1243,16 @@ private function addInlineRequires() } } - $code = "\n"; + $code = ''; foreach ($lineage as $file) { if (!isset($this->inlinedRequires[$file])) { $this->inlinedRequires[$file] = true; - $code .= sprintf(" include_once %s;\n", $file); + $code .= sprintf("\n include_once %s;", $file); } } - return "\n" === $code ? '' : $code; + return $code ? sprintf("\n \$this->privates['service_container'] = function () {%s\n };\n", $code) : ''; } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index 98280b749ad05..2db58bddaab4f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -46,10 +46,12 @@ public function __construct() $this->aliases = array(); - include_once $this->targetDirs[1].'/includes/HotPath/I1.php'; - include_once $this->targetDirs[1].'/includes/HotPath/P1.php'; - include_once $this->targetDirs[1].'/includes/HotPath/T1.php'; - include_once $this->targetDirs[1].'/includes/HotPath/C1.php'; + $this->privates['service_container'] = function () { + include_once $this->targetDirs[1].'/includes/HotPath/I1.php'; + include_once $this->targetDirs[1].'/includes/HotPath/P1.php'; + include_once $this->targetDirs[1].'/includes/HotPath/T1.php'; + include_once $this->targetDirs[1].'/includes/HotPath/C1.php'; + }; } public function getRemovedIds() diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index ad9f6ecb7ce67..b92a5b05e0d0d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -581,80 +581,91 @@ protected function initializeContainer() $class = $this->getContainerClass(); $cacheDir = $this->warmupDir ?: $this->getCacheDir(); $cache = new ConfigCache($cacheDir.'/'.$class.'.php', $this->debug); + $oldContainer = null; if ($fresh = $cache->isFresh()) { // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $fresh = $oldContainer = false; try { - $this->container = include $cache->getPath(); + if (\is_object($this->container = include $cache->getPath())) { + $this->container->set('kernel', $this); + $oldContainer = $this->container; + $fresh = true; + } + } catch (\Throwable $e) { + } catch (\Exception $e) { } finally { error_reporting($errorLevel); } - $fresh = \is_object($this->container); } - if (!$fresh) { - if ($this->debug) { - $collectedLogs = array(); - $previousHandler = defined('PHPUNIT_COMPOSER_INSTALL'); - $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { - return $previousHandler ? $previousHandler($type & ~E_WARNING, $message, $file, $line) : E_WARNING === $type; - } - if (isset($collectedLogs[$message])) { - ++$collectedLogs[$message]['count']; + if ($fresh) { + return; + } - return; - } + if ($this->debug) { + $collectedLogs = array(); + $previousHandler = defined('PHPUNIT_COMPOSER_INSTALL'); + $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { + if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { + return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; + } + + if (isset($collectedLogs[$message])) { + ++$collectedLogs[$message]['count']; + + return; + } - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - // Clean the trace by removing first frames added by the error handler itself. - for ($i = 0; isset($backtrace[$i]); ++$i) { - if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $backtrace = array_slice($backtrace, 1 + $i); - break; - } + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + // Clean the trace by removing first frames added by the error handler itself. + for ($i = 0; isset($backtrace[$i]); ++$i) { + if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { + $backtrace = array_slice($backtrace, 1 + $i); + break; } + } - $collectedLogs[$message] = array( - 'type' => $type, - 'message' => $message, - 'file' => $file, - 'line' => $line, - 'trace' => $backtrace, - 'count' => 1, - ); - }); - } else { - $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $collectedLogs[$message] = array( + 'type' => $type, + 'message' => $message, + 'file' => $file, + 'line' => $line, + 'trace' => $backtrace, + 'count' => 1, + ); + }); + } + + try { + $container = null; + $container = $this->buildContainer(); + $container->compile(); + } finally { + if ($this->debug && true !== $previousHandler) { + restore_error_handler(); + + file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); + file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); } + } + if (null === $oldContainer) { + $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); try { - $container = null; - $container = $this->buildContainer(); - $container->compile(); - - $oldContainer = file_exists($cache->getPath()) && is_object($oldContainer = include $cache->getPath()) ? new \ReflectionClass($oldContainer) : false; + $oldContainer = include $cache->getPath(); + } catch (\Throwable $e) { + } catch (\Exception $e) { } finally { - if (!$this->debug) { - error_reporting($errorLevel); - } elseif (true !== $previousHandler) { - restore_error_handler(); - - file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); - file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); - } + error_reporting($errorLevel); } - - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - $this->container = require $cache->getPath(); } + $oldContainer = is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false; + $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); + $this->container = require $cache->getPath(); $this->container->set('kernel', $this); - if ($fresh) { - return; - } - if ($oldContainer && get_class($this->container) !== $oldContainer->name) { // Because concurrent requests might still be using them, // old container files are not removed immediately, 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 083/107] [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 6caa46b3562cc..1d03297a33b68 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 763a9145a83286504427defa6e977aa2f66ade13 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 21 Jan 2018 15:43:56 +0100 Subject: [PATCH 084/107] [Console] Fix using finally where the catch can also fail --- src/Symfony/Component/Console/Application.php | 16 +++++++---- .../Console/Tests/ApplicationTest.php | 28 +++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 177bce2eb53fa..00e941f13238a 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -874,6 +874,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI } $event = new ConsoleCommandEvent($command, $input, $output); + $e = null; try { $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); @@ -886,13 +887,18 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI } catch (\Throwable $e) { $event = new ConsoleErrorEvent($input, $output, $e, $command); $this->dispatcher->dispatch(ConsoleEvents::ERROR, $event); + $e = $event->getError(); - if (0 !== $exitCode = $event->getExitCode()) { - throw $event->getError(); + if (0 === $exitCode = $event->getExitCode()) { + $e = null; } - } finally { - $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); - $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); + } + + $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); + $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); + + if (null !== $e) { + throw $e; } return $event->getExitCode(); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 39e18d6084d7e..e9432c522d6f7 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1553,6 +1553,34 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn } } + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage foo + */ + public function testThrowingErrorListener() + { + $dispatcher = $this->getDispatcher(); + $dispatcher->addListener('console.error', function (ConsoleErrorEvent $event) { + throw new \RuntimeException('foo'); + }); + + $dispatcher->addListener('console.command', function () { + throw new \RuntimeException('bar'); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + + $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('foo.'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'foo')); + } + protected function tearDown() { putenv('SHELL_VERBOSITY'); From d1a96ca9d35e41b2f26181e58db499099cb94fbb Mon Sep 17 00:00:00 2001 From: Jack Wright Date: Fri, 10 Nov 2017 11:21:24 +0000 Subject: [PATCH 085/107] [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 ce7258acd6931..297f036a2f099 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 086/107] [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 a797d7a2e68f7..d1065e797740a 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 087/107] 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 d13fc14c0c6bb..3fde9ab28b100 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 0000000000000..b9e23e7692156 --- /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 0000000000000..6bba1c86be5ac --- /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 0000000000000..4c4879e61156d --- /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 088/107] 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 c267f6896c266..b5eb7f77d5530 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 089/107] [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 cd892a9687e0c..6d2d7873fa77f 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 9bd28fc728a500ca2cea4cfdb7c3146ff2cb90f2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 22 Jan 2018 13:02:44 +0100 Subject: [PATCH 090/107] cs fix --- .../Component/DependencyInjection/Dumper/PhpDumper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 5a48950ad4168..847323a2376ca 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1183,9 +1183,9 @@ public function getParameterBag() } EOF; - if (!$this->asFiles) { - $code = preg_replace('/^.*buildParameters.*\n.*\n.*\n/m', '', $code); - } + if (!$this->asFiles) { + $code = preg_replace('/^.*buildParameters.*\n.*\n.*\n/m', '', $code); + } if ($dynamicPhp) { $loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, count($dynamicPhp), false)), '', 8); From fb1be51a5c4f3ea8f09ed0af93d29d38a534557e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jan 2018 14:11:18 +0100 Subject: [PATCH 091/107] 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 6c924433a520f..bf12a8bc47e5f 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 67eafc5e554e7..d579ed4c0a181 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 9e37c6d76f320..393477aeb49ac 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 092/107] 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 59f8cc7d0dcb9..626cda2e24b31 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 b6b9e93a86ca3..c5c4f89784c6b 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 c9f8010268717..ba07d7c44cbd6 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 0000000000000..e88e12e2f286e --- /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 85c74b572d080..54e340757e9d8 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 093/107] 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 54383aad94aae..53d2b1370b886 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 3d1bbd831da19..32b1f751a8135 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 dff3d0a62e587..7430f3723ae99 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 d50598bb1db00..6827ae20fcca1 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 ecf6f59190498..f21fc6ab7c785 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 0603ffb62f937..b4cb99ca9ebf6 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 094/107] 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 c22ef76a6b56c..b70ad2a21c8c2 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 ec7633feeaf49..1626e0ab1c602 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 de502f7d6cb0231643ba93d4103a03807c5a1f46 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Fri, 8 Dec 2017 13:42:23 +0100 Subject: [PATCH 095/107] [Console] Provide a bugfix where an array could be passed --- src/Symfony/Component/Console/Helper/Table.php | 5 +++++ .../Component/Console/Tests/Helper/TableTest.php | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 905f7b87085f7..81d0e427f473d 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -454,11 +454,16 @@ private function buildTableRows($rows) * @param int $line * * @return array + * + * @throws InvalidArgumentException */ private function fillNextRows(array $rows, $line) { $unmergedRows = array(); foreach ($rows[$line] as $column => $cell) { + if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(is_object($cell) && method_exists($cell, '__toString'))) { + throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', gettype($cell))); + } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; $lines = array($cell); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index d8a8ff00875b2..b195e09acb8b0 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -726,6 +726,22 @@ public function testColumnStyle() $this->assertEquals($expected, $this->getOutputContent($output)); } + /** + * @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException + * @expectedExceptionMessage A cell must be a TableCell, a scalar or an object implementing __toString, array given. + */ + public function testThrowsWhenTheCellInAnArray() + { + $table = new Table($output = $this->getOutputStream()); + $table + ->setHeaders(array('ISBN', 'Title', 'Author', 'Price')) + ->setRows(array( + array('99921-58-10-7', array(), 'Dante Alighieri', '9.95'), + )); + + $table->render(); + } + public function testColumnWith() { $table = new Table($output = $this->getOutputStream()); From 8ecfeb1e31f8d0a8239ec47235bf4fd39d3d1b49 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Wed, 24 Jan 2018 17:32:05 +0100 Subject: [PATCH 096/107] 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 a2c6e0e4f9f16..84fdb4b00c086 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 097/107] 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 f445c79c5ef2b..6e13e9c3832d3 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 098/107] 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 3dbe110fcb084..d7832753131d9 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 08d2d74e65b37..a81c2db5511c1 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 099/107] 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 ae69e0426d6b1..2422e11cd898a 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 5f638b68fe431..7975570cccc61 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 100/107] 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 0e5f6ec9a4a37..c0a15e5152ce2 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 b42418e7a2940..32d0a130ffd0a 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 db34f9187bd1f..3cb0b298bb07a 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 101/107] 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 23430edde6f70..4493a5bafc3b9 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 8ded178bbeb6b..85fb533715b62 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 102/107] 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 4493a5bafc3b9..c2f533eb36798 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 85fb533715b62..1fe21d0f6c1a8 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 103/107] 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 a1e360de11915..28779acfa025f 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 c6d1a07cd7803..0000000000000 --- 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 3a653b30002c9..c3f2aac53eff8 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 60b83c222b7fc..8e596ac33a1c7 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 331dfea14ed25..c02d3dd6950b9 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 e2389ebf003a8..a927f200f0fdc 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 44c37723cabf9..056f1279dc6e5 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 48c1b764bdda6..1c48a777edc97 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 21962d12adb8d..1457ff30c6c21 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 8f7d13961f1de..cb218822de383 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 104/107] [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 15945644a462b..dfd66516062c3 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 bd6df791f74c67766c714010ad1141fd815b6cba Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Jan 2018 10:29:16 +0100 Subject: [PATCH 105/107] fixed bad merge --- src/Symfony/Component/DependencyInjection/Container.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index aba6b7b0a3547..b4881b70d315e 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -149,8 +149,6 @@ public function set($id, $service) $initialize(); } - $id = $this->normalizeId($id); - if ('service_container' === $id) { throw new InvalidArgumentException('You cannot set service "service_container".'); } From 25d93b4542a7c2827f8c0b11a51fe0c213bc2e0f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Jan 2018 14:26:56 +0100 Subject: [PATCH 106/107] updated CHANGELOG for 4.0.4 --- CHANGELOG-4.0.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index af2487c409bd7..b411c42ae9c81 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -7,6 +7,58 @@ in 4.0 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/v4.0.0...v4.0.1 +* 4.0.4 (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 #25397 [Console] Provide a DX where an array could be passed (Simperfit) + * bug #25858 [DI] Fix initialization of legacy containers by delaying include_once (nicolas-grekas) + * bug #25891 [DependencyInjection] allow null values for root nodes in YAML configs (xabbuh) + * bug #24864 Have weak_vendors ignore deprecations from outside (greg0ire) + * bug #25873 [Console] Fix using finally where the catch can also fail (nicolas-grekas) + * 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 #25863 [Yaml] trim spaces from unquoted scalar values (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 #25823 [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage is used (giovannialbero1992) + * bug #25824 Fixing a bug where the dump() function depended on bundle ordering (weaverryan) + * bug #25763 [OptionsResolver] Fix options resolver with array allowed types (mcg-web) + * 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 #25249 [Form] Avoid button label translation when it's set to false (TeLiXj) + * bug #25127 [TwigBridge] Pass the form-check-inline in parent (Simperfit) + * bug #25812 Copied NO language files to the new NB locale (derrabus) + * bug #25753 [Console] Fix restoring exception handler (nicolas-grekas, fancyweb) + * bug #25801 [Router] Skip anonymous classes when loading annotated routes (pierredup) + * bug #25508 [FrameworkBundle] Auto-enable CSRF if the component *+ session* are loaded (nicolas-grekas) + * 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 #25699 [HttpKernel] Fix session handling: decouple "save" from setting response "private" (nicolas-grekas) + * bug #25490 [Serializer] Fixed throwing exception with option JSON_PARTIAL_OUTPUT_ON_ERROR (diversantvlz) + * bug #25737 [TwigBridge] swap filter/function and package names (xabbuh) + * bug #25731 [HttpFoundation] Always call proxied handler::destroy() in StrictSessionHandler (nicolas-grekas) + * bug #25733 [HttpKernel] Fix compile error when a legacy container is fresh again (nicolas-grekas) + * bug #25709 Tweaked some styles in the profiler tables (javiereguiluz) + * bug #25719 [HttpKernel] Uses cookies to track the requests redirection (sroze) + * 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) + * 4.0.3 (2018-01-05) * bug #25685 Use triggering file to determine weak vendors if when the test is run in a separate process (alexpott) From 109c4b45a90fe2f2da27a0b8e5b6a201e8e5889e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Jan 2018 14:27:08 +0100 Subject: [PATCH 107/107] updated VERSION for 4.0.4 --- 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 f35601e9a1eb4..14d4d269e27dd 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -63,12 +63,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.0.4-DEV'; + const VERSION = '4.0.4'; const VERSION_ID = 40004; const MAJOR_VERSION = 4; const MINOR_VERSION = 0; const RELEASE_VERSION = 4; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2018'; const END_OF_LIFE = '01/2019';