diff --git a/.github/build-packages.php b/.github/build-packages.php index e61eae51df550..5e9bcc141544e 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -57,7 +57,7 @@ $versions = @file_get_contents('https://repo.packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"dev-master":%s}}}', $package->name, file_get_contents($dir.'/composer.json')); $versions = json_decode($versions)->packages->{$package->name}; - if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { + if (isset($versions->{'dev-master'}) && $package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { unset($versions->{'dev-master'}); } diff --git a/.travis.yml b/.travis.yml index 3a022159513e8..12d031f64be20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -231,7 +231,7 @@ install: composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master - | - # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one + # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index a358d609f3cc6..904b246eaca31 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,33 @@ 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.30 (2019-07-27) + + * bug #32503 Fix multiSelect ChoiceQuestion when answers have spaces (IceMaD) + * bug #32688 [Yaml] fix inline handling when dumping tagged values (xabbuh) + * bug #32644 [WebProfileBundle] Avoid getting right to left style (Arman-Hosseini) + * bug #32679 [Intl] relax some date parser patterns (xabbuh) + * bug #31303 [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) (dorumd, nicolas-grekas) + * bug #32485 [Validator] Added support for validation of giga values (kernig) + * bug #32572 Bump minimum version of symfony/phpunit-bridge (fancyweb) + * bug #32438 [Serializer] XmlEncoder: don't cast padded strings (ogizanagi) + * bug #32579 [Config] Do not use absolute path when computing the vendor freshness (lyrixx) + * bug #32563 Container*::getServiceIds() should return strings (mathroc) + * bug #32466 [Config] Fix for signatures of typed properties (tvandervorm) + * bug #32500 [Debug][DebugClassLoader] Include found files instead of requiring them (fancyweb) + * bug #32464 [WebProfilerBundle] Fix Twig 1.x compatibility (yceruto) + * bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42) + * bug #32096 Don't assume port 0 for X-Forwarded-Port (alexbowers, xabbuh) + * bug #31267 [Translator] Load plurals from mo files properly (Stadly) + * bug #31266 [Translator] Load plurals from po files properly (Stadly) + * bug #32421 [EventDispatcher] Add tag kernel.rest on 'debug.event_dispatcher' service (lyrixx) + * bug #32379 [SecurityBundle] conditionally register services (xabbuh) + * bug #32363 [FrameworkBundle] reset cache pools between requests (nicolas-grekas) + * bug #32365 [DI] fix processing of regular parameter bags by MergeExtensionConfigurationPass (nicolas-grekas) + * bug #32187 [PHPUnit] Fixed composer error on Windows (misterx) + * bug #32206 Catch JsonException and rethrow in JsonEncode (phil-davis) + * bug #32200 [Security/Core] work around sodium_compat issue (nicolas-grekas) + * 3.4.29 (2019-06-26) * bug #32137 [HttpFoundation] fix accessing session bags (xabbuh) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 011ad9bee0777..a8b902b78b853 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,9 +16,9 @@ Symfony is the result of the work of many people who made the code better - Kévin Dunglas (dunglas) - Maxime Steinhausser (ogizanagi) - Ryan Weaver (weaverryan) + - Javier Eguiluz (javier.eguiluz) - Jakub Zalas (jakubzalas) - Johannes S (johannes) - - Javier Eguiluz (javier.eguiluz) - Roland Franssen (ro0) - Kris Wallsmith (kriswallsmith) - Grégoire Pineau (lyrixx) @@ -28,52 +28,53 @@ Symfony is the result of the work of many people who made the code better - Romain Neutron (romain) - Pascal Borreli (pborreli) - Wouter De Jong (wouterj) + - Yonel Ceruto (yonelceruto) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - - Yonel Ceruto (yonelceruto) - Martin Hasoň (hason) + - Hamza Amrouche (simperfit) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Jules Pietri (heah) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Eriksen Costa (eriksencosta) - - Hamza Amrouche (simperfit) - Guilhem Niot (energetick) + - Alexander M. Turek (derrabus) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Tobias Nyholm (tobias) - - Lynn van der Berg (kjarli) - Jérémy DERUSSÉ (jderusse) + - Lynn van der Berg (kjarli) - Diego Saint Esteben (dosten) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar - - Alexander M. Turek (derrabus) - Dany Maillard (maidmaid) - Francis Besset (francisbesset) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Matthias Pigulla (mpdude) - Bulat Shakirzyanov (avalanche123) + - Konstantin Myakshin (koc) + - Pierre du Plessis (pierredup) + - Grégoire Paris (greg0ire) - Saša Stamenković (umpirsky) - Peter Rehm (rpet) - - Pierre du Plessis (pierredup) - Kevin Bond (kbond) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik - Diego Saint Esteben (dii3g0) - - Grégoire Paris (greg0ire) - - Konstantin Kudryashov (everzet) - Gábor Egyed (1ed) + - Thomas Calvet (fancyweb) + - Konstantin Kudryashov (everzet) - Titouan Galopin (tgalopin) - - Konstantin Myakshin (koc) + - Valentin Udaltsov (vudaltsov) - Bilal Amarni (bamarni) - Mathieu Piot (mpiot) - David Maicher (dmaicher) - Florin Patan (florinpatan) - - Valentin Udaltsov (vudaltsov) - Gabriel Ostrolucký (gadelat) - Vladimir Reznichenko (kalessil) - Jáchym Toušek (enumag) @@ -89,13 +90,13 @@ Symfony is the result of the work of many people who made the code better - Dariusz Górecki (canni) - Douglas Greenshields (shieldo) - David Buchmann (dbu) + - Jan Schädlich (jschaedl) - Dariusz Ruminski - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Graham Campbell (graham) - Daniel Holmes (dholmes) - - Thomas Calvet (fancyweb) - Toni Uebernickel (havvg) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) @@ -120,7 +121,7 @@ Symfony is the result of the work of many people who made the code better - Peter Kokot (maastermedia) - Jacob Dreesen (jdreesen) - Florian Voutzinos (florianv) - - Jan Schädlich (jschaedl) + - Sebastiaan Stok (sstok) - Colin Frei - Javier Spagnoletti (phansys) - Adrien Brault (adrienbrault) @@ -128,30 +129,29 @@ Symfony is the result of the work of many people who made the code better - Daniel Wehner (dawehner) - excelwebzone - Gordon Franke (gimler) - - Sebastiaan Stok (sstok) - Fabien Pennequin (fabienpennequin) - Théo FIDRY (theofidry) + - Teoh Han Hui (teohhanhui) + - Oskar Stark (oskarstark) - Eric GELOEN (gelo) - Joel Wurtz (brouznouf) - Lars Strojny (lstrojny) - Tugdual Saunier (tucksaun) + - Alex Pott + - Jannik Zschiesche (apfelbox) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) - - Oskar Stark (oskarstark) + - Gabriel Caruso (carusogabriel) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - - Alex Pott - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) - - Teoh Han Hui (teohhanhui) - Anthony MARTIN (xurudragon) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - - Gabriel Caruso - Hidenori Goto (hidenorigoto) - Arnaud Kleinpeter (nanocom) - - Jannik Zschiesche (apfelbox) - Guilherme Blanco (guilhermeblanco) - SpacePossum - Pablo Godel (pgodel) @@ -164,18 +164,19 @@ Symfony is the result of the work of many people who made the code better - jwdeitch - Mikael Pajunen - François-Xavier de Guillebon (de-gui_f) + - Alessandro Chitolina (alekitto) + - Massimiliano Arione (garak) - Niels Keurentjes (curry684) - Vyacheslav Pavlov - Richard van Laak (rvanlaak) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Rouven Weßling (realityking) + - Alexander Schranz (alexander-schranz) - Clemens Tolboom - Helmer Aaviksoo - - Alessandro Chitolina (alekitto) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - - Massimiliano Arione (garak) - Michał Pipa (michal.pipa) - Dawid Nowak - George Mponos (gmponos) @@ -186,7 +187,7 @@ Symfony is the result of the work of many people who made the code better - GDIBass - Samuel NELA (snela) - Vincent Touzet (vincenttouzet) - - Alexander Schranz (alexander-schranz) + - Jérôme Parmentier (lctrs) - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent) - James Halsall (jaitsu) - Matthieu Napoli (mnapoli) @@ -194,6 +195,7 @@ Symfony is the result of the work of many people who made the code better - Warnar Boekkooi (boekkooi) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) + - Yanick Witschi (toflar) - Marek Štípek (maryo) - Daniel Espendiller - Possum @@ -213,7 +215,7 @@ Symfony is the result of the work of many people who made the code better - Andreas Hucks (meandmymonkey) - Tom Van Looy (tvlooy) - Noel Guilbert (noel) - - Yanick Witschi (toflar) + - Stadly - Stepan Anchugov (kix) - bronze1man - sun (sun) @@ -231,6 +233,7 @@ Symfony is the result of the work of many people who made the code better - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) - Leszek Prabucki (l3l0) + - Ben Davies (bendavies) - Fabien Bourigault (fbourigault) - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) @@ -299,6 +302,7 @@ Symfony is the result of the work of many people who made the code better - Jan Sorgalla (jsor) - Ray - Chekote + - François Pluchino (francoispluchino) - Antoine Makdessi (amakdessi) - Thomas Adam - Jhonny Lidfors (jhonne) @@ -316,7 +320,6 @@ Symfony is the result of the work of many people who made the code better - Giorgio Premi - renanbr - Alex Rock (pierstoval) - - Ben Davies (bendavies) - Beau Simensen (simensen) - Michael Hirschler (mvhirsch) - Robert Kiss (kepten) @@ -325,18 +328,18 @@ Symfony is the result of the work of many people who made the code better - Kim Hemsø Rasmussen (kimhemsoe) - Pascal Luna (skalpa) - Wouter Van Hecke - - Jérôme Parmentier (lctrs) - Peter Kruithof (pkruithof) - Michael Holm (hollo) + - Andreas Braun - Mathieu Lechat - Marc Weistroff (futurecat) + - Simon Mönch (sm) - Christian Schmidt - Patrick Landolt (scube) - MatTheCat - Chad Sikorra (chadsikorra) - Chris Smith (cs278) - Florian Klein (docteurklein) - - Stadly - Manuel Kiessling (manuelkiessling) - Atsuhiro KUBO (iteman) - Quynh Xuan Nguyen (xuanquynh) @@ -344,6 +347,7 @@ Symfony is the result of the work of many people who made the code better - Serkan Yildiz (srknyldz) - Andrew Moore (finewolf) - Bertrand Zuchuat (garfield-fr) + - Tomas Norkūnas (norkunas) - Sullivan SENECHAL (soullivaneuh) - Gabor Toth (tgabi333) - realmfoo @@ -354,7 +358,6 @@ Symfony is the result of the work of many people who made the code better - Wouter J - Ismael Ambrosi (iambrosi) - Emmanuel BORGES (eborges78) - - François Pluchino (francoispluchino) - Aurelijus Valeiša (aurelijus) - Jan Decavele (jandc) - Gustavo Piltcher @@ -394,7 +397,6 @@ Symfony is the result of the work of many people who made the code better - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) - Artur Eshenbrener - - Andreas Braun - Arjen van der Meijden - Damien Alexandre (damienalexandre) - Thomas Perez (scullwm) @@ -407,6 +409,7 @@ Symfony is the result of the work of many people who made the code better - David Badura (davidbadura) - hossein zolfi (ocean) - Clément Gautier (clementgautier) + - Thomas Bisignani (toma) - Sanpi - Eduardo Gulias (egulias) - giulio de donato (liuggio) @@ -418,11 +421,13 @@ Symfony is the result of the work of many people who made the code better - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) - Martin Hujer (martinhujer) + - Alex Bowers - Philipp Cordes - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) - Vyacheslav Salakhutdinov (megazoll) + - Sébastien Alfaiate (seb33300) - Hassan Amouhzi - Tamas Szijarto - Michele Locati @@ -445,6 +450,7 @@ Symfony is the result of the work of many people who made the code better - Krzysztof Piasecki (krzysztek) - Maximilian Reichel (phramz) - Loick Piera (pyrech) + - Alain Hippolyte (aloneh) - Karoly Negyesi (chx) - Ivan Kurnosov - Xavier HAUSHERR @@ -453,6 +459,7 @@ Symfony is the result of the work of many people who made the code better - Miha Vrhovnik - Alessandro Desantis - hubert lecorche (hlecorche) + - Arman Hosseini - Marc Morales Valldepérez (kuert) - Jean-Baptiste GOMOND (mjbgo) - Vadim Kharitonov (virtuozzz) @@ -483,6 +490,7 @@ Symfony is the result of the work of many people who made the code better - Alessandro Lai (jean85) - Arturs Vonda - Josip Kruslin + - Matthew Smeets - Asmir Mustafic (goetas) - vagrant - Aurimas Niekis (gcds) @@ -521,6 +529,7 @@ Symfony is the result of the work of many people who made the code better - Rhodri Pugh (rodnaph) - Sam Fleming (sam_fleming) - Alex Bakhturin + - Patrick Reimers (preimers) - Pol Dellaiera (drupol) - insekticid - Alexander Obuhovich (aik099) @@ -533,6 +542,7 @@ Symfony is the result of the work of many people who made the code better - Frank Neff (fneff) - Roman Lapin (memphys) - Yoshio HANAWA + - Jan van Thoor (janvt) - Gladhon - Haralan Dobrev (hkdobrev) - Sebastian Bergmann @@ -542,8 +552,9 @@ Symfony is the result of the work of many people who made the code better - Sergio Santoro - Robin van der Vleuten (robinvdvleuten) - Philipp Rieber (bicpi) - - Tomas Norkūnas (norkunas) - Manuel de Ruiter (manuel) + - Nathanael Noblet (gnat) + - nikos.sotiropoulos - Eduardo Oliveira (entering) - Ilya Antipenko (aivus) - Ricardo Oliveira (ricardolotr) @@ -551,7 +562,6 @@ Symfony is the result of the work of many people who made the code better - ondrowan - Barry vd. Heuvel (barryvdh) - Craig Duncan (duncan3dc) - - Sébastien Alfaiate (seb33300) - Evan S Kaufman (evanskaufman) - mcben - Jérôme Vieilledent (lolautruche) @@ -607,7 +617,6 @@ Symfony is the result of the work of many people who made the code better - NothingWeAre - Ryan - Alexander Deruwe (aderuwe) - - Alain Hippolyte (aloneh) - Dave Hulbert (dave1010) - Ivan Rey (ivanrey) - Marcin Chyłek (songoq) @@ -629,6 +638,7 @@ Symfony is the result of the work of many people who made the code better - Geoffrey Tran (geoff) - Jan Behrens - Mantas Var (mvar) + - Chris Tanaskoski - Sebastian Krebs - Piotr Stankowski - Baptiste Leduc (bleduc) @@ -640,6 +650,7 @@ Symfony is the result of the work of many people who made the code better - vitaliytv - Dalibor Karlović (dkarlovi) - Sebastian Blum + - Alexis Lefebvre - aubx - Marvin Butkereit - Renan @@ -751,7 +762,6 @@ Symfony is the result of the work of many people who made the code better - Tiago Brito (blackmx) - - Richard van den Brand (ricbra) - - Thomas Bisignani (toma) - develop - flip111 - Greg Anderson @@ -781,7 +791,6 @@ Symfony is the result of the work of many people who made the code better - Dominik Ritter (dritter) - Sebastian Grodzicki (sgrodzicki) - Jeroen van den Enden (stoefke) - - nikos.sotiropoulos - Pascal Helfenstein - Anthony GRASSIOT (antograssiot) - Baldur Rensch (brensch) @@ -795,6 +804,7 @@ Symfony is the result of the work of many people who made the code better - Tarjei Huse (tarjei) - Besnik Br - Jose Gonzalez + - Jonathan (jls-esokia) - Oleksii Zhurbytskyi - Dariusz Ruminski - Joshua Nye @@ -822,6 +832,7 @@ Symfony is the result of the work of many people who made the code better - Marc Morera (mmoreram) - Saif Eddin Gmati (azjezz) - BENOIT POLASZEK (bpolaszek) + - Mathieu Rochette (mathroc) - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) @@ -887,7 +898,6 @@ Symfony is the result of the work of many people who made the code better - Sergey Zolotov (enleur) - Maksim Kotlyar (makasim) - Neil Ferreira - - Nathanael Noblet (gnat) - Indra Gunawan (indragunawan) - Julie Hourcade (juliehde) - Dmitry Parnas (parnas) @@ -914,6 +924,7 @@ Symfony is the result of the work of many people who made the code better - Stefan Kruppa - mmokhi - corphi + - JoppeDC - grizlik - Derek ROTH - Ben Johnson @@ -921,6 +932,7 @@ Symfony is the result of the work of many people who made the code better - Dmytro Boiko (eagle) - Shin Ohno (ganchiku) - Geert De Deckere (geertdd) + - Ion Bazan (ionbazan) - Jacek Jędrzejewski (jacek.jedrzejewski) - Jan Kramer (jankramer) - abdul malik ikhsan (samsonasik) @@ -977,12 +989,12 @@ Symfony is the result of the work of many people who made the code better - Benoît Merlet (trompette) - Koen Kuipers - datibbaw + - Pablo Lozano (arkadis) - Erik Saunier (snickers) - Rootie - Kyle - Daniel Alejandro Castro Arellano (lexcast) - sensio - - Chris Tanaskoski - Thomas Jarrand - Antoine Bluchet (soyuka) - Sebastien Morel (plopix) @@ -1006,7 +1018,6 @@ Symfony is the result of the work of many people who made the code better - Mikkel Paulson - ergiegonzaga - Farhad Safarov - - Alexis Lefebvre - Liverbool (liverbool) - Sam Malone - Phan Thanh Ha (haphan) @@ -1058,6 +1069,7 @@ Symfony is the result of the work of many people who made the code better - dantleech - Bastien DURAND (deamon) - Xavier Leune + - Sander Goossens (sandergo90) - Rudy Onfroy - Tero Alén (tero) - Stanislav Kocanda @@ -1068,6 +1080,7 @@ Symfony is the result of the work of many people who made the code better - Silvio Ginter - MGDSoft - Vadim Tyukov (vatson) + - Arman - David Wolter (davewww) - Sortex - chispita @@ -1099,6 +1112,7 @@ Symfony is the result of the work of many people who made the code better - Mert Simsek (mrtsmsk0) - Lin Clark - Jeremy David (jeremy.david) + - Timo Bakx (timobakx) - Jordi Rejas - Troy McCabe - Ville Mattila @@ -1113,7 +1127,6 @@ Symfony is the result of the work of many people who made the code better - nacho - Piotr Antosik (antek88) - Artem Lopata - - Patrick Reimers (preimers) - Sergey Novikov (s12v) - Marcos Quesada (marcos_quesada) - Matthew Vickery (mattvick) @@ -1139,6 +1152,7 @@ Symfony is the result of the work of many people who made the code better - Michał Strzelecki - Soner Sayakci - hugofonseca (fonsecas72) + - Marc Duboc (icemad) - Martynas Narbutas - Toon Verwerft (veewee) - Bailey Parker @@ -1182,7 +1196,6 @@ Symfony is the result of the work of many people who made the code better - Jochen Bayer (jocl) - Patrick Carlo-Hickman - Bruno MATEU - - Alex Bowers - Jeremy Bush - wizhippo - Mathias STRASSER (roukmoute) @@ -1237,7 +1250,9 @@ Symfony is the result of the work of many people who made the code better - Max Voloshin (maxvoloshin) - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) + - Piet Steinhart - mshavliuk + - Rémy LESCALLIER - WybrenKoelmans - Derek Lambert - MightyBranch @@ -1263,10 +1278,10 @@ Symfony is the result of the work of many people who made the code better - Marco - Marc Torres - Alberto Aldegheri + - Philippe Segatori - Dmitri Petmanson - heccjj - Alexandre Melard - - Jonathan (jls-esokia) - Jay Klehr - Sergey Yuferev - Tobias Stöckler @@ -1385,6 +1400,7 @@ Symfony is the result of the work of many people who made the code better - Tom Corrigan (tomcorrigan) - Luis Galeas - Martin Pärtel + - Bastien Jaillot (bastnic) - Frédéric Bouchery (fbouchery) - Patrick Daley (padrig) - Xavier Briand (xavierbriand) @@ -1408,7 +1424,6 @@ Symfony is the result of the work of many people who made the code better - Dāvis Zālītis (k0d3r1s) - Carsten Nielsen (phreaknerd) - Roger Guasch (rogerguasch) - - Mathieu Rochette - Jay Severson - René Kerner - Nathaniel Catchpole @@ -1456,6 +1471,7 @@ Symfony is the result of the work of many people who made the code better - Ergie Gonzaga - Matthew J Mucklo - AnrDaemon + - Emre Akinci (emre) - fdgdfg (psampaz) - Stéphane Seng - Maxwell Vandervelde @@ -1567,6 +1583,7 @@ Symfony is the result of the work of many people who made the code better - Arnau González (arnaugm) - Simon Bouland (bouland) - Jibé Barth (jibbarth) + - Julien Montel (julienmgel) - Matthew Foster (mfoster) - Reyo Stallenberg (reyostallenberg) - Paul Seiffert (seiffert) @@ -1587,6 +1604,7 @@ Symfony is the result of the work of many people who made the code better - Ulugbek Miniyarov - Jeremy Benoist - Michal Gebauer + - Phil Davis - Gleb Sidora - David Stone - Jovan Perovic (jperovic) @@ -1601,6 +1619,7 @@ Symfony is the result of the work of many people who made the code better - Andreas - Markus - Daniel Gorgan + - kernig - Thomas Chmielowiec - shdev - Andrey Ryaguzov @@ -1611,6 +1630,7 @@ Symfony is the result of the work of many people who made the code better - Mickael GOETZ - Maciej Schmidt - Dennis Væversted + - Timon van der Vorm - nuncanada - flack - František Bereň @@ -1634,6 +1654,7 @@ Symfony is the result of the work of many people who made the code better - me_shaon - 蝦米 - Grayson Koonce (breerly) + - Mardari Dorel (dorumd) - Andrey Helldar (helldar) - Karim Cassam Chenaï (ka) - Maksym Slesarenko (maksym_slesarenko) @@ -1683,7 +1704,6 @@ Symfony is the result of the work of many people who made the code better - Brian Graham (incognito) - Kevin Vergauwen (innocenzo) - Alessio Baglio (ioalessio) - - Jan van Thoor (janvt) - Johannes Müller (johmue) - Jordi Llonch (jordillonch) - Nicholas Ruunu (nicholasruunu) @@ -1754,6 +1774,7 @@ Symfony is the result of the work of many people who made the code better - thib92 - Rudolf Ratusiński - Bertalan Attila + - Amin Hosseini (aminh) - AmsTaFF (amstaff) - Simon Müller (boscho) - Yannick Bensacq (cibou) @@ -1830,7 +1851,6 @@ Symfony is the result of the work of many people who made the code better - Marco Lipparini - Haritz - Matthieu Prat - - Ion Bazan - Grummfy - Paul Le Corre - Filipe Guerra @@ -1855,7 +1875,6 @@ Symfony is the result of the work of many people who made the code better - Alexis MARQUIS - Gerrit Drost - Linnaea Von Lavia - - Simon Mönch - Javan Eskander - Lenar Lõhmus - Cristian Gonzalez @@ -1873,6 +1892,7 @@ Symfony is the result of the work of many people who made the code better - Klaas Naaijkens - Daniel González Cerviño - Rafał + - Lctrs - Achilles Kaloeridis (achilles) - Adria Lopez (adlpz) - Aaron Scherer (aequasi) @@ -1964,11 +1984,13 @@ Symfony is the result of the work of many people who made the code better - goohib - Chi-teck - Tom Counsell + - George Bateman - Xavier HAUSHERR - Ron Gähler - Edwin Hageman - Mantas Urnieža - temperatur + - misterx - Cas - Dusan Kasan - Karolis @@ -2015,6 +2037,7 @@ Symfony is the result of the work of many people who made the code better - Alexandru Bucur - cmfcmf - Drew Butler + - Alexey Berezuev - Steve Müller - Andras Ratz - andreabreu98 @@ -2059,6 +2082,7 @@ Symfony is the result of the work of many people who made the code better - Sébastien HOUZE - Abdulkadir N. A. - Adam Klvač + - Bruno Nogueira Nascimento Wowk - Yevgen Kovalienia - Lebnik - nsbx @@ -2068,6 +2092,7 @@ Symfony is the result of the work of many people who made the code better - Elan Ruusamäe - Jon Dufresne - Thorsten Hallwas + - Alex Nostadt - Michael Squires - Egor Gorbachev - Derek Stephen McLean @@ -2187,6 +2212,7 @@ Symfony is the result of the work of many people who made the code better - ollie harridge (ollietb) - Dimitri Gritsajuk (ottaviano) - Paul Andrieux (paulandrieux) + - Paulo Ribeiro (paulo) - Paweł Szczepanek (pauluz) - Philippe Degeeter (pdegeeter) - Christian López Espínola (penyaskito) @@ -2215,6 +2241,7 @@ Symfony is the result of the work of many people who made the code better - Tom Newby (tomnewbyau) - Andrew Clark (tqt_andrew_clark) - David Lumaye (tux1124) + - Roman Tymoshyk (tymoshyk) - Tyler Stroud (tystr) - Moritz Kraft (userfriendly) - Víctor Mateo (victormateo) @@ -2232,6 +2259,7 @@ Symfony is the result of the work of many people who made the code better - simpson - drublic - Andreas Streichardt + - Alexandre Segura - Pascal Hofmann - smokeybear87 - Gustavo Adrian @@ -2255,7 +2283,6 @@ Symfony is the result of the work of many people who made the code better - Mohamed Karnichi (amiral) - Andrew Carter (andrewcarteruk) - Adam Elsodaney (archfizz) - - Pablo Lozano (arkadis) - Gregório Bonfante Borba (bonfante) - Bogdan Rancichi (devck) - Daniel Kolvik (dkvk) diff --git a/composer.json b/composer.json index 143f73d3c2f35..919941f984d6b 100644 --- a/composer.json +++ b/composer.json @@ -98,7 +98,7 @@ "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "predis/predis": "~1.0", "egulias/email-validator": "~1.2,>=1.2.8|~2.0", - "symfony/phpunit-bridge": "~3.4|~4.0|~5.0", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8|~5.0", "symfony/security-acl": "~2.8|~3.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0" }, diff --git a/phpunit b/phpunit index dc9e127b78fb7..6d5bdc279bcd7 100755 --- a/phpunit +++ b/phpunit @@ -1,7 +1,7 @@ #!/usr/bin/env php assertEquals([3 => new ChoiceView($entity3, '3', 'Baz'), 2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['preferred_choices']); - $this->assertEquals([1 => new ChoiceView($entity1, '1', 'Foo')], $field->createView()->vars['choices']); + $this->assertArrayHasKey(1, $field->createView()->vars['choices']); + $this->assertEquals(new ChoiceView($entity1, '1', 'Foo'), $field->createView()->vars['choices'][1]); } public function testOverrideChoicesWithPreferredChoices() @@ -868,7 +869,8 @@ public function testOverrideChoicesWithPreferredChoices() ]); $this->assertEquals([3 => new ChoiceView($entity3, '3', 'Baz')], $field->createView()->vars['preferred_choices']); - $this->assertEquals([2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['choices']); + $this->assertArrayHasKey(2, $field->createView()->vars['choices']); + $this->assertEquals(new ChoiceView($entity2, '2', 'Bar'), $field->createView()->vars['choices'][2]); } public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier() diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index c0f4b782b64a9..7afcbeedc768d 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -11,7 +11,7 @@ */ // Please update when phpunit needs to be reinstalled with fresh deps: -// Cache-Id-Version: 2019-06-26 11:00 UTC +// Cache-Id-Version: 2019-07-04 18:00 UTC error_reporting(-1); @@ -94,8 +94,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ } $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); + $q = '\\' === DIRECTORY_SEPARATOR ? '"' : ''; // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $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("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", array(), $p, getcwd())); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php index 183cd820c3d02..5763345afd8bd 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php @@ -404,7 +404,6 @@ public function testSingleChoiceWithPreferred() /following-sibling::option[@disabled="disabled"][not(@selected)][.="-- sep --"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=3] ' ); } @@ -427,7 +426,6 @@ public function testSingleChoiceWithPreferredAndNoSeparator() ./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=2] ' ); } @@ -451,7 +449,6 @@ public function testSingleChoiceWithPreferredAndBlankSeparator() /following-sibling::option[@disabled="disabled"][not(@selected)][.=""] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=3] ' ); } @@ -468,7 +465,6 @@ public function testChoiceWithOnlyPreferred() $this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']], '/select [@class="my&class form-control"] - [count(./option)=2] ' ); } diff --git a/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php b/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php index cd6084c5e3bce..4a520ba56f46b 100644 --- a/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php +++ b/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php @@ -52,6 +52,7 @@ private function compileContainer(ContainerBuilder $container) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index cc1b858abb337..fe0d60b5554ff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -52,6 +52,9 @@ protected function listBundles($output) } } + /** + * @return ExtensionInterface + */ protected function findExtension($name) { $bundles = $this->initializeBundles(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index eb4f8e4f6dc47..2143e885c7caa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -194,6 +194,7 @@ protected function getContainerBuilder() $buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel)); $container = $buildContainer(); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } else { (new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump')); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 52c7706456c9f..52369bbffaa99 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -470,6 +470,12 @@ private function addSessionSection(ArrayNodeDefinition $rootNode) $rootNode ->children() ->arrayNode('session') + ->validate() + ->ifTrue(function ($v) { + return empty($v['handler_id']) && !empty($v['save_path']); + }) + ->thenInvalid('Session save path is ignored without a handler service') + ->end() ->info('session configuration') ->canBeEnabled() ->children() @@ -498,7 +504,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode) ->defaultTrue() ->setDeprecated('The "%path%.%node%" option is enabled by default and deprecated since Symfony 3.4. It will be always enabled in 4.0.') ->end() - ->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end() + ->scalarNode('save_path')->end() ->integerNode('metadata_update_threshold') ->defaultValue('0') ->info('seconds to wait between 2 session metadata updates') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4e792ded2e08d..8243ac65fd864 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -233,6 +233,10 @@ public function load(array $configs, ContainerBuilder $container) } if ($this->isConfigEnabled($container, $config['session'])) { + if (!\extension_loaded('session')) { + throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://www.php.net/session.installation for instructions.'); + } + $this->sessionConfigEnabled = true; $this->registerSessionConfiguration($config['session'], $container, $loader); } @@ -873,6 +877,11 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c // session handler (the internal callback registered with PHP session management) if (null === $config['handler_id']) { + // If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored + if (isset($config['save_path'])) { + throw new LogicException('Session save path is ignored without a handler service'); + } + // Set the handler class to be null $container->getDefinition('session.storage.native')->replaceArgument(1, null); $container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null); @@ -880,6 +889,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c $container->setAlias('session.handler', $config['handler_id'])->setPrivate(true); } + if (!isset($config['save_path'])) { + $config['save_path'] = ini_get('session.save_path'); + } + $container->setParameter('session.save_path', $config['save_path']); if (\PHP_VERSION_ID < 70000) { @@ -1706,7 +1719,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con if (!$container->getParameter('kernel.debug')) { $propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']); - $propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + $propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']); $propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']); } else { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 36db49a497982..a7aaaec7c0785 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ - + 0 @@ -39,7 +39,7 @@ - + 0 @@ -50,7 +50,7 @@ - + @@ -61,7 +61,7 @@ - + 0 @@ -72,14 +72,14 @@ - + 0 - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index 24df7d50597d7..9f1da6a83cb39 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -9,6 +9,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index 8b92053b362e5..8a4265eea1d2b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -23,7 +23,7 @@ - + %validator.translation_domain% diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php index ba253d1d1f511..3ff7daac5e608 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php @@ -12,10 +12,10 @@ namespace Symfony\Bundle\FrameworkBundle\Tests; use Symfony\Bundle\FrameworkBundle\Client; -use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase; +use Symfony\Bundle\FrameworkBundle\Tests\Functional\AbstractWebTestCase; use Symfony\Component\HttpFoundation\Response; -class ClientTest extends WebTestCase +class ClientTest extends AbstractWebTestCase { public function testRebootKernelBetweenRequests() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php index 17cbf62d0b5b0..3681ca2047c1b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php @@ -16,7 +16,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\HttpKernel\Bundle\Bundle; /** * @group legacy @@ -123,7 +122,3 @@ public function testProcessPrivateServicesWithSameCommand() class MyCommand extends Command { } - -class ExtensionPresentBundle extends Bundle -{ -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php index 95423c2601b97..b5e3c9f241cfb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @@ -16,7 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Form\AbstractType; /** * @group legacy @@ -214,11 +213,3 @@ public function privateTaggedServicesProvider() ]; } } - -class FormPassTest_Type1 extends AbstractType -{ -} - -class FormPassTest_Type2 extends AbstractType -{ -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 91764a642e8de..b1dea4cba4b01 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -378,7 +378,6 @@ protected static function getBundleDefaultConfig() 'handler_id' => 'session.handler.native_file', 'cookie_httponly' => true, 'gc_probability' => 1, - 'save_path' => '%kernel.cache_dir%/sessions', 'metadata_update_threshold' => '0', 'use_strict_mode' => true, ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php new file mode 100644 index 0000000000000..89841bca43d51 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php @@ -0,0 +1,8 @@ +loadFromExtension('framework', [ + 'session' => [ + 'handler_id' => null, + 'save_path' => '/some/path', + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml new file mode 100644 index 0000000000000..a9ddd8016b879 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml new file mode 100644 index 0000000000000..174ebe586947e --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml @@ -0,0 +1,4 @@ +framework: + session: + handler_id: null + save_path: /some/path diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 51b4ff1524267..ef074bd163a1c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -19,7 +19,6 @@ use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\ApcuAdapter; use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\Adapter\ChainAdapter; use Symfony\Component\Cache\Adapter\DoctrineAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; @@ -474,6 +473,14 @@ public function testNullSessionHandler() $this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0)); } + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testNullSessionHandlerWithSavePath() + { + $this->createContainerFromFile('session_savepath'); + } + public function testRequest() { $container = $this->createContainerFromFile('full'); @@ -667,7 +674,7 @@ public function testValidation() $this->assertSame('setConstraintValidatorFactory', $calls[0][0]); $this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]); $this->assertSame('setTranslator', $calls[1][0]); - $this->assertEquals([new Reference('translator')], $calls[1][1]); + $this->assertEquals([new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)], $calls[1][1]); $this->assertSame('setTranslationDomain', $calls[2][0]); $this->assertSame(['%validator.translation_domain%'], $calls[2][1]); $this->assertSame('addXmlMappings', $calls[3][0]); @@ -1163,6 +1170,7 @@ protected function createContainerFromFile($file, $data = [], $resetCompilerPass if ($resetCompilerPasses) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); } $container->getCompilerPassConfig()->setBeforeRemovingPasses([new AddConstraintValidatorsPass(), new TranslatorPass('translator.default', 'translation.reader')]); $container->getCompilerPassConfig()->setAfterRemovingPasses([new AddAnnotationsCachedReaderPass()]); @@ -1184,6 +1192,7 @@ protected function createContainerFromClosure($closure, $data = []) $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); return $container; @@ -1244,10 +1253,6 @@ private function assertCachePoolServiceDefinitionIsCreated(ContainerBuilder $con $this->assertSame(DoctrineAdapter::class, $parentDefinition->getClass()); break; case 'cache.app': - if (ChainAdapter::class === $parentDefinition->getClass()) { - break; - } - // no break case 'cache.adapter.filesystem': $this->assertSame(FilesystemAdapter::class, $parentDefinition->getClass()); break; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php similarity index 97% rename from src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php rename to src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php index 00eda6570906d..03c6bdcbd7e11 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php @@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; -class WebTestCase extends BaseWebTestCase +abstract class AbstractWebTestCase extends BaseWebTestCase { public static function assertRedirect($response, $location) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php index 51a3e7ee54247..c9ede7a9cf646 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class AnnotatedControllerTest extends WebTestCase +class AnnotatedControllerTest extends AbstractWebTestCase { /** * @dataProvider getRoutes diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php index 1db447ac64d68..95fb5f938f0e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php @@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface; -class AutowiringTypesTest extends WebTestCase +class AutowiringTypesTest extends AbstractWebTestCase { public function testAnnotationReaderAutowiring() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php index e3fd2dc4ab346..e30a0e1eeafb1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php @@ -18,7 +18,7 @@ /** * @group functional */ -class CachePoolClearCommandTest extends WebTestCase +class CachePoolClearCommandTest extends AbstractWebTestCase { protected function setUp() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index 2a6d43a9f806e..ebf6561a6156d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Exception\InvalidArgumentException; -class CachePoolsTest extends WebTestCase +class CachePoolsTest extends AbstractWebTestCase { public function testCachePools() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php index 2c0a75481b390..c10750eaa9352 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php @@ -19,7 +19,7 @@ /** * @group functional */ -class ConfigDebugCommandTest extends WebTestCase +class ConfigDebugCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php index a4cfd6cfa9b7d..b8ac6645f6fac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php @@ -19,7 +19,7 @@ /** * @group functional */ -class ConfigDumpReferenceCommandTest extends WebTestCase +class ConfigDumpReferenceCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index bfec01aefc876..21f33df0c8a22 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class ContainerDebugCommandTest extends WebTestCase +class ContainerDebugCommandTest extends AbstractWebTestCase { public function testDumpContainerIfNotExists() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php index 7c3128dc5c07d..ad2a3662c3cdd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php @@ -14,7 +14,7 @@ /** * Checks that the container compiles correctly when all the bundle features are enabled. */ -class ContainerDumpTest extends WebTestCase +class ContainerDumpTest extends AbstractWebTestCase { public function testContainerCompilationInDebug() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index 7e41d3298d9c2..8e55eb5d84599 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class DebugAutowiringCommandTest extends WebTestCase +class DebugAutowiringCommandTest extends AbstractWebTestCase { public function testBasicFunctionality() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php index db550a23129ba..3e7472af999a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class FragmentTest extends WebTestCase +class FragmentTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php index 2768b59a1c3f5..ec3c47e76205c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class ProfilerTest extends WebTestCase +class ProfilerTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php index 832b45b818f76..23a9cf18d0384 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -13,7 +13,7 @@ use Symfony\Component\PropertyInfo\Type; -class PropertyInfoTest extends WebTestCase +class PropertyInfoTest extends AbstractWebTestCase { public function testPhpDocPriority() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php index c2c53ef7b0dc6..c1159ff5669d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php @@ -14,7 +14,7 @@ /** * @author Kévin Dunglas */ -class SerializerTest extends WebTestCase +class SerializerTest extends AbstractWebTestCase { public function testDeserializeArrayOfObject() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php index bf1b76cdc743c..0fa8a09b4b229 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class SessionTest extends WebTestCase +class SessionTest extends AbstractWebTestCase { /** * Tests session attributes persist. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php index 9d040581db50f..d32b6b7b121c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class SubRequestsTest extends WebTestCase +class SubRequestsTest extends AbstractWebTestCase { public function testStateAfterSubRequest() { diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 78d7ae1e564e7..40cff711ae8ad 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -22,6 +22,7 @@ "symfony/class-loader": "~3.2", "symfony/dependency-injection": "^3.4.24|^4.2.5", "symfony/config": "~3.4|~4.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/event-dispatcher": "~3.4|~4.0", "symfony/http-foundation": "^3.3.11|~4.0", "symfony/http-kernel": "~3.4|~4.0", diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 2db17aa130c39..8d9ac136b0c42 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -28,6 +28,8 @@ use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder; +use Symfony\Component\Templating\Helper\Helper; +use Twig\Extension\AbstractExtension; /** * SecurityExtension. @@ -69,8 +71,18 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('security.xml'); $loader->load('security_listeners.xml'); $loader->load('security_rememberme.xml'); - $loader->load('templating_php.xml'); - $loader->load('templating_twig.xml'); + + if (class_exists(Helper::class)) { + $loader->load('templating_php.xml'); + + $container->getDefinition('templating.helper.logout_url')->setPrivate(true); + $container->getDefinition('templating.helper.security')->setPrivate(true); + } + + if (class_exists(AbstractExtension::class)) { + $loader->load('templating_twig.xml'); + } + $loader->load('collectors.xml'); $loader->load('guard.xml'); @@ -79,8 +91,6 @@ public function load(array $configs, ContainerBuilder $container) $container->getDefinition('security.firewall.context')->setPrivate(true); $container->getDefinition('security.validator.user_password')->setPrivate(true); $container->getDefinition('security.rememberme.response_listener')->setPrivate(true); - $container->getDefinition('templating.helper.logout_url')->setPrivate(true); - $container->getDefinition('templating.helper.security')->setPrivate(true); $container->getAlias('security.encoder_factory')->setPrivate(true); if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 951b61dd9f3ac..c31fe9de20f61 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -617,6 +617,7 @@ protected function getContainer($file) $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); return $container; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php index 3e1541a0e56e6..45ec00448f82d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php @@ -1,6 +1,6 @@ load('merge_import.php', $container); +$this->load('merge_import.php'); $container->loadFromExtension('security', [ 'providers' => [ diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php index 8372e34c0eb9a..59f2ff037a385 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php @@ -321,6 +321,7 @@ protected function getRawContainer() $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); return $container; } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php similarity index 97% rename from src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php rename to src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php index 9bcbc0532481d..72a67a9a48763 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php @@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; -class WebTestCase extends BaseWebTestCase +class AbstractWebTestCase extends BaseWebTestCase { public static function assertRedirect($response, $location) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php index 2a31f2a27a5f2..dcfd6f29e8fea 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class AuthenticationCommencingTest extends WebTestCase +class AuthenticationCommencingTest extends AbstractWebTestCase { public function testAuthenticationIsCommencingIfAccessDeniedExceptionIsWrapped() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php index 95b86985cb6e7..1e4b14a61b9fb 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; -class AutowiringTypesTest extends WebTestCase +class AutowiringTypesTest extends AbstractWebTestCase { public function testAccessDecisionManagerAutowiring() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php index 98b52a5f05058..a701c8e4ea1b0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class CsrfFormLoginTest extends WebTestCase +class CsrfFormLoginTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php index 8afedc42e44d3..77011409cfaa4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php @@ -13,7 +13,7 @@ use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub; -class FirewallEntryPointTest extends WebTestCase +class FirewallEntryPointTest extends AbstractWebTestCase { public function testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php index ec1722188af25..af932a3ce42b3 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class FormLoginTest extends WebTestCase +class FormLoginTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php index c7e9e2aab71b1..2859693a17c28 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php @@ -16,7 +16,7 @@ /** * @author Kévin Dunglas */ -class JsonLoginTest extends WebTestCase +class JsonLoginTest extends AbstractWebTestCase { public function testDefaultJsonLoginSuccess() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php index c874ada34a4e3..2a45fc00de38f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class LocalizedRoutesAsPathTest extends WebTestCase +class LocalizedRoutesAsPathTest extends AbstractWebTestCase { /** * @dataProvider getLocales diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php index 31ff6d1bbc7da..7167b062da7ca 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class LogoutTest extends WebTestCase +class LogoutTest extends AbstractWebTestCase { public function testSessionLessRememberMeLogout() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php index 0d2d6da0cfc51..590c871569c3a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class SecurityRoutingIntegrationTest extends WebTestCase +class SecurityRoutingIntegrationTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php index ff687d0792716..eb83e75d8cc64 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\User\User; -class SecurityTest extends WebTestCase +class SecurityTest extends AbstractWebTestCase { public function testServiceIsFunctional() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php index 2035868e16ca4..5346e9b4c0be7 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php @@ -35,7 +35,7 @@ * @requires extension pdo_sqlite * @group legacy */ -class SetAclCommandTest extends WebTestCase +class SetAclCommandTest extends AbstractWebTestCase { const OBJECT_CLASS = 'Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AclBundle\Entity\Car'; const SECURITY_CLASS = 'Symfony\Component\Security\Core\User\User'; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php index ddbfd629c8fb7..31f99da2a08f2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Http\Firewall\SwitchUserListener; -class SwitchUserTest extends WebTestCase +class SwitchUserTest extends AbstractWebTestCase { /** * @dataProvider getTestParameters diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php index c8f8013f3f8a0..3533f554baa1e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -25,7 +25,7 @@ * * @author Sarah Khalil */ -class UserPasswordEncoderCommandTest extends WebTestCase +class UserPasswordEncoderCommandTest extends AbstractWebTestCase { /** @var CommandTester */ private $passwordEncoderCommandTester; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php index 90f31f0b31902..539f585b2658f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php @@ -91,11 +91,3 @@ public function testIntegrationNoUser() $this->assertSame([null], $argumentResolver->getArguments(Request::create('/'), function (UserInterface $user = null) {})); } } - -abstract class DummyUser implements UserInterface -{ -} - -abstract class DummySubUser extends DummyUser -{ -} diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index a079dbd11bc7c..000cad7f930d2 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -266,6 +266,7 @@ public function testRuntimeLoader() $container->register('foo', '%foo%')->addTag('twig.runtime'); $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); $loader = $container->getDefinition('twig.runtime_loader'); @@ -327,6 +328,7 @@ private function compileContainer(ContainerBuilder $container) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 5d27f06ff92be..4cc08e1b35b27 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -18,6 +18,7 @@ "require": { "php": "^5.5.9|>=7.0.8", "symfony/config": "~3.2|~4.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/twig-bridge": "^3.4.3|^4.0.3", "symfony/http-foundation": "~2.8|~3.0|~4.0", "symfony/http-kernel": "^3.3|~4.0", diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index 4ae1afcf8324f..d5b0f5e66b6c8 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -60,7 +60,7 @@ public function showAction($token) $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException(); $template = $this->getTemplate(); - if (!$this->twig->getLoader()->exists($template)) { + if (!$this->templateExists($template)) { $handler = new ExceptionHandler($this->debug, $this->twig->getCharset(), $this->fileLinkFormat); return new Response($handler->getContent($exception), 200, ['Content-Type' => 'text/html']); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 720da85750526..c7b99d2e4263c 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -646,7 +646,7 @@ {% else %}
-

No options where passed when constructing this form.

+

No options were passed when constructing this form.

{% endif %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 8953316de06f2..4012625e85d15 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -54,6 +54,7 @@ text-align: left; text-transform: none; z-index: 99999; + direction: ltr; /* neutralize the aliasing defined by external CSS styles */ -webkit-font-smoothing: subpixel-antialiased; diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index ac310819d4199..2afa629cdae46 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -141,7 +141,7 @@ public function setPerformDeepMerging($boolean) } /** - * Whether extra keys should just be ignore without an exception. + * Whether extra keys should just be ignored without an exception. * * @param bool $boolean To allow extra keys * @param bool $remove To remove extra keys diff --git a/src/Symfony/Component/Config/Resource/ComposerResource.php b/src/Symfony/Component/Config/Resource/ComposerResource.php index c826d1bb75127..9fb304bea8f06 100644 --- a/src/Symfony/Component/Config/Resource/ComposerResource.php +++ b/src/Symfony/Component/Config/Resource/ComposerResource.php @@ -48,7 +48,7 @@ public function isFresh($timestamp) { self::refresh(); - return self::$runtimeVendors === $this->vendors; + return array_values(self::$runtimeVendors) === array_values($this->vendors); } /** diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index a86a37ed8dcbd..f05042f8d32fa 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -140,7 +140,7 @@ private function generateSignature(\ReflectionClass $class) foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { yield $p->getDocComment().$p; - yield print_r($defaults[$p->name], true); + yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true); } } diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index 23f2cc567c4cd..1f0bcb17b4f5e 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -137,6 +137,14 @@ public function provideHashedSignature() yield [1, 13, 'protected function prot($a = [123]) {}']; yield [0, 14, '/** priv docblock */']; yield [0, 15, '']; + + if (\PHP_VERSION_ID >= 70400) { + // PHP7.4 typed properties without default value are + // undefined, make sure this doesn't throw an error + yield [1, 5, 'public array $pub;']; + yield [0, 7, 'protected int $prot;']; + yield [0, 9, 'private string $priv;']; + } } public function testEventSubscriber() diff --git a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php index 9462996f6d2af..ca1029cb60042 100644 --- a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php +++ b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Symfony\Component\Console\Command\Command; diff --git a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php index 753ad0fb705c2..8000c7d5eca82 100644 --- a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Psr\Container\ContainerInterface; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index b27439a761355..477bd87f0c4aa 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -75,11 +75,7 @@ public function __construct($foreground = null, $background = null, array $optio } /** - * Sets style foreground color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setForeground($color = null) { @@ -97,11 +93,7 @@ public function setForeground($color = null) } /** - * Sets style background color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setBackground($color = null) { @@ -119,11 +111,7 @@ public function setBackground($color = null) } /** - * Sets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function setOption($option) { @@ -137,11 +125,7 @@ public function setOption($option) } /** - * Unsets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function unsetOption($option) { @@ -168,11 +152,7 @@ public function setOptions(array $options) } /** - * Applies the style to a given text. - * - * @param string $text The text to style - * - * @return string + * {@inheritdoc} */ public function apply($text) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index 4c7dc4134d723..af171c27020c9 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -21,7 +21,7 @@ interface OutputFormatterStyleInterface /** * Sets style foreground color. * - * @param string $color The color name + * @param string|null $color The color name */ public function setForeground($color = null); diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index 5cb5056903e43..3dca160049338 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -134,17 +134,15 @@ private function getDefaultValidator() $isAssoc = $this->isAssoc($choices); return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { - // Collapse all spaces. - $selectedChoices = str_replace(' ', '', $selected); - if ($multiselect) { // Check for a separated comma values - if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { + if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selected, $matches)) { throw new InvalidArgumentException(sprintf($errorMessage, $selected)); } - $selectedChoices = explode(',', $selectedChoices); + + $selectedChoices = array_map('trim', explode(',', $selected)); } else { - $selectedChoices = [$selected]; + $selectedChoices = [trim($selected)]; } $multiselectChoices = []; diff --git a/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php new file mode 100644 index 0000000000000..5ec7a9cacb4de --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Question; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Question\ChoiceQuestion; + +class ChoiceQuestionTest extends TestCase +{ + /** + * @dataProvider selectUseCases + */ + public function testSelectUseCases($multiSelect, $answers, $expected, $message) + { + $question = new ChoiceQuestion('A question', [ + 'First response', + 'Second response', + 'Third response', + 'Fourth response', + ]); + + $question->setMultiselect($multiSelect); + + foreach ($answers as $answer) { + $validator = $question->getValidator(); + $actual = $validator($answer); + + $this->assertEquals($actual, $expected, $message); + } + } + + public function selectUseCases() + { + return [ + [ + false, + ['First response', 'First response ', ' First response', ' First response '], + 'First response', + 'When passed single answer on singleSelect, the defaultValidator must return this answer as a string', + ], + [ + true, + ['First response', 'First response ', ' First response', ' First response '], + ['First response'], + 'When passed single answer on MultiSelect, the defaultValidator must return this answer as an array', + ], + [ + true, + ['First response,Second response', ' First response , Second response '], + ['First response', 'Second response'], + 'When passed multiple answers on MultiSelect, the defaultValidator must return these answers as an array', + ], + ]; + } +} diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 9ceac9af162b0..13ab9e700c743 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -149,11 +149,11 @@ public function loadClass($class) if (!$file = $this->classLoader[0]->findFile($class) ?: false) { // no-op } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) { - require $file; + include $file; return; - } else { - require $file; + } elseif (false === include $file) { + return; } } else { \call_user_func($this->classLoader, $class); diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index bb82c63328b19..bb7fe413abe63 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -70,8 +70,8 @@ public function testRegister() public function testErrorGetLast() { - $handler = ErrorHandler::register(); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger); $handler->screamAt(E_ALL); @@ -143,9 +143,8 @@ public function testConstruct() public function testDefaultLogger() { try { - $handler = ErrorHandler::register(); - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger, E_NOTICE); $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]); @@ -334,12 +333,11 @@ public function testHandleDeprecation() public function testHandleException() { try { + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); $exception = new \Exception('foo'); - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logArgCheck = function ($level, $message, $context) { $this->assertSame('Uncaught Exception: foo', $message); $this->assertArrayHasKey('exception', $context); @@ -483,6 +481,7 @@ public function testSettingLoggerWhenExceptionIsBuffered() public function testHandleFatalError() { try { + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); $error = [ @@ -492,8 +491,6 @@ public function testHandleFatalError() 'line' => 123, ]; - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logArgCheck = function ($level, $message, $context) { $this->assertEquals('Fatal Parse Error: foo', $message); $this->assertArrayHasKey('exception', $context); diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index e166136cbbed4..8a196649503c3 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -76,7 +76,7 @@ public function testHeaders() ob_start(); $handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST'])); - $response = ob_get_clean(); + ob_get_clean(); $expectedHeaders = [ ['HTTP/1.0 405', true, null], @@ -99,35 +99,65 @@ public function testNestedExceptions() public function testHandle() { - $exception = new \Exception('foo'); + $handler = new ExceptionHandler(true); + ob_start(); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); - $handler - ->expects($this->exactly(2)) - ->method('sendPhpResponse'); + $handler->handle(new \Exception('foo')); - $handler->handle($exception); + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'foo'); + } - $handler->setHandler(function ($e) use ($exception) { - $this->assertSame($exception, $e); + public function testHandleWithACustomHandlerThatOutputsSomething() + { + $handler = new ExceptionHandler(true); + ob_start(); + $handler->setHandler(function () { + echo 'ccc'; }); - $handler->handle($exception); + $handler->handle(new \Exception()); + ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/bug.php?id=76563 + $this->assertSame('ccc', ob_get_clean()); } - public function testHandleOutOfMemoryException() + public function testHandleWithACustomHandlerThatOutputsNothing() + { + $handler = new ExceptionHandler(true); + $handler->setHandler(function () {}); + + $handler->handle(new \Exception('ccc')); + + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc'); + } + + public function testHandleWithACustomHandlerThatFails() { - $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); + $handler = new ExceptionHandler(true); + $handler->setHandler(function () { + throw new \RuntimeException(); + }); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); - $handler - ->expects($this->once()) - ->method('sendPhpResponse'); + $handler->handle(new \Exception('ccc')); - $handler->setHandler(function ($e) { + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc'); + } + + public function testHandleOutOfMemoryException() + { + $handler = new ExceptionHandler(true); + ob_start(); + $handler->setHandler(function () { $this->fail('OutOfMemoryException should bypass the handler'); }); - $handler->handle($exception); + $handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__)); + + $this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryException::class, 'OutOfMemoryException', 'foo'); + } + + private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage) + { + $this->assertContains(sprintf('%s', $expectedClass, $expectedTitle), $content); + $this->assertContains(sprintf('

%s

', $expectedMessage), $content); } } diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 8e615ac640be9..9a56b3b4ec8fc 100644 --- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -61,7 +61,7 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader } $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception); - $this->assertSame($translatedMessage, $exception->getMessage()); + $this->assertRegExp($translatedMessage, $exception->getMessage()); $this->assertSame($error['type'], $exception->getSeverity()); $this->assertSame($error['file'], $exception->getFile()); $this->assertSame($error['line'], $exception->getLine()); @@ -71,6 +71,7 @@ public function provideClassNotFoundData() { $autoloader = new ComposerClassLoader(); $autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception')); + $autoloader->add('Symfony_Component_Debug_Tests_Fixtures', realpath(__DIR__.'/../../Tests/Fixtures')); $debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']); @@ -82,7 +83,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'WhizBangFactory\' not found', ], - "Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?", + "/^Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement\?$/", ], [ [ @@ -91,7 +92,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found', ], - "Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", + "/^Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for another namespace\?$/", ], [ [ @@ -100,7 +101,8 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ @@ -109,7 +111,8 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'PEARClass\' not found', ], - "Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?", + "/^Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ @@ -118,7 +121,8 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ @@ -127,7 +131,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", [$autoloader, 'loadClass'], ], [ @@ -137,7 +141,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?/", [$debugClassLoader, 'loadClass'], ], [ @@ -147,7 +151,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for another namespace\?$/", function ($className) { /* do nothing here */ }, ], ]; diff --git a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php b/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php deleted file mode 100644 index 2d6ce564d23a4..0000000000000 --- a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Symfony\Component\Debug\ExceptionHandler; - -class MockExceptionHandler extends ExceptionHandler -{ - public $e; - - public function handle(\Exception $e) - { - $this->e = $e; - } -} diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index 63f8013c313fb..caa1fd2251672 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -186,6 +186,10 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs $bag = $this->getParameterBag(); $value = $bag->resolveValue($value); + if (!$bag instanceof EnvPlaceholderParameterBag) { + return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); + } + foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { if (false === strpos($env, ':')) { continue; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php index 6abd6c86af703..50140b5fffd67 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -81,7 +81,7 @@ public function getId() /** * Returns the in edges. * - * @return array The in ServiceReferenceGraphEdge array + * @return ServiceReferenceGraphEdge[] */ public function getInEdges() { @@ -91,7 +91,7 @@ public function getInEdges() /** * Returns the out edges. * - * @return array The out ServiceReferenceGraphEdge array + * @return ServiceReferenceGraphEdge[] */ public function getOutEdges() { diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index e385f0689896e..f2215acf1ca04 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -386,7 +386,7 @@ public function reset() /** * Gets all service ids. * - * @return array An array of all defined service ids + * @return string[] An array of all defined service ids */ public function getServiceIds() { @@ -405,7 +405,7 @@ public function getServiceIds() } $ids[] = 'service_container'; - return array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services))); + return array_map('strval', array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services)))); } /** diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c322b4357ad20..73145fd8dfaec 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -815,13 +815,11 @@ public function compile(/*$resolveEnvPlaceholders = false*/) } /** - * Gets all service ids. - * - * @return array An array of all defined service ids + * {@inheritdoc} */ public function getServiceIds() { - return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())); + return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()))); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index b3bea30b749b9..46074a67a5937 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -38,6 +38,7 @@ use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\ExpressionLanguage\Expression; @@ -1532,6 +1533,20 @@ public function testDecoratedSelfReferenceInvolvingPrivateServices() $this->assertSame(['service_container'], array_keys($container->getDefinitions())); } + + public function testScalarService() + { + $c = new ContainerBuilder(); + $c->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $c->compile(); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } } class FooClass diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index d2616a34ba6b4..5dbec886e6fb3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -386,6 +386,16 @@ public function testLegacyHas() $this->assertTrue($sc->has('foo\\baz'), '->has() returns true if a get*Method() is defined'); } + public function testScalarService() + { + $c = new Container(); + + $c->set('foo', 'some value'); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } + public function testInitialized() { $sc = new ProjectServiceContainer(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index a1ccb52b60329..926933bb0e410 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -30,6 +30,7 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; use Symfony\Component\DependencyInjection\TypedReference; @@ -1115,6 +1116,25 @@ public function testReferenceWithLowerCaseId() $this->assertEquals((object) ['foo' => (object) []], $container->get('Bar')); } + + public function testScalarService() + { + $container = new ContainerBuilder(); + $container->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Scalar_Service'])); + + $container = new \Symfony_DI_PhpDumper_Test_Scalar_Service(); + + $this->assertTrue($container->has('foo')); + $this->assertSame('some value', $container->get('foo')); + } } class Rot13EnvVarProcessor implements EnvVarProcessorInterface diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php deleted file mode 100644 index ee6498c9d50c5..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php +++ /dev/null @@ -1,8 +0,0 @@ -propertyPath; } - if (null === $this->name || '' === $this->name) { + if ('' === $this->name) { return null; } diff --git a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf index 468d2f6fdd8dd..1c784c24a0e2d 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf @@ -4,15 +4,15 @@ This form should not contain extra fields. - این فرم نباید فیلد اضافی داشته باشد. + این فرم نباید شامل فیلد اضافه ای باشد. The uploaded file was too large. Please try to upload a smaller file. - فایل بارگذاری شده بسیار بزرگ است. لطفا فایل کوچکتری را بارگزاری کنید. + فایل بارگذاری شده بسیار بزرگ می باشد. لطفا فایل کوچکتری را بارگذاری نمایید. The CSRF token is invalid. Please try to resubmit the form. - مقدار CSRF نامعتبر است. لطفا فرم را مجددا ارسال فرمایید.. + توکن CSRF نامعتبر می باشد. لطفا فرم را مجددا ارسال نمایید. diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php index a23607412cc8d..1e756ac5cfe22 100644 --- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php +++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php @@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Command\DebugCommand; use Symfony\Component\Form\DependencyInjection\FormPass; use Symfony\Component\Form\FormRegistry; @@ -272,11 +271,3 @@ private function createContainerBuilder() return $container; } } - -class FormPassTest_Type1 extends AbstractType -{ -} - -class FormPassTest_Type2 extends AbstractType -{ -} diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ea3f460c4692b..7185d75e92209 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1037,8 +1037,8 @@ public function getPort() $pos = strrpos($host, ':'); } - if (false !== $pos) { - return (int) substr($host, $pos + 1); + if (false !== $pos && $port = substr($host, $pos + 1)) { + return (int) $port; } return 'https' === $this->getScheme() ? 443 : 80; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 3b5ccaa835952..ddedacffbce4e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -17,7 +17,7 @@ * @author Markus Bachmann * * @see https://packagist.org/packages/mongodb/mongodb - * @see http://php.net/manual/en/set.mongodb.php + * @see https://php.net/mongodb */ class MongoDbSessionHandler extends AbstractSessionHandler { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php index 4e9704bd5858f..04bcbbfe320b3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -23,7 +23,7 @@ class NativeFileSessionHandler extends NativeSessionHandler * Default null will leave setting as defined by PHP. * '/path', 'N;/path', or 'N;octal-mode;/path * - * @see http://php.net/session.configuration.php#ini.session.save-path for further details. + * @see https://php.net/manual/session.configuration.php#ini.session.save-path for further details. * * @throws \InvalidArgumentException On invalid $savePath * @throws \RuntimeException When failing to create the save directory diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index c4dbe75868226..809d7002cf1cb 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -100,6 +100,10 @@ class NativeSessionStorage implements SessionStorageInterface */ public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null) { + if (!\extension_loaded('session')) { + throw new \LogicException('PHP extension "session" is required.'); + } + $options += [ 'cache_limiter' => '', 'cache_expire' => 0, diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index 662ed5015adec..8969e609aaf95 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -24,6 +24,10 @@ class PhpBridgeSessionStorage extends NativeSessionStorage */ public function __construct($handler = null, MetadataBag $metaBag = null) { + if (!\extension_loaded('session')) { + throw new \LogicException('PHP extension "session" is required.'); + } + $this->setMetadataBag($metaBag); $this->setSaveHandler($handler); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index d266e1f68a4cc..73d12cb3f74f4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -2427,6 +2427,18 @@ public function testTrustedPort() $this->assertSame(443, $request->getPort()); } + + public function testTrustedPortDoesNotDefaultToZero() + { + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('X-Forwarded-Host', 'test.example.com'); + $request->headers->set('X-Forwarded-Port', ''); + + $this->assertSame(80, $request->getPort()); + } } class RequestContentProxy extends Request diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index fe6bc027ac926..40200ee31d0de 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -1001,14 +1001,3 @@ public function __toString() class DefaultResponse extends Response { } - -class ExtendedResponse extends Response -{ - public function setLastModified(\DateTime $date = null) - { - } - - public function getDate() - { - } -} diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 21d03f4ba5867..90ef0c537b5a6 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.29'; - const VERSION_ID = 30429; + const VERSION = '3.4.30'; + const VERSION_ID = 30430; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 29; + const RELEASE_VERSION = 30; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php index 60ad1b89c4dfb..c66732a37ccd3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -25,7 +25,7 @@ class TraceableEventDispatcherTest extends TestCase public function testStopwatchSections() { $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch = new Stopwatch()); - $kernel = $this->getHttpKernel($dispatcher, function () { return new Response(); }); + $kernel = $this->getHttpKernel($dispatcher, function () { return new Response('', 200, ['X-Debug-Token' => '292e1e']); }); $request = Request::create('/'); $response = $kernel->handle($request); $kernel->terminate($request, $response); diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php deleted file mode 100644 index b43bc665a843e..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.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\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; - -class ExtensionLoadedExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - } -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php deleted file mode 100644 index 3af81cb07396d..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionLoadedBundle extends Bundle -{ -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php deleted file mode 100644 index 977976b75f88b..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php +++ /dev/null @@ -1,17 +0,0 @@ -notImplemented(parent::parseQuarterProvider()); } + public function testParseThreeDigitsYears() + { + if (PHP_INT_SIZE < 8) { + $this->markTestSkipped('Parsing three digits years requires a 64bit PHP.'); + } + + $formatter = $this->getDefaultDateFormatter('yyyy-M-d'); + $this->assertSame(-32157648000, $formatter->parse('950-12-19')); + $this->assertIsIntlSuccess($formatter, 'U_ZERO_ERROR', IntlGlobals::U_ZERO_ERROR); + } + protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) { return new IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern); diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index b91d1e62ebb95..f23239193e1ea 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -165,25 +165,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound() public function testIsWritableReturnsTrueIfAdderAndRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_Car')->getMock(); + $car = new PropertyAccessorCollectionTest_Car(); $this->assertTrue($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyAdderExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarOnlyAdder')->getMock(); + $car = new PropertyAccessorCollectionTest_CarOnlyAdder(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarOnlyRemover')->getMock(); + $car = new PropertyAccessorCollectionTest_CarOnlyRemover(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock(); + $car = new PropertyAccessorCollectionTest_CarNoAdderAndRemover(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } @@ -193,7 +193,7 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists() */ public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable() { - $car = $this->getMockBuilder(__CLASS__.'_Car')->getMock(); + $car = new PropertyAccessorCollectionTest_Car(); $this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable'); } diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index dae682bf31028..99738365ad4cf 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -26,7 +26,7 @@ public static function isSupported() return true; } - return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium'); + return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); } /** diff --git a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php index 8c09267d0facc..7bcfc39438dd9 100644 --- a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php @@ -36,8 +36,7 @@ public function supports(Request $request) * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really * care about which authenticated token you're using. * - * @param UserInterface $user - * @param string $providerKey + * @param string $providerKey * * @return PostAuthenticationGuardToken */ diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index 7986b16b4c11f..a9c565b6bb9b2 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -55,9 +55,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio /** * Override to change what happens after successful authentication. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey + * @param string $providerKey * * @return RedirectResponse */ diff --git a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php index 90df7610ad2bb..4912cb3bad594 100644 --- a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php @@ -30,8 +30,6 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface * * If this returns false, the authenticator will be skipped. * - * @param Request $request - * * @return bool */ public function supports(Request $request); @@ -53,8 +51,6 @@ public function supports(Request $request); * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed Any non-null value * * @throws \UnexpectedValueException If null is returned diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 1cdcf6b967ed3..24a16e3f0c523 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -70,10 +70,7 @@ public function authenticateWithToken(TokenInterface $token, Request $request/*, /** * Returns the "on success" response for the given GuardAuthenticator. * - * @param TokenInterface $token - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -93,10 +90,7 @@ public function handleAuthenticationSuccess(TokenInterface $token, Request $requ * Convenience method for authenticating the user and returning the * Response *if any* for success. * - * @param UserInterface $user - * @param Request $request - * @param AuthenticatorInterface $authenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -115,10 +109,7 @@ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $r * Handles an authentication failure and returns the Response for the * GuardAuthenticator. * - * @param AuthenticationException $authenticationException - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The key of the firewall + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php index 3a9828dfd607f..7372eb844a6d0 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php @@ -55,8 +55,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed|null */ public function getCredentials(Request $request); @@ -69,9 +67,6 @@ public function getCredentials(Request $request); * You may throw an AuthenticationException if you wish. If you return * null, then a UsernameNotFoundException is thrown for you. * - * @param mixed $credentials - * @param UserProviderInterface $userProvider - * * @throws AuthenticationException * * @return UserInterface|null @@ -87,9 +82,6 @@ public function getUser($credentials, UserProviderInterface $userProvider); * * The *credentials* are the return value from getCredentials() * - * @param mixed $credentials - * @param UserInterface $user - * * @return bool * * @throws AuthenticationException @@ -105,8 +97,7 @@ public function checkCredentials($credentials, UserInterface $user); * * @see AbstractGuardAuthenticator * - * @param UserInterface $user - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return GuardTokenInterface */ @@ -121,9 +112,6 @@ public function createAuthenticatedToken(UserInterface $user, $providerKey); * If you return null, the request will continue, but the user will * not be authenticated. This is probably not what you want to do. * - * @param Request $request - * @param AuthenticationException $exception - * * @return Response|null */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception); @@ -137,9 +125,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio * If you return null, the current request will continue, and the user * will be authenticated. This makes sense, for example, with an API. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 76e532c4b7a34..71f69503940de 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -35,14 +35,19 @@ public function __construct($bitmask = 0) public function encode($data, $format, array $context = []) { $context = $this->resolveContext($context); + $options = $context['json_encode_options']; - $encodedJson = json_encode($data, $context['json_encode_options']); + try { + $encodedJson = json_encode($data, $options); + } catch (\JsonException $e) { + throw new NotEncodableValueException($e->getMessage(), 0, $e); + } - if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $context['json_encode_options'])) { + if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $options)) { return $encodedJson; } - if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($context['json_encode_options'] & JSON_PARTIAL_OUTPUT_ON_ERROR))) { + if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index f0a4afb191b3a..afbd63e4962af 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -303,7 +303,7 @@ private function parseXmlAttributes(\DOMNode $node, array $context = []) $typeCastAttributes = $this->resolveXmlTypeCastAttributes($context); foreach ($node->attributes as $attr) { - if (!is_numeric($attr->nodeValue) || !$typeCastAttributes) { + if (!is_numeric($attr->nodeValue) || !$typeCastAttributes || (isset($attr->nodeValue[1]) && '0' === $attr->nodeValue[0])) { $data['@'.$attr->nodeName] = $attr->nodeValue; continue; diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 31e27a85cb024..3e7021b130876 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -34,7 +34,7 @@ interface DenormalizableInterface * differently based on different input formats * @param array $context Options for denormalizing * - * @return object + * @return object|object[] */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 7a6a7d3fbca19..573605c1ab092 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -306,6 +306,17 @@ public function testNoTypeCastAttribute() $this->assertSame($expected, $data); } + public function testDoesNotTypeCastStringsStartingWith0() + { + $source = << + +XML; + + $data = $this->encoder->decode($source, 'xml'); + $this->assertSame('018', $data['@a']); + } + public function testEncode() { $source = $this->getXmlSource(); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index d92fad3f80978..d9c6b8e2ca423 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -756,43 +756,6 @@ public function otherMethod() } } -class GetCamelizedDummy -{ - private $kevinDunglas; - private $fooBar; - private $bar_foo; - - public function __construct($kevinDunglas = null) - { - $this->kevinDunglas = $kevinDunglas; - } - - public function getKevinDunglas() - { - return $this->kevinDunglas; - } - - public function setFooBar($fooBar) - { - $this->fooBar = $fooBar; - } - - public function getFooBar() - { - return $this->fooBar; - } - - public function setBar_foo($bar_foo) - { - $this->bar_foo = $bar_foo; - } - - public function getBar_foo() - { - return $this->bar_foo; - } -} - class ObjectConstructorArgsWithPrivateMutatorDummy { private $foo; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index f8d1eb8db8d7f..cfa21b6758a06 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -497,18 +497,6 @@ public function getBar() } } -class PropertyCamelizedDummy -{ - private $kevinDunglas; - public $fooBar; - public $bar_foo; - - public function __construct($kevinDunglas = null) - { - $this->kevinDunglas = $kevinDunglas; - } -} - class StaticPropertyDummy { private static $property = 'value'; diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 74d2b2f4411df..4b249df024ec8 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -111,17 +111,12 @@ protected function loadResource($resource) $ids = ['singular' => $singularId, 'plural' => $pluralId]; $item = compact('ids', 'translated'); - if (\is_array($item['translated'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = $item['ids']['singular']; if (isset($item['ids']['plural'])) { - $plurals = []; - foreach ($item['translated'] as $plural => $translated) { - $plurals[] = sprintf('{%d} %s', $plural, $translated); - } - $messages[$item['ids']['plural']] = stripcslashes(implode('|', $plurals)); + $id .= '|'.$item['ids']['plural']; } - } elseif (!empty($item['ids']['singular'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated']); + $messages[$id] = stripcslashes(implode('|', (array) $item['translated'])); } } diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 1412a786a79b7..5e460fbfb84ff 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Translation\Loader; /** - * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) + * @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium * @copyright Copyright (c) 2012, Clemens Tolboom */ class PoFileLoader extends FileLoader @@ -20,7 +20,7 @@ class PoFileLoader extends FileLoader /** * Parses portable object (PO) format. * - * From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files + * From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files * we should be able to parse files having: * * white-space @@ -126,23 +126,24 @@ protected function loadResource($resource) */ private function addMessage(array &$messages, array $item) { - if (\is_array($item['translated'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = stripcslashes($item['ids']['singular']); if (isset($item['ids']['plural'])) { - $plurals = $item['translated']; - // PO are by definition indexed so sort by index. - ksort($plurals); - // Make sure every index is filled. - end($plurals); - $count = key($plurals); - // Fill missing spots with '-'. - $empties = array_fill(0, $count + 1, '-'); - $plurals += $empties; - ksort($plurals); - $messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals)); + $id .= '|'.stripcslashes($item['ids']['plural']); } - } elseif (!empty($item['ids']['singular'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']); + + $translated = (array) $item['translated']; + // PO are by definition indexed so sort by index. + ksort($translated); + // Make sure every index is filled. + end($translated); + $count = key($translated); + // Fill missing spots with '-'. + $empties = array_fill(0, $count + 1, '-'); + $translated += $empties; + ksort($translated); + + $messages[$id] = stripcslashes(implode('|', $translated)); } } } diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php index 63de5cebaa4dc..d6adecb1736fd 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php @@ -34,7 +34,10 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => '{0} bar|{1} bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } diff --git a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php index d8e2c1993ba1c..cb94e90a9408f 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php @@ -34,7 +34,10 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => 'bar|bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } @@ -89,10 +92,8 @@ public function testEscapedIdPlurals() $catalogue = $loader->load($resource, 'en', 'domain1'); $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('escaped "foo"', $messages); - $this->assertArrayHasKey('escaped "foos"', $messages); - $this->assertEquals('escaped "bar"', $messages['escaped "foo"']); - $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']); + $this->assertArrayHasKey('escaped "foo"|escaped "foos"', $messages); + $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foo"|escaped "foos"']); } public function testSkipFuzzyTranslations() @@ -106,4 +107,16 @@ public function testSkipFuzzyTranslations() $this->assertArrayNotHasKey('foo2', $messages); $this->assertArrayHasKey('foo3', $messages); } + + public function testMissingPlurals() + { + $loader = new PoFileLoader(); + $resource = __DIR__.'/../fixtures/missing-plurals.po'; + $catalogue = $loader->load($resource, 'en', 'domain1'); + + $this->assertEquals([ + 'foo|foos' => '-|bar|-|bars', + ], $catalogue->all('domain1')); + $this->assertEquals('en', $catalogue->getLocale()); + } } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po new file mode 100644 index 0000000000000..3b47fca805b91 --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po @@ -0,0 +1,4 @@ +msgid "foo" +msgid_plural "foos" +msgstr[3] "bars" +msgstr[1] "bar" diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo b/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo index 6445e77beab59..3945ad95beae6 100644 Binary files a/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo and b/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo differ diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po index 439c41ad7fef4..61d1ba42b41a1 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po +++ b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po @@ -3,3 +3,5 @@ msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" +msgid "{0} no foos|one foo|%count% foos" +msgstr "{0} no bars|one bar|%count% bars" diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index 04abe81af3647..f7bfd2902e5c6 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -21,9 +21,8 @@ * @author Tim Nagel * @author Bernhard Schussek * - * @see http://en.wikipedia.org/wiki/Bank_card_number - * @see http://www.regular-expressions.info/creditcard.html - * @see http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf + * @see https://en.wikipedia.org/wiki/Payment_card_number + * @see https://www.regular-expressions.info/creditcard.html */ class CardSchemeValidator extends ConstraintValidator { diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php index 5221857101af2..c70db0a74c4c1 100644 --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php @@ -102,8 +102,10 @@ private function normalizeBinaryFormat($maxSize) $factors = [ 'k' => 1000, 'ki' => 1 << 10, - 'm' => 1000000, + 'm' => 1000 * 1000, 'mi' => 1 << 20, + 'g' => 1000 * 1000 * 1000, + 'gi' => 1 << 30, ]; if (ctype_digit((string) $maxSize)) { $this->maxSize = (int) $maxSize; diff --git a/src/Symfony/Component/Validator/README.md b/src/Symfony/Component/Validator/README.md index 3ccb2901adeac..410a4213eef07 100644 --- a/src/Symfony/Component/Validator/README.md +++ b/src/Symfony/Component/Validator/README.md @@ -13,4 +13,4 @@ Resources [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) -[1]: http://jcp.org/en/jsr/detail?id=303 +[1]: https://jcp.org/en/jsr/detail?id=303 diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf index 3a545c80b6409..e27bb2930f676 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf @@ -246,6 +246,10 @@ Error Fejl + + This value should be between {{ min }} and {{ max }}. + Værdien skal være mellem {{ min }} og {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index f33e4d602ca15..8ee3120482267 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Dieses Passwort ist Teil eines Datenlecks, es darf nicht verwendet werden. + + This value should be between {{ min }} and {{ max }}. + Dieser Wert sollte zwischen {{ min }} und {{ max }} sein. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index d5d9d20997fc0..100d552076f2c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. This password has been leaked in a data breach, it must not be used. Please use another password. + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index f248f1cf3f20b..75cb60605a6b3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña. + + This value should be between {{ min }} and {{ max }}. + Este valor debe estar entre {{ min }} y {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf index ff1aa7c0b1ec0..2cfcbea4b086c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf @@ -16,19 +16,19 @@ This value should be blank. - این فیلد باید خالی باشد. + این مقدار باید خالی باشد. The value you selected is not a valid choice. - گزینه انتخابی معتبر نیست. + مقدار انتخاب شده شامل گزینه های معتبر نمی باشد. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - باید حداقل {{ limit }} گزینه انتخاب کنید.|باید حداقل {{ limit }} گزینه انتخاب کنید. + باید حداقل {{ limit }} گزینه انتخاب نمایید.|باید حداقل {{ limit }} گزینه انتخاب نمایید. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - حداکثر {{ limit }} گزینه می توانید انتخاب کنید.|حداکثر {{ limit }} گزینه می توانید انتخاب کنید. + حداکثر {{ limit }} گزینه می توانید انتخاب نمایید.|حداکثر {{ limit }} گزینه می توانید انتخاب نمایید. One or more of the given values is invalid. @@ -44,87 +44,87 @@ This value is not a valid date. - این مقدار یک تاریخ معتبر نیست. + این مقدار یک تاریخ معتبر نمی باشد. This value is not a valid datetime. - این مقدار یک تاریخ و زمان معتبر نیست. + این مقدار یک تاریخ و زمان معتبر نمی باشد. This value is not a valid email address. - این یک رایانامه معتبر نیست. + این یک رایانامه معتبر نمی باشد. The file could not be found. - فایل پیدا نشد. + فایل یافت نشد. The file is not readable. - فایل قابلیت خواندن ندارد. + فایل قابلیت خوانده شدن ندارد. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - این نوع فایل مجاز نیست({{ type }}). نوع های مجاز {{ types }} هستند. + این نوع فایل مجاز نمی باشد({{ type }}). نوع های مجاز شامل {{ types }} می باشند. This value should be {{ limit }} or less. - این مقدار باید کوچکتر یا مساوی {{ limit }} باشد. + این مقدار باید کوچکتر و یا مساوی {{ limit }} باشد. This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است. + بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد. This value should be {{ limit }} or more. - این مقدار باید برابر و یا بیشتر از {{ limit }} باشد. + این مقدار باید بزرگتر و یا مساوی {{ limit }} باشد. This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد.|بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد. + مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد.|مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد. This value should not be blank. - این مقدار نباید تهی باشد. + این مقدار نباید خالی باشد. This value should not be null. - باید مقداری داشته باشد.. + این مقدار باید شامل چیزی باشد. This value should be null. - نباید مقداری داشته باشد. + این مقدار باید شامل چیزی نباشد. This value is not valid. - این مقدار معتبر نیست. + این مقدار معتبر نمی باشد. This value is not a valid time. - این مقدار یک زمان صحیح نیست. + این مقدار یک زمان صحیح نمی باشد. This value is not a valid URL. - این یک URL معتبر نیست. + این مقدار شامل یک URL معتبر نمی باشد. The two values should be equal. - دو مقدار باید برابر باشند. + دو مقدار باید با یکدیگر برابر باشند. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The file is too large. - فایل بیش از اندازه بزرگ است. + فایل بیش از اندازه بزرگ می باشد. The file could not be uploaded. - بارگذاری فایل با شکست مواجه شد. + بارگذاری فایل با شکست مواجه گردید. This value should be a valid number. @@ -132,23 +132,23 @@ This file is not a valid image. - این فایل یک تصویر نیست. + این فایل یک تصویر نمی باشد. This is not a valid IP address. - این مقدار یک IP معتبر نیست. + این مقدار یک IP معتبر نمی باشد. This value is not a valid language. - این مقدار یک زبان صحیح نیست. + این مقدار یک زبان صحیح نمی باشد. This value is not a valid locale. - این مقدار یک محل صحیح نیست. + این مقدار یک محل صحیح نمی باشد. This value is not a valid country. - این مقدار یک کشور صحیح نیست. + این مقدار یک کشور صحیح نمی باشد. This value is already used. @@ -156,23 +156,23 @@ The size of the image could not be detected. - اندازه تصویر قابل شناسایی نیست. + اندازه تصویر قابل شناسایی نمی باشد. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px است. + طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px می باشد. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px است. + طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px می باشد. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px است. + ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px می باشد. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px است. + ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px می باشد. This value should be the user's current password. @@ -184,67 +184,67 @@ The file was only partially uploaded. - فایل به صورت جزیی بارگذاری شده است. + پرونده به صورت جزیی بارگذاری گردیده است. No file was uploaded. - هیچ فایلی بارگذاری نشد. + هیچ پرونده ای بارگذاری نگردیده است. No temporary folder was configured in php.ini. - فولدر موقت در php.ini پیکربندی نشده است. + فولدر موقت در php.ini پیکربندی نگردیده است. Cannot write temporary file to disk. - فایل موقت را نمی توان در دیسک نوشت. + فایل موقتی را نمی توان در دیسک نوشت. A PHP extension caused the upload to fail. - اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه شود. + یک اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه گردد. This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد. + این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا کمتر باشد. + این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - این مجموعه می بایست به طور دقیق دارا {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} قلم باشد. + این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد. Invalid card number. - شماره کارت نامعتبر است. + شماره کارت نامعتبر می باشد. Unsupported card type or invalid card number. - نوع کارت پشتیبانی نمی شود یا شماره کارت نامعتبر است. + نوع کارت پشتیبانی نمی شود و یا شماره کارت نامعتبر می باشد. This is not a valid International Bank Account Number (IBAN). - این یک شماره حساب بین المللی بانک (IBAN) درست نیست. + این یک شماره حساب بانک بین المللی معتبر نمی باشد (IBAN). This value is not a valid ISBN-10. - این مقدار یک ISBN-10 درست نیست. + این مقدار یک ISBN-10 معتبر نمی باشد. This value is not a valid ISBN-13. - این مقدار یک ISBN-13 درست نیست. + این مقدار یک ISBN-13 معتبر نمی باشد. This value is neither a valid ISBN-10 nor a valid ISBN-13. - این مقدار یک ISBN-10 درست یا ISBN-13 درست نیست. + این مقدار یک ISBN-10 صحیح و یا ISBN-13 معتبر نمی باشد. This value is not a valid ISSN. - این مقدار یک ISSN درست نیست. + این مقدار یک ISSN معتبر نمی باشد. This value is not a valid currency. - این مقدار یک یکای پول درست نیست. + این مقدار یک واحد پول معتبر نمی باشد. This value should be equal to {{ compared_value }}. @@ -256,11 +256,11 @@ This value should be greater than or equal to {{ compared_value }}. - این مقدار باید بزرگتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید بزرگتر و یا مساوی با {{ compared_value }} باشد. This value should be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. This value should be less than {{ compared_value }}. @@ -268,7 +268,7 @@ This value should be less than or equal to {{ compared_value }}. - این مقدار باید کمتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید کمتر و یا مساوی با {{ compared_value }} باشد. This value should not be equal to {{ compared_value }}. @@ -276,43 +276,43 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار نباید {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار نباید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} می باشد. The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} می باشد. The image is square ({{ width }}x{{ height }}px). Square images are not allowed. - این عکس مربع width }}x{{ height }}px}} می باشد.عکس مربع مجاز نمی باشد. + این تصویر یک مربع width }}x{{ height }}px}} می باشد.تصویر مربع مجاز نمی باشد. The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. - این عکس افقی width }}x{{ height }}px}} می باشد.عکس افقی مجاز نمی باشد. + این تصویر افقی width }}x{{ height }}px}} می باشد.تصویر افقی مجاز نمی باشد. The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. - این عکس عمودی width }}x{{ height }}px}} می باشد.عکس عمودی مجاز نمی باشد. + این تصویر عمودی width }}x{{ height }}px}} می باشد.تصویر عمودی مجاز نمی باشد. An empty file is not allowed. - فایل خالی مجاز نمی باشد. + پرونده خالی مجاز نمی باشد. The host could not be resolved. - هاست قابل حل نیست. + میزبان قابل حل نمی باشد. This value does not match the expected {{ charset }} charset. - این مقدار مورد نظر نمی باشد. مقدار مورد نظر {{ charset }} می باشد. + این مقدار مطابق با مقدار مورد انتظار {{ charset }} نمی باشد. This is not a valid Business Identifier Code (BIC). - این مقدار یک BIC درست نیست. + این مقدار یک BIC معتبر نمی باشد. Error @@ -320,7 +320,7 @@ This is not a valid UUID. - این مقدار یک UUID درست نیست. + این مقدار یک UUID معتبر نمی باشد. This value should be a multiple of {{ compared_value }}. @@ -328,7 +328,7 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. - این BIC با IBAN ارتباط ندارد. + این BIC با IBAN ارتباطی ندارد. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index 9b021cd68214f..dc7e73e3c7581 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Ce mot de passe a été divulgué lors d'une fuite de données, il ne doit plus être utilisé. Veuillez utiliser un autre mot de passe. + + This value should be between {{ min }} and {{ max }}. + Cette valeur doit être comprise entre {{ min }} et {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf index 300eb5f68fb97..96ae6fe54ea6a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf @@ -358,6 +358,14 @@ This value is not a valid timezone. Ez az érték nem egy érvényes időzóna. + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ez a jelszó korábban egy adatvédelmi incidens során illetéktelenek kezébe került, így nem használható. Kérjük, használjon másik jelszót. + + + This value should be between {{ min }} and {{ max }}. + Ennek az értéknek {{ min }} és {{ max }} között kell lennie. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index 79171bc0dfa6e..2a079aacbf9b1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Slaptažodis yra nutekėjęs duomenų saugumo pažeidime, jo naudoti negalima. Prašome naudoti kitą slaptažodį. + + This value should be between {{ min }} and {{ max }}. + Ši reikšmė turi būti tarp {{ min }} ir {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index 478ca19753a64..3b2eb4131bd3a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Dit wachtwoord is gelekt vanwege een data-inbreuk, het moet niet worden gebruikt. Kies een ander wachtwoord. + + This value should be between {{ min }} and {{ max }}. + Deze waarde moet zich tussen {{ min }} en {{ max }} bevinden. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 888e73b157007..f1910c99d5751 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -330,6 +330,10 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}. + + This value should be between {{ min }} and {{ max }}. + Ta wartość powinna być pomiędzy {{ min }} a {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf index 63af47042b199..26b069ab02774 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf @@ -278,10 +278,62 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Această valoare nu trebuie să fie identică cu {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Raportul imaginii este prea mare ({{ ratio }}). Raportul maxim permis este {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Raportul imaginii este prea mic ({{ ratio }}). Raportul minim permis este {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Imaginea este un pătrat ({{ width }}x{{ height }}px). Imaginile pătrat nu sunt permise. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Imaginea are orientarea peisaj ({{ width }}x{{ height }}px). Imaginile cu orientare peisaj nu sunt permise. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Imaginea are orientarea portret ({{ width }}x{{ height }}px). Imaginile cu orientare portret nu sunt permise. + + + An empty file is not allowed. + Nu se permite un fișier gol. + + + The host could not be resolved. + Numele host nu a putut fi rezolvat către o adresă IP. + + + This value does not match the expected {{ charset }} charset. + Această valoare nu corespunde setului de caractere {{ charset }} așteptat. + + + This is not a valid Business Identifier Code (BIC). + Codul BIC (Business Identifier Code) nu este valid. + Error Eroare + + This is not a valid UUID. + Identificatorul universal unic (UUID) nu este valid. + + + This value should be a multiple of {{ compared_value }}. + Această valoare trebuie să fie un multiplu de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Codul BIC (Business Identifier Code) nu este asociat cu codul IBAN {{ iban }}. + + + This value should be valid JSON. + Această valoare trebuie să fie un JSON valid. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index b77e04e8471c8..361be20f796f8 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -330,6 +330,42 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Данный BIC не связан с IBAN {{ iban }}. + + This value should be valid JSON. + Значение должно быть корректным JSON. + + + This collection should contain only unique elements. + Эта коллекция должна содержать только уникальные элементы. + + + This value should be positive. + Значение должно быть положительным. + + + This value should be either positive or zero. + Значение должно быть положительным или равным нулю. + + + This value should be negative. + Значение должно быть отрицательным. + + + This value should be either negative or zero. + Значение должно быть отрицательным или равным нулю. + + + This value is not a valid timezone. + Значение не является корректным часовым поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Данный пароль был скомпрометирован в результате утечки данных и не должен быть использован. Пожалуйста, используйте другой пароль. + + + This value should be between {{ min }} and {{ max }}. + Значение должно быть между {{ min }} и {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf index 5ddc429854e54..cba61915544a3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf @@ -330,6 +330,42 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Банківський код (BIC) не пов’язаний із міжнародним номером банківського рахунку (IBAN) {{ iban }}. + + This value should be valid JSON. + Значення має бути корректним JSON. + + + This collection should contain only unique elements. + Ця колекція повинна мати тільки унікальни значення. + + + This value should be positive. + Значення має бути позитивним. + + + This value should be either positive or zero. + Значення має бути позитивним або дорівнювати нулю. + + + This value should be negative. + Значення має бути негативним. + + + This value should be either negative or zero. + Значення має бути негативним або дорівнювати нулю. + + + This value is not a valid timezone. + Значення не є дійсним часовим поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Цей пароль був скомпрометований в результаті витоку даних та не повинен використовуватися. Будь ласка, використовуйте інший пароль. + + + This value should be between {{ min }} and {{ max }}. + Значення має бути між {{ min }} та {{ max }}. + diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 2f27974a801ab..3a84694cc7aca 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -148,20 +148,6 @@ public function testValidComparisonToPropertyPath($comparedValue) $this->assertNoViolation(); } - /** - * @dataProvider provideValidComparisonsToPropertyPath - */ - public function testValidComparisonToPropertyPathOnArray($comparedValue) - { - $constraint = $this->createConstraint(['propertyPath' => '[root][value]']); - - $this->setObject(['root' => ['value' => 5]]); - - $this->validator->validate($comparedValue, $constraint); - - $this->assertNoViolation(); - } - public function testNoViolationOnNullObjectWithPropertyPath() { $constraint = $this->createConstraint(['propertyPath' => 'propertyPath']); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php index d3117ed44a245..e0b6ec8f41f5d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php @@ -97,6 +97,10 @@ public function provideValidSizes() ['1MI', 1048576, true], ['3m', 3000000, false], ['3M', 3000000, false], + ['1gi', 1073741824, true], + ['1GI', 1073741824, true], + ['4g', 4000000000, false], + ['4G', 4000000000, false], ]; } @@ -107,8 +111,6 @@ public function provideInvalidSizes() ['foo'], ['1Ko'], ['1kio'], - ['1G'], - ['1Gi'], ]; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php deleted file mode 100644 index 8b0d30f571421..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Context\ExecutionContextInterface; - -class ConstraintAValidator extends ConstraintValidator -{ - public static $passedContext; - - public function initialize(ExecutionContextInterface $context) - { - parent::initialize($context); - - self::$passedContext = $context; - } - - public function validate($value, Constraint $constraint) - { - if ('VALID' != $value) { - $this->context->addViolation('message', ['param' => 'value']); - - return; - } - } -} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php b/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php deleted file mode 100644 index 39f54777795cd..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -class FakeClassMetadata extends ClassMetadata -{ - public function addCustomPropertyMetadata($propertyName, $metadata) - { - if (!isset($this->members[$propertyName])) { - $this->members[$propertyName] = []; - } - - $this->members[$propertyName][] = $metadata; - } -} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php b/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php deleted file mode 100644 index bd9a5cf6c32dc..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -class InvalidConstraintValidator -{ -} diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php index 2bc3d11ef6d49..c9c05a0edfa36 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php @@ -511,7 +511,7 @@ public function testAddCustomizedViolation() ->setParameter('%param%', 'value') ->setInvalidValue('Invalid value') ->setPlural(2) - ->setCode(42) + ->setCode('42') ->addViolation(); }; @@ -528,7 +528,7 @@ public function testAddCustomizedViolation() $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); $this->assertSame(2, $violations[0]->getPlural()); - $this->assertSame(42, $violations[0]->getCode()); + $this->assertSame('42', $violations[0]->getCode()); } public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index ae8b40fa0eacd..c1f38eb4a81e4 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -68,8 +68,8 @@ public static function castObject($obj, $class, $hasDebugInfo = false) foreach ($a as $k => $v) { if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) { if (!isset($publicProperties[$class])) { - foreach (get_class_vars($class) as $prop => $v) { - $publicProperties[$class][$prop] = true; + foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { + $publicProperties[$class][$prop->name] = true; } } if (!isset($publicProperties[$class][$k])) { diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 9e50f23501154..ab44a8d76bfe4 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -42,7 +42,7 @@ protected function doClone($var) $currentDepth = 0; // Current tree depth $currentDepthFinalIndex = 0; // Final $queue index for current tree depth $minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached - $cookie = (object) []; // Unique object used to detect hard references + $cookie = (object) []; // Unique object used to detect hard references $a = null; // Array cast for nested structures $stub = null; // Stub capturing the main properties of an original item value // or null if the original value is used directly @@ -86,8 +86,15 @@ protected function doClone($var) } foreach ($vals as $k => $v) { // $v is the original value or a stub object in case of hard references - $refs[$k] = $cookie; - if ($zvalIsRef = $vals[$k] === $cookie) { + + if (\PHP_VERSION_ID >= 70400) { + $zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k); + } else { + $refs[$k] = $cookie; + $zvalIsRef = $vals[$k] === $cookie; + } + + if ($zvalIsRef) { $vals[$k] = &$stub; // Break hard references to make $queue completely unset($stub); // independent from the original structure if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) { diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 37d50a884df0d..b2f6ee7012b67 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -438,7 +438,7 @@ function xpathHasClass(className) { return this.current(); } this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0; - + return this.current(); }, previous: function () { @@ -446,7 +446,7 @@ function xpathHasClass(className) { return this.current(); } this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1); - + return this.current(); }, isEmpty: function () { @@ -522,11 +522,11 @@ function showCurrent(state) "sf-dump-protected", "sf-dump-private", ].map(xpathHasClass).join(' or '); - + var xpathResult = doc.evaluate('.//span[' + classMatches + '][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); while (node = xpathResult.iterateNext()) state.nodes.push(node); - + showCurrent(state); }, 400); }); diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php index 3b180af49810d..f6784be498623 100644 --- a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Tests\Fixtures\Php74; /** * @author Nicolas Grekas @@ -431,6 +432,73 @@ public function testCaster() [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 ) +EOTXT; + $this->assertStringMatchesFormat($expected, print_r($clone, true)); + } + + /** + * @requires PHP 7.4 + */ + public function testPhp74() + { + $data = new Php74(); + + $cloner = new VarCloner(); + $clone = $cloner->cloneVar($data); + + $expected = <<<'EOTXT' +Symfony\Component\VarDumper\Cloner\Data Object +( + [data:Symfony\Component\VarDumper\Cloner\Data:private] => Array + ( + [0] => Array + ( + [0] => Symfony\Component\VarDumper\Cloner\Stub Object + ( + [type] => 4 + [class] => Symfony\Component\VarDumper\Tests\Fixtures\Php74 + [value] => + [cut] => 0 + [handle] => %i + [refCount] => 0 + [position] => 1 + [attr] => Array + ( + ) + + ) + + ) + + [1] => Array + ( + [p1] => 123 + [p2] => Symfony\Component\VarDumper\Cloner\Stub Object + ( + [type] => 4 + [class] => stdClass + [value] => + [cut] => 0 + [handle] => %i + [refCount] => 0 + [position] => 0 + [attr] => Array + ( + ) + + ) + + ) + + ) + + [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 + [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 + [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 + [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 + [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 +) + EOTXT; $this->assertStringMatchesFormat($expected, print_r($clone, true)); } diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php new file mode 100644 index 0000000000000..724fbeb7bdb6e --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php @@ -0,0 +1,14 @@ +p2 = new \stdClass(); + } +} diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index d2a2ebcf88c21..0012df4a358fc 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Yaml; +use Symfony\Component\Yaml\Tag\TaggedValue; + /** * Dumper dumps PHP variables to YAML strings. * @@ -91,7 +93,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) $dumpObjectAsInlineMap = empty((array) $input); } - if ($inline <= 0 || (!\is_array($input) && $dumpObjectAsInlineMap) || empty($input)) { + if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) { $output .= $prefix.Inline::dump($input, $flags); } else { $dumpAsMap = Inline::isHash($input); @@ -110,6 +112,19 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) continue; } + if ($value instanceof TaggedValue) { + $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); + + if ($inline - 1 <= 0) { + $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; + } else { + $output .= "\n"; + $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); + } + + continue; + } + $dumpObjectAsInlineMap = true; if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index e7a763ab96922..1a9cac6f73600 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Tag\TaggedValue; use Symfony\Component\Yaml\Yaml; class DumperTest extends TestCase @@ -434,6 +435,94 @@ public function testDumpingStdClassInstancesRespectsInlineLevel() inner2: c inner3: { deep1: d, deep2: e } +YAML; + $this->assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueSequenceRespectsInlineLevel() + { + $data = [ + new TaggedValue('user', [ + 'username' => 'jane', + ]), + new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 2); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueSequenceWithInlinedTagValues() + { + $data = [ + new TaggedValue('user', [ + 'username' => 'jane', + ]), + new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 1); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueMapRespectsInlineLevel() + { + $data = [ + 'user1' => new TaggedValue('user', [ + 'username' => 'jane', + ]), + 'user2' => new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 2); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueMapWithInlinedTagValues() + { + $data = [ + 'user1' => new TaggedValue('user', [ + 'username' => 'jane', + ]), + 'user2' => new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 1); + + $expected = <<assertSame($expected, $yaml); }