diff --git a/.appveyor.yml b/.appveyor.yml index 5146a65ae6cab..188dfe78a2493 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -54,6 +54,8 @@ install: - php composer.phar self-update - copy /Y .github\composer-config.json %APPDATA%\Composer\config.json - php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex dev-master + - git config --global user.email "" + - git config --global user.name "Symfony" - php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev) - php composer.phar config platform.php 5.5.9 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e459d1e55f616..9e23ca5c1ea74 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,7 +4,7 @@ /src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @dunglas # Form /src/Symfony/Bridge/Twig/Extension/FormExtension.php @xabbuh -/src/Symfony/Bridge/Twig/Form/* @xabbuh +/src/Symfony/Bridge/Twig/Form/ @xabbuh /src/Symfony/Bridge/Twig/Node/FormThemeNode.php @xabbuh /src/Symfony/Bridge/Twig/Node/RenderBlockNode.php @xabbuh /src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php @xabbuh @@ -13,34 +13,34 @@ /src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php @xabbuh /src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php @xabbuh /src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php @xabbuh -/src/Symfony/Bundle/FrameworkBundle/Resources/views/* @xabbuh +/src/Symfony/Bundle/FrameworkBundle/Resources/views/ @xabbuh /src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @xabbuh /src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @xabbuh /src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php @xabbuh /src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php @xabbuh -/src/Symfony/Component/Form/* @xabbuh +/src/Symfony/Component/Form/ @xabbuh # HttpKernel /src/Symfony/Component/HttpKernel/Log/Logger.php @dunglas # LDAP -/src/Symfony/Component/Ldap/* @csarrazi +/src/Symfony/Component/Ldap/ @csarrazi # Lock -/src/Symfony/Component/Lock/* @jderusse +/src/Symfony/Component/Lock/ @jderusse # Messenger -/src/Symfony/Bridge/Doctrine/Messenger/* @sroze -/src/Symfony/Component/Messenger/* @sroze +/src/Symfony/Bridge/Doctrine/Messenger/ @sroze +/src/Symfony/Component/Messenger/ @sroze # PropertyInfo -/src/Symfony/Component/PropertyInfo/* @dunglas -/src/Symfony/Bridge/Doctrine/PropertyInfo/* @dunglas +/src/Symfony/Component/PropertyInfo/ @dunglas +/src/Symfony/Bridge/Doctrine/PropertyInfo/ @dunglas # Serializer -/src/Symfony/Component/Serializer/* @dunglas +/src/Symfony/Component/Serializer/ @dunglas # WebLink -/src/Symfony/Component/WebLink/* @dunglas +/src/Symfony/Component/WebLink/ @dunglas # Workflow /src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @lyrixx /src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php @lyrixx /src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php @lyrixx /src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass.php @lyrixx /src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/WorkflowGuardListenerPass.php @lyrixx -/src/Symfony/Component/Workflow/* @lyrixx +/src/Symfony/Component/Workflow/ @lyrixx # Yaml -/src/Symfony/Component/Yaml/* @xabbuh +/src/Symfony/Component/Yaml/ @xabbuh diff --git a/.github/build-packages.php b/.github/build-packages.php index d859e3ec808a1..81a309911135c 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -47,7 +47,7 @@ if (isset($preferredInstall[$package->name]) && 'source' === $preferredInstall[$package->name]) { passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *"); } else { - passthru("cd $dir && git init && git add . && git commit --author \"Symfony <>\" -m - && git archive -o package.tar HEAD && rm .git/ -Rf"); + passthru("cd $dir && git init && git add . && git commit -q -m - && git archive -o package.tar HEAD && rm .git/ -Rf"); } if (!isset($package->extra->{'branch-alias'}->{'dev-master'})) { diff --git a/.travis.yml b/.travis.yml index 682b50b1558da..99595ca5f89b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,6 +212,9 @@ install: - | # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components + git config --global user.email "" + git config --global user.name "Symfony" + if [[ ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit else diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 015ca124b1815..29759d78bec50 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,22 @@ 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.33 (2019-11-01) + + * bug #33998 [Config] Disable default alphabet sorting in glob function due of unstable sort (hurricane-voronin) + * bug #34144 [Serializer] Improve messages for unexpected resources values (fancyweb) + * bug #34080 [SecurityBundle] correct types for default arguments for firewall configs (shieldo) + * bug #33999 [Form] Make sure to collect child forms created on *_SET_DATA events (yceruto) + * bug #34021 [TwigBridge] do not render errors for checkboxes twice (xabbuh) + * bug #34041 [HttpKernel] fix wrong removal of the just generated container dir (nicolas-grekas) + * bug #34023 [Dotenv] allow LF in single-quoted strings (nicolas-grekas) + * bug #33818 [Yaml] Throw exception for tagged invalid inline elements (gharlan) + * bug #33948 [PropertyInfo] Respect property name case when guessing from public method name (antograssiot) + * bug #33962 [Cache] fixed TagAwareAdapter returning invalid cache (v-m-i) + * bug #33965 [HttpFoundation] Add plus character `+` to legal mime subtype (ilzrv) + * bug #32943 [Dotenv] search variable values in ENV first then env file (soufianZantar) + * bug #33943 [VarDumper] fix resetting the "bold" state in CliDumper (nicolas-grekas) + * 3.4.32 (2019-10-07) * bug #33834 [Validator] Fix ValidValidator group cascading usage (fancyweb) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2cf905be32e88..4cad5acf4d72d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -9,16 +9,16 @@ Symfony is the result of the work of many people who made the code better - Christian Flothmann (xabbuh) - Bernhard Schussek (bschussek) - Tobias Schultze (tobion) - - Christophe Coevoet (stof) - Robin Chalas (chalas_r) - - Jordi Boggiano (seldaek) + - Christophe Coevoet (stof) - Kévin Dunglas (dunglas) + - Jordi Boggiano (seldaek) - Victor Berchet (victor) - Maxime Steinhausser (ogizanagi) - Ryan Weaver (weaverryan) + - Jakub Zalas (jakubzalas) - Javier Eguiluz (javier.eguiluz) - Roland Franssen (ro0) - - Jakub Zalas (jakubzalas) - Johannes S (johannes) - Grégoire Pineau (lyrixx) - Kris Wallsmith (kriswallsmith) @@ -31,8 +31,8 @@ Symfony is the result of the work of many people who made the code better - Wouter De Jong (wouterj) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - - Lukas Kahwe Smith (lsmith) - Alexander M. Turek (derrabus) + - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - Hamza Amrouche (simperfit) - Jeremy Mikola (jmikola) @@ -42,9 +42,9 @@ Symfony is the result of the work of many people who made the code better - Igor Wiedler (igorw) - Jérémy DERUSSÉ (jderusse) - Eriksen Costa (eriksencosta) + - Thomas Calvet (fancyweb) - Guilhem Niot (energetick) - Sarah Khalil (saro0h) - - Thomas Calvet (fancyweb) - Tobias Nyholm (tobias) - Jonathan Wage (jwage) - Lynn van der Berg (kjarli) @@ -69,14 +69,14 @@ Symfony is the result of the work of many people who made the code better - Miha Vrhovnik - Diego Saint Esteben (dii3g0) - Gábor Egyed (1ed) + - Gabriel Ostrolucký (gadelat) - Titouan Galopin (tgalopin) - Konstantin Kudryashov (everzet) - David Maicher (dmaicher) - Bilal Amarni (bamarni) - Mathieu Piot (mpiot) - - Gabriel Ostrolucký (gadelat) - - Florin Patan (florinpatan) - Vladimir Reznichenko (kalessil) + - Florin Patan (florinpatan) - Jáchym Toušek (enumag) - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) @@ -86,10 +86,10 @@ Symfony is the result of the work of many people who made the code better - Jan Schädlich (jschaedl) - Christian Raue - Arnout Boks (aboks) + - Douglas Greenshields (shieldo) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Douglas Greenshields (shieldo) - David Buchmann (dbu) - Dariusz Ruminski - Lee McDermott @@ -126,12 +126,12 @@ Symfony is the result of the work of many people who made the code better - Colin Frei - Javier Spagnoletti (phansys) - Joshua Thijssen + - Alex Pott - Daniel Wehner (dawehner) - excelwebzone - Gordon Franke (gimler) - Teoh Han Hui (teohhanhui) - Oskar Stark (oskarstark) - - Alex Pott - Fabien Pennequin (fabienpennequin) - Théo FIDRY (theofidry) - Eric GELOEN (gelo) @@ -140,6 +140,7 @@ Symfony is the result of the work of many people who made the code better - Tugdual Saunier (tucksaun) - Jannik Zschiesche (apfelbox) - Robert Schönthal (digitalkaoz) + - Gregor Harlan (gharlan) - Florian Lonqueu-Brochard (florianlb) - Gabriel Caruso (carusogabriel) - Stefano Sala (stefano.sala) @@ -163,8 +164,10 @@ Symfony is the result of the work of many people who made the code better - Philipp Wahala (hifi) - Rafael Dohms (rdohms) - jwdeitch + - Alexander Schranz (alexander-schranz) - Mikael Pajunen - Alessandro Chitolina (alekitto) + - Yanick Witschi (toflar) - Massimiliano Arione (garak) - Niels Keurentjes (curry684) - Vyacheslav Pavlov @@ -172,13 +175,10 @@ Symfony is the result of the work of many people who made the code better - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Vincent Touzet (vincenttouzet) - - Gregor Harlan (gharlan) - jeremyFreeAgent (jeremyfreeagent) - Rouven Weßling (realityking) - - Alexander Schranz (alexander-schranz) - Clemens Tolboom - Helmer Aaviksoo - - Yanick Witschi (toflar) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -202,6 +202,7 @@ Symfony is the result of the work of many people who made the code better - Daniel Espendiller - Possum - Dorian Villet (gnutix) + - Michaël Perrin (michael.perrin) - Sergey Linnik (linniksa) - Richard Miller (mr_r_miller) - Albert Casademont (acasademont) @@ -209,6 +210,7 @@ Symfony is the result of the work of many people who made the code better - Dennis Benkert (denderello) - DQNEO - mcfedr (mcfedr) + - Ben Davies (bendavies) - Gary PEGEOT (gary-p) - Ruben Gonzalez (rubenrua) - Benjamin Dulau (dbenjamin) @@ -223,7 +225,6 @@ Symfony is the result of the work of many people who made the code better - bronze1man - sun (sun) - Larry Garfield (crell) - - Michaël Perrin (michael.perrin) - Nikolay Labinskiy (e-moe) - Martin Schuhfuß (usefulthink) - apetitpa @@ -232,11 +233,11 @@ Symfony is the result of the work of many people who made the code better - Pierre Minnieur (pminnieur) - fivestar - Dominique Bongiraud + - Andre Rømcke (andrerom) - Jeremy Livingston (jeremylivingston) - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) - Leszek Prabucki (l3l0) - - Ben Davies (bendavies) - Fabien Bourigault (fbourigault) - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) @@ -260,7 +261,6 @@ Symfony is the result of the work of many people who made the code better - Mantis Development - Loïc Faugeron - Hidde Wieringa (hiddewie) - - Andre Rømcke (andrerom) - Marco Pivetta (ocramius) - Rob Frawley 2nd (robfrawley) - julien pauli (jpauli) @@ -399,8 +399,10 @@ Symfony is the result of the work of many people who made the code better - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) - Gyula Sallai (salla) + - Maciej Malarz (malarzm) - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) + - Dmytro Borysovskyi (dmytr0) - Tomasz Kowalczyk (thunderer) - Artur Eshenbrener - Damien Alexandre (damienalexandre) @@ -425,6 +427,7 @@ Symfony is the result of the work of many people who made the code better - Grzegorz (Greg) Zdanowski (kiler129) - Iker Ibarguren (ikerib) - Kirill chEbba Chebunin (chebba) + - Anthony GRASSIOT (antograssiot) - Greg Thornton (xdissent) - Martin Hujer (martinhujer) - Alex Bowers @@ -492,6 +495,7 @@ Symfony is the result of the work of many people who made the code better - lancergr - Mihai Stancu - Ivan Nikolaev (destillat) + - Gildas Quéméner (gquemener) - Olivier Dolbeau (odolbeau) - Jan Rosier (rosier) - Alessandro Lai (jean85) @@ -507,10 +511,8 @@ Symfony is the result of the work of many people who made the code better - Sylvain Fabre (sylfabre) - Martijn Cuppens - Vlad Gregurco (vgregurco) - - Maciej Malarz (malarzm) - Boris Vujicic (boris.vujicic) - Chris Sedlmayr (catchamonkey) - - Dmytro Borysovskyi (dmytr0) - Kamil Kokot (pamil) - Seb Koelen - Christoph Mewes (xrstf) @@ -522,6 +524,7 @@ Symfony is the result of the work of many people who made the code better - Jonas Flodén (flojon) - Tobias Weichart - Gonzalo Vilaseca (gonzalovilaseca) + - Tarmo Leppänen (tarlepp) - Marcin Sikoń (marphi) - Tien Vo (tienvx) - Denis Brumann (dbrumann) @@ -534,6 +537,7 @@ Symfony is the result of the work of many people who made the code better - Gintautas Miselis - Rob Bast - Roberto Espinoza (respinoza) + - Soufian EZ-ZANTAR (soezz) - Zander Baldwin - Gocha Ossinkine (ossinkine) - Adam Harvey @@ -592,6 +596,7 @@ Symfony is the result of the work of many people who made the code better - Andrew Udvare (audvare) - alexpods - Saif Eddin G + - Johann Pardanaud - Adam Szaraniec (mimol) - Dariusz Ruminski - Erik Trapman (eriktrapman) @@ -672,10 +677,10 @@ Symfony is the result of the work of many people who made the code better - Sebastian Blum - Alexis Lefebvre - aubx + - Julien Turby - Marvin Butkereit - Renan - Ricky Su (ricky) - - Gildas Quéméner (gquemener) - Kyle Evans (kevans91) - Charles-Henri Bruyand - Max Rath (drak3) @@ -717,8 +722,10 @@ Symfony is the result of the work of many people who made the code better - zenmate - Michal Trojanowski - David Fuhr + - Mathias STRASSER (roukmoute) - Max Grigorian (maxakawizard) - DerManoMann + - Timo Bakx (timobakx) - Rostyslav Kinash - Dennis Fridrich (dfridrich) - Mardari Dorel (dorumd) @@ -798,6 +805,7 @@ Symfony is the result of the work of many people who made the code better - Raphaëll Roussel - Michael Lutz - jochenvdv + - Reedy - Arturas Smorgun (asarturas) - Alexander Volochnev (exelenz) - Michael Piecko @@ -816,12 +824,10 @@ Symfony is the result of the work of many people who made the code better - Sebastian Grodzicki (sgrodzicki) - Jeroen van den Enden (stoefke) - Pascal Helfenstein - - Anthony GRASSIOT (antograssiot) - Baldur Rensch (brensch) - Pierre Rineau - Vladyslav Petrovych - Alex Xandra Albert Sim - - Soufian EZ-ZANTAR (soezz) - Carson Full - Sergey Yastrebov - Trent Steel (trsteel88) @@ -861,7 +867,6 @@ Symfony is the result of the work of many people who made the code better - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) - - Johann Pardanaud - fedor.f - Yosmany Garcia (yosmanyga) - Wouter de Wild @@ -943,6 +948,7 @@ Symfony is the result of the work of many people who made the code better - Fabien LUCAS (flucas2) - Omar Yepez (oyepez003) - mwsaz + - bogdan - Jelle Kapitein - Benoît Bourgeois - mantulo @@ -1009,7 +1015,6 @@ Symfony is the result of the work of many people who made the code better - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) - Simon Terrien (sterrien) - - Tarmo Leppänen (tarlepp) - Benoît Merlet (trompette) - Koen Kuipers - datibbaw @@ -1047,7 +1052,6 @@ Symfony is the result of the work of many people who made the code better - neghmurken - xaav - Mahmoud Mostafa (mahmoud) - - Julien Turby - Ahmed Abdou - Daniel Iwaniec - Pieter @@ -1137,7 +1141,6 @@ 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 @@ -1153,7 +1156,9 @@ Symfony is the result of the work of many people who made the code better - nacho - Piotr Antosik (antek88) - Artem Lopata + - Vedran Mihočinec (v-m-i) - Sergey Novikov (s12v) + - creiner - Marcos Quesada (marcos_quesada) - Matthew Vickery (mattvick) - MARYNICH Mikhail (mmarynich-ext) @@ -1198,6 +1203,7 @@ Symfony is the result of the work of many people who made the code better - Alex Demchenko (pilot) - Tadas Gliaubicas (tadcka) - Thanos Polymeneas (thanos) + - Atthaphon Urairat - Benoit Garret - Maximilian Ruta (deltachaos) - Jakub Sacha @@ -1221,13 +1227,13 @@ Symfony is the result of the work of many people who made the code better - James Hudson - Stephen Clouse - e-ivanov + - Michał (bambucha15) - Einenlum - Jochen Bayer (jocl) - Patrick Carlo-Hickman - Bruno MATEU - Jeremy Bush - wizhippo - - Mathias STRASSER (roukmoute) - Thomason, James - Gordienko Vladislav - marie @@ -1328,6 +1334,7 @@ Symfony is the result of the work of many people who made the code better - Jelte Steijaert (jelte) - David Négrier (moufmouf) - Quique Porta (quiqueporta) + - mohammadreza honarkhah - stoccc - Andrea Quintino (dirk39) - Tomasz Szymczyk (karion) @@ -1338,6 +1345,7 @@ Symfony is the result of the work of many people who made the code better - ConneXNL - Aharon Perkel - matze + - Justin Reherman (jreherman) - Rubén Calvo (rubencm) - Abdul.Mohsen B. A. A - Swen van Zanten @@ -1364,6 +1372,7 @@ Symfony is the result of the work of many people who made the code better - Erika Heidi Reinaldo (erikaheidi) - Pierre Tachoire (krichprollsch) - Marc J. Schmidt (marcjs) + - František Maša - Sebastian Schwarz - Marco Jantke - Saem Ghani @@ -1378,6 +1387,7 @@ Symfony is the result of the work of many people who made the code better - Walter Dal Mut (wdalmut) - abluchet - Ruud Arentsen + - Harald Tollefsen - Matthieu - Albin Kerouaton - Sébastien HOUZÉ @@ -1388,6 +1398,7 @@ Symfony is the result of the work of many people who made the code better - Cédric Lahouste (rapotor) - Samuel Vogel (samuelvogel) - Alexey Kopytko (sanmai) + - Osayawe Ogbemudia Terry (terdia) - Berat Doğan - Guillaume LECERF - Juanmi Rodriguez Cerón @@ -1447,6 +1458,7 @@ Symfony is the result of the work of many people who made the code better - WedgeSama - Felds Liscia - Chihiro Adachi (chihiro-adachi) + - Alex Bacart - Raphaëll Roussel - Tadcka - Beth Binkovitz @@ -1627,6 +1639,7 @@ Symfony is the result of the work of many people who made the code better - Matthew Foster (mfoster) - Reyo Stallenberg (reyostallenberg) - Paul Seiffert (seiffert) + - Simon Podlipsky (simpod) - Vasily Khayrulin (sirian) - Stefan Koopmanschap (skoop) - Stas Soroka (stasyan) @@ -1647,6 +1660,7 @@ Symfony is the result of the work of many people who made the code better - Phil Davis - Gleb Sidora - David Stone + - Gerhard Seidel (gseidel) - Jovan Perovic (jperovic) - Pablo Maria Martelletti (pmartelletti) - Yassine Guedidi (yguedidi) @@ -1681,6 +1695,7 @@ Symfony is the result of the work of many people who made the code better - Vladimir Khramtsov (chrome) - Gerd Christian Kunze (derdu) - Christoph Nissle (derstoffel) + - Denys Voronin (hurricane) - Ionel Scutelnicu (ionelscutelnicu) - Mathieu Dewet (mdewet) - Nicolas Tallefourtané (nicolab) @@ -1770,6 +1785,7 @@ Symfony is the result of the work of many people who made the code better - Daan van Renterghem - Nicole Cordes - Martin Kirilov + - Bálint Szekeres - amcastror - Alexander Li (aweelex) - Bram Van der Sype (brammm) @@ -1785,6 +1801,7 @@ Symfony is the result of the work of many people who made the code better - Dmitry Korotovsky - mcorteel - Michael van Tricht + - Ivan - ReScO - Tim Strehle - Sam Ward @@ -1857,6 +1874,7 @@ Symfony is the result of the work of many people who made the code better - Adrian - Oleg Andreyev - neFAST + - zcodes - Pierre Rineau - Florian Morello - Maxim Lovchikov @@ -1911,6 +1929,7 @@ Symfony is the result of the work of many people who made the code better - insidestyles - Maerlyn - Even André Fiskvik + - Agata - Александр Ли - Arjan Keeman - Erik van Wingerden @@ -1959,6 +1978,7 @@ Symfony is the result of the work of many people who made the code better - Christophe BECKER (goabonga) - gondo (gondo) - Gusakov Nikita (hell0w0rd) + - Yannick Ihmels (ihmels) - Osman Üngür (import) - Javier Núñez Berrocoso (javiernuber) - Jelle Bekker (jbekker) @@ -1978,6 +1998,7 @@ Symfony is the result of the work of many people who made the code better - Cayetano Soriano Gallego (neoshadybeat) - Olivier Laviale (olvlvl) - Ondrej Machulda (ondram) + - Pierre Gasté (pierre_g) - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) - Marcin Szepczynski (szepczynski) @@ -2046,6 +2067,7 @@ Symfony is the result of the work of many people who made the code better - Myke79 - Brian Debuire - Benjamin Morel + - Eric Grimois - Piers Warmers - Guilliam Xavier - Sylvain Lorinet @@ -2075,6 +2097,7 @@ Symfony is the result of the work of many people who made the code better - Jörg Rühl - wesleyh - sergey + - Menno Holtkamp - Michael Hudson-Doyle - Daniel Bannert - Karim Miladi @@ -2111,6 +2134,7 @@ Symfony is the result of the work of many people who made the code better - Daniel STANCU - Ryan Rud - Ondrej Slinták + - Rimas Kudelis - vlechemin - Brian Corrigan - Ladislav Tánczos @@ -2165,6 +2189,7 @@ Symfony is the result of the work of many people who made the code better - Ilya Bulakh - David Soria Parra - Sergiy Sokolenko + - detinkin - Ahmed Abdulrahman - dinitrol - Penny Leach @@ -2193,6 +2218,7 @@ Symfony is the result of the work of many people who made the code better - phc - Дмитрий Пацура - ilyes kooli + - Ilia Lazarev - Michaël VEROUX - Julia - Lin Lu @@ -2312,6 +2338,7 @@ Symfony is the result of the work of many people who made the code better - Alexander Menshchikov (zmey_kk) - Florent Cailhol - szymek + - Ryan Linnit - Kovacs Nicolas - craigmarvelley - Stano Turza diff --git a/link b/link index 95a3142d2acda..7b7512f0c9d1f 100755 --- a/link +++ b/link @@ -64,6 +64,6 @@ foreach (glob("$pathToProject/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL; } -foreach (glob("$pathToProject/var/cache/*") as $cacheDir) { +foreach (glob("$pathToProject/var/cache/*", GLOB_NOSORT) as $cacheDir) { $filesystem->remove($cacheDir); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 1feabd1a451ca..147be98b90ce1 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -187,7 +187,7 @@ public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder() public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [ + $this->factory->createNamed('name', static::TESTED_TYPE, null, [ 'em' => 'default', 'class' => self::SINGLE_IDENT_CLASS, 'query_builder' => new \stdClass(), diff --git a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php index 612bec14e5329..8925d588772a8 100644 --- a/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php +++ b/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php @@ -28,7 +28,6 @@ public function compile(Compiler $compiler) preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); - $label = null; $arguments = iterator_to_array($this->getNode('arguments')); $blockNameSuffix = $matches[1]; diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig index e23e6f8a29d09..5673cf212730c 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig @@ -71,7 +71,6 @@ col-sm-10
{#--#}
{{- form_widget(form) -}} - {{- form_errors(form) -}}
{#--#} {%- endblock checkbox_row %} diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index 4a3f04fddef18..eb132e72022ba 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -180,10 +180,10 @@ public function testGetFlashes() $flashMessages = $this->setFlashMessages(); $this->assertEquals($flashMessages, $this->appVariable->getFlashes([])); - $flashMessages = $this->setFlashMessages(); + $this->setFlashMessages(); $this->assertEquals([], $this->appVariable->getFlashes('this-does-not-exist')); - $flashMessages = $this->setFlashMessages(); + $this->setFlashMessages(); $this->assertEquals( ['this-does-not-exist' => []], $this->appVariable->getFlashes(['this-does-not-exist']) diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index db10ccb6c0904..84154512be15c 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -52,7 +52,7 @@ public function testLintFileNotReadable() $filename = $this->createFile(''); unlink($filename); - $ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]); + $tester->execute(['filename' => [$filename]], ['decorated' => false]); } public function testLintFileCompileTimeException() diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php index 2b38122e56410..35f3baa1b9b99 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php @@ -34,7 +34,7 @@ public function testTiming($template, $events) $twig->addExtension(new StopwatchExtension($this->getStopwatch($events))); try { - $nodes = $twig->render('template'); + $twig->render('template'); } catch (RuntimeError $e) { throw $e->getPrevious(); } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index aeb109fd250d3..206cda6783d3d 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -49,21 +49,21 @@ public function testTransUnknownKeyword() { $this->expectException('Twig\Error\SyntaxError'); $this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.'); - $output = $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render(); + $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render(); } public function testTransComplexBody() { $this->expectException('Twig\Error\SyntaxError'); $this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.'); - $output = $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render(); + $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render(); } public function testTransChoiceComplexBody() { $this->expectException('Twig\Error\SyntaxError'); $this->expectExceptionMessage('A message inside a transchoice tag must be a simple text in "index" at line 2.'); - $output = $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render(); + $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render(); } public function getTransTests() diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 43a811b92dba7..f17a1bba21218 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -425,7 +425,6 @@ private function renderEventListenerTable(EventDispatcherInterface $eventDispatc $tableHeaders = ['Order', 'Callable', 'Priority']; $tableRows = []; - $order = 1; foreach ($eventListeners as $order => $listener) { $tableRows[] = [sprintf('#%d', $order + 1), $this->formatCallable($listener), $eventDispatcher->getListenerPriority($event, $listener)]; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index a190dba908a01..3e28e52ad3d0a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1043,8 +1043,6 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co $container->getDefinition('assets.url_package')->setPrivate(true); $container->getDefinition('assets.static_version_strategy')->setPrivate(true); - $defaultVersion = null; - if ($config['version_strategy']) { $defaultVersion = new Reference($config['version_strategy']); } else { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index 169dba0e29f8d..c039345653fd2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -277,8 +277,7 @@ public function testFileWhichDoesNotExist() $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); $controller = $this->createController(); - /* @var BinaryFileResponse $response */ - $response = $controller->file('some-file.txt', 'test.php'); + $controller->file('some-file.txt', 'test.php'); } public function testIsGranted() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php index 81a8512858d89..1d998395e2e0d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php @@ -51,7 +51,7 @@ public function testAbstractConstraintValidator() $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.'); $container = new ContainerBuilder(); - $validatorFactory = $container->register('validator.validator_factory') + $container->register('validator.validator_factory') ->addArgument([]); $container->register('my_abstract_constraint_validator') diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 431cc0c084a73..556fd9afd48e5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -251,7 +251,7 @@ public function testWorkflows() */ public function testDeprecatedWorkflowMissingType() { - $container = $this->createContainerFromFile('workflows_without_type'); + $this->createContainerFromFile('workflows_without_type'); } public function testWorkflowCannotHaveBothTypeAndService() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index 59670fdd19a24..0ae7669ce803a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -26,7 +26,7 @@ class TestExtension extends Extension implements PrependExtensionInterface public function load(array $configs, ContainerBuilder $container) { $configuration = $this->getConfiguration($configs, $container); - $config = $this->processConfiguration($configuration, $configs); + $this->processConfiguration($configuration, $configs); $container->setAlias('test.annotation_reader', new Alias('annotation_reader', true)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php index c99b5e073e49a..3a87f7e4e6e0a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php @@ -59,7 +59,7 @@ public function testFlash($config, $insulate) } // set flash - $crawler = $client->request('GET', '/session_setflash/Hello%20world.'); + $client->request('GET', '/session_setflash/Hello%20world.'); // check flash displays on redirect $this->assertStringContainsString('Hello world.', $client->followRedirect()->text()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index c9396624f0bac..e38e11601b66e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -162,7 +162,7 @@ public function testGetDefaultLocaleOmittingLocaleWithPsrContainer() $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Missing third $defaultLocale argument.'); $container = $this->getMockBuilder(ContainerInterface::class)->getMock(); - $translator = new Translator($container, new MessageFormatter()); + new Translator($container, new MessageFormatter()); } /** diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml index 4a2b936c716ce..98b7f3bee099b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml @@ -150,15 +150,15 @@ - - + false + false - + null diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php index 9eb9a08177700..01e03b0312bd9 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php @@ -61,7 +61,7 @@ public function testDefaultFailureHandler($serviceId, $defaultHandlerInjection) $options['failure_handler'] = $serviceId; } - list($container, $authProviderId, $listenerId, $entryPointId) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); + list($container) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); $definition = $container->getDefinition('abstract_listener.foo'); $arguments = $definition->getArguments(); @@ -99,7 +99,7 @@ public function testDefaultSuccessHandler($serviceId, $defaultHandlerInjection) $options['success_handler'] = $serviceId; } - list($container, $authProviderId, $listenerId, $entryPointId) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); + list($container) = $this->callFactory('foo', $options, 'user_provider', 'entry_point'); $definition = $container->getDefinition('abstract_listener.foo'); $arguments = $definition->getArguments(); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php index f327eece8f99c..fd812c13ae04c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php @@ -159,7 +159,7 @@ public function testCreateWithEntryPoint() 'authenticators' => ['authenticator123', 'authenticatorABC'], 'entry_point' => 'authenticatorABC', ]; - list($container, $entryPointId) = $this->executeCreate($config, null); + list(, $entryPointId) = $this->executeCreate($config, null); $this->assertEquals('authenticatorABC', $entryPointId); } @@ -172,7 +172,7 @@ private function executeCreate(array $config, $defaultEntryPointId) $userProviderId = 'my_user_provider'; $factory = new GuardAuthenticationFactory(); - list($providerId, $listenerId, $entryPointId) = $factory->create($container, $id, $config, $userProviderId, $defaultEntryPointId); + list(, , $entryPointId) = $factory->create($container, $id, $config, $userProviderId, $defaultEntryPointId); return [$container, $entryPointId]; } diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 1404da9a1c089..84c4a0c2e0fb1 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -198,6 +198,6 @@ public function testConstructException() { $this->expectException('UnexpectedValueException'); $this->expectExceptionMessage('The cookie expiration time "string" is not valid.'); - $cookie = new Cookie('foo', 'bar', 'string'); + new Cookie('foo', 'bar', 'string'); } } diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index cac8a0ea18509..ff4fc9a29cdd5 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -156,7 +156,14 @@ public function hasItem($key) if (!$this->pool->hasItem($key)) { return false; } - if (!$itemTags = $this->pool->getItem(static::TAGS_PREFIX.$key)->get()) { + + $itemTags = $this->pool->getItem(static::TAGS_PREFIX.$key); + + if (!$itemTags->isHit()) { + return false; + } + + if (!$itemTags = $itemTags->get()) { return true; } @@ -296,7 +303,10 @@ private function generateItems($items, array $tagKeys) } unset($tagKeys[$key]); - $itemTags[$key] = $item->get() ?: []; + + if ($item->isHit()) { + $itemTags[$key] = $item->get() ?: []; + } if (!$tagKeys) { $tagVersions = $this->getTagVersions($itemTags); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php index 909191960f179..536e2c2d4d0bc 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php @@ -70,7 +70,7 @@ public function testTooLongNamespace() { $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException'); $this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")'); - $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) + $this->getMockBuilder(MaxIdLengthAdapter::class) ->setConstructorArgs([str_repeat('-', 40)]) ->getMock(); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index c8677d5e28319..0108b9250b79a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -194,6 +194,84 @@ public function testKnownTagVersionsTtl() $this->assertTrue($pool->getItem('foo')->isHit()); } + public function testTagEntryIsCreatedForItemWithoutTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $adapter = new FilesystemAdapter(); + $this->assertTrue($adapter->hasItem(TagAwareAdapter::TAGS_PREFIX.$itemKey)); + } + + public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair + + $this->assertFalse($anotherPool->hasItem($itemKey)); + } + + public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair + + $item = $anotherPool->getItem($itemKey); + $this->assertFalse($item->isHit()); + } + + public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemAndOnlyHasTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem($itemKey); //simulate losing item but keeping tags + + $this->assertFalse($anotherPool->hasItem($itemKey)); + } + + public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem($itemKey); //simulate losing item but keeping tags + + $item = $anotherPool->getItem($itemKey); + $this->assertFalse($item->isHit()); + } + /** * @return MockObject|PruneableCacheInterface */ diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php index 999687de99fd4..28046e475bb9d 100644 --- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php +++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php @@ -249,6 +249,7 @@ protected function doDelete(array $ids) foreach ($this->checkResultCode($this->getClient()->deleteMulti($encodedIds)) as $result) { if (\Memcached::RES_SUCCESS !== $result && \Memcached::RES_NOTFOUND !== $result) { $ok = false; + break; } } diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index 28ba0a6112bd0..13d2ee7d703d7 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -100,7 +100,9 @@ public function getIterator() } if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { - foreach (glob($this->prefix.$this->pattern, \defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) { + $paths = glob($this->prefix.$this->pattern, GLOB_NOSORT | (\defined('GLOB_BRACE') ? GLOB_BRACE : 0)); + sort($paths); + foreach ($paths as $path) { if ($this->recursive && is_dir($path)) { $files = iterator_to_array(new \RecursiveIteratorIterator( new \RecursiveCallbackFilterIterator( diff --git a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php index 438af9f286eae..38ae6ff7b8529 100644 --- a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php @@ -19,7 +19,7 @@ class DelegatingLoaderTest extends TestCase { public function testConstructor() { - $loader = new DelegatingLoader($resolver = new LoaderResolver()); + new DelegatingLoader($resolver = new LoaderResolver()); $this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); } diff --git a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php index 6b38e33baf4a2..ad331240debaf 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php @@ -67,7 +67,7 @@ public function testExistsKo() $loadedClass = 123; - $res = new ClassExistenceResource('MissingFooClass', false); + new ClassExistenceResource('MissingFooClass', false); $this->assertSame(123, $loadedClass); } finally { diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php index 69f781c2e980e..40b179010196d 100644 --- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -67,7 +67,7 @@ public function testResourceDoesNotExist() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The directory ".*" does not exist./'); - $resource = new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999)); + new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999)); } public function testIsFresh() @@ -165,7 +165,7 @@ public function testSerializeUnserialize() { $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); - $unserialized = unserialize(serialize($resource)); + unserialize(serialize($resource)); $this->assertSame(realpath($this->directory), $resource->getResource()); $this->assertSame('/\.(foo|xml)$/', $resource->getPattern()); diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php index bf9e6f3155b73..968c7e9266169 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php @@ -57,7 +57,7 @@ public function testResourceDoesNotExist() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessageRegExp('/The file ".*" does not exist./'); - $resource = new FileResource('/____foo/foobar'.mt_rand(1, 999999)); + new FileResource('/____foo/foobar'.mt_rand(1, 999999)); } public function testIsFresh() @@ -76,7 +76,7 @@ public function testIsFreshForDeletedResources() public function testSerializeUnserialize() { - $unserialized = unserialize(serialize($this->resource)); + unserialize(serialize($this->resource)); $this->assertSame(realpath($this->file), $this->resource->getResource()); } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index d61418f37ba47..1ef2ed3d78d7a 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -521,7 +521,7 @@ public function testFindAlternativeExceptionMessageMultiple() // Subnamespace + plural try { - $a = $application->find('foo3:'); + $application->find('foo3:'); $this->fail('->find() should throw an Symfony\Component\Console\Exception\CommandNotFoundException if a command is ambiguous because of a subnamespace, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e); diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php index 6d803fc251efe..1428cf5e97a5f 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php @@ -104,7 +104,7 @@ public function testCannotSetInvalidIndicatorCharacters() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Must have at least 2 indicator value characters.'); - $bar = new ProgressIndicator($this->getOutputStream(), null, 100, ['1']); + new ProgressIndicator($this->getOutputStream(), null, 100, ['1']); } public function testCannotStartAlreadyStartedIndicator() diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index a3b7ac63234ea..b0174187afd06 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -404,7 +404,7 @@ private function darwinRealpath($real) } if (isset($dirFiles[$file])) { - return $real .= $dirFiles[$file]; + return $real.$dirFiles[$file]; } $kFile = strtolower($file); @@ -423,7 +423,7 @@ private function darwinRealpath($real) self::$darwinCache[$kDir][1] = $dirFiles; } - return $real .= $dirFiles[$kFile]; + return $real.$dirFiles[$kFile]; } /** diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index bcb86b4e3f39f..0290b05bad484 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -256,7 +256,7 @@ function () {}, // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); - $this->assertNan($array[$i++][1]); + $this->assertNan($array[$i][1]); } public function testRecursionInArguments() diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index b6d0b03b2b24a..7596b9953bda4 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -219,7 +219,7 @@ public function dump(array $options = []) foreach ($ids as $id) { $c .= ' '.$this->doExport($id)." => true,\n"; } - $files['removed-ids.php'] = $c .= "];\n"; + $files['removed-ids.php'] = $c."];\n"; } foreach ($this->generateServiceFiles() as $file => $c) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 0bd94a3e609cb..66b6e19cc323a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -25,28 +25,28 @@ public function testProcess() { $container = new ContainerBuilder(); - $a = $container + $container ->register('a') ->addArgument($ref1 = new Reference('b')) ; - $b = $container + $container ->register('b') ->addMethodCall('setA', [$ref2 = new Reference('a')]) ; - $c = $container + $container ->register('c') ->addArgument($ref3 = new Reference('a')) ->addArgument($ref4 = new Reference('b')) ; - $d = $container + $container ->register('d') ->setProperty('foo', $ref5 = new Reference('b')) ; - $e = $container + $container ->register('e') ->setConfigurator([$ref6 = new Reference('b'), 'methodName']) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index 10c34aa489d45..348d1d7f53584 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -43,7 +43,7 @@ public function testProcessRemovesAndInlinesRecursively() ->addArgument(new Reference('c')) ; - $b = $container + $container ->register('b', '\stdClass') ->addArgument(new Reference('c')) ->setPublic(false) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php index 27bb9157c8fc0..eee4cf730c881 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveChildDefinitionsPassTest.php @@ -390,7 +390,7 @@ public function testBindings() ->setBindings(['a' => '1', 'b' => '2']) ; - $child = $container->setDefinition('child', new ChildDefinition('parent')) + $container->setDefinition('child', new ChildDefinition('parent')) ->setBindings(['b' => 'B', 'c' => 'C']) ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php index 0ab6303164688..81e05fb284bf2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php @@ -87,8 +87,8 @@ public function testAmbiguousChildDefinition() $this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); $this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.'); $container = new ContainerBuilder(); - $parent = $container->register('App\Foo', null); - $child = $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo')); + $container->register('App\Foo', null); + $container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo')); (new ResolveClassPass())->process($container); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 199179c9b4998..f2666ef9629b3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1265,7 +1265,7 @@ public function testNoClassFromGlobalNamespaceClassId() $this->expectExceptionMessage('The definition for "DateTime" has no class attribute, and appears to reference a class or interface in the global namespace.'); $container = new ContainerBuilder(); - $definition = $container->register(\DateTime::class); + $container->register(\DateTime::class); $container->compile(); } @@ -1295,7 +1295,7 @@ public function testNoClassFromNonClassId() $this->expectExceptionMessage('The definition for "123_abc" has no class.'); $container = new ContainerBuilder(); - $definition = $container->register('123_abc'); + $container->register('123_abc'); $container->compile(); } @@ -1305,7 +1305,7 @@ public function testNoClassFromNsSeparatorId() $this->expectExceptionMessage('The definition for "\foo" has no class.'); $container = new ContainerBuilder(); - $definition = $container->register('\\foo'); + $container->register('\\foo'); $container->compile(); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 4e6083d99814f..b2cbb3caf6283 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -886,7 +886,7 @@ public function testInlineSelfRef() ->setPublic(true) ->addArgument($baz); - $passConfig = $container->getCompiler()->getPassConfig(); + $container->getCompiler()->getPassConfig(); $container->compile(); $dumper = new PhpDumper($container); @@ -978,7 +978,6 @@ public function testAdawsonContainer() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump()); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 1b6e51c56757e..2b963968d8411 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -808,7 +808,6 @@ public function testTsantosContainer() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump()); } diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php index 61e776736a4b5..176ea5927fe1c 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php @@ -19,7 +19,7 @@ public function testInitialize() { $node = $this->createNode('textarea', ''); try { - $field = new ChoiceFormField($node); + new ChoiceFormField($node); $this->fail('->initialize() throws a \LogicException if the node is not an input or a select'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input or a select'); @@ -27,7 +27,7 @@ public function testInitialize() $node = $this->createNode('input', '', ['type' => 'text']); try { - $field = new ChoiceFormField($node); + new ChoiceFormField($node); $this->fail('->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio'); diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php index 9b359d69785b3..b14bcc855e2ab 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php @@ -24,7 +24,7 @@ public function testInitialize() $node = $this->createNode('textarea', ''); try { - $field = new FileFormField($node); + new FileFormField($node); $this->fail('->initialize() throws a \LogicException if the node is not an input field'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input field'); @@ -32,7 +32,7 @@ public function testInitialize() $node = $this->createNode('input', '', ['type' => 'text']); try { - $field = new FileFormField($node); + new FileFormField($node); $this->fail('->initialize() throws a \LogicException if the node is not a file input field'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a file input field'); diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/InputFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/InputFormFieldTest.php index 5758f1b7bb3fe..a1f327bbc2f81 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Field/InputFormFieldTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Field/InputFormFieldTest.php @@ -24,7 +24,7 @@ public function testInitialize() $node = $this->createNode('textarea', ''); try { - $field = new InputFormField($node); + new InputFormField($node); $this->fail('->initialize() throws a \LogicException if the node is not an input'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not an input'); @@ -32,7 +32,7 @@ public function testInitialize() $node = $this->createNode('input', '', ['type' => 'checkbox']); try { - $field = new InputFormField($node); + new InputFormField($node); $this->fail('->initialize() throws a \LogicException if the node is a checkbox'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is a checkbox'); @@ -40,7 +40,7 @@ public function testInitialize() $node = $this->createNode('input', '', ['type' => 'file']); try { - $field = new InputFormField($node); + new InputFormField($node); $this->fail('->initialize() throws a \LogicException if the node is a file'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is a file'); diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/TextareaFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/TextareaFormFieldTest.php index 5d4d0038260db..192984ce29c2f 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Field/TextareaFormFieldTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Field/TextareaFormFieldTest.php @@ -24,7 +24,7 @@ public function testInitialize() $node = $this->createNode('input', ''); try { - $field = new TextareaFormField($node); + new TextareaFormField($node); $this->fail('->initialize() throws a \LogicException if the node is not a textarea'); } catch (\LogicException $e) { $this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea'); diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 504a9bd4251d9..45d964b08c8d3 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -39,14 +39,14 @@ public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor() $nodes = $dom->getElementsByTagName('input'); try { - $form = new Form($nodes->item(0), 'http://example.com'); + new Form($nodes->item(0), 'http://example.com'); $this->fail('__construct() throws a \\LogicException if the node has no form ancestor'); } catch (\LogicException $e) { $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor'); } try { - $form = new Form($nodes->item(1), 'http://example.com'); + new Form($nodes->item(1), 'http://example.com'); $this->fail('__construct() throws a \\LogicException if the input type is not submit, button, or image'); } catch (\LogicException $e) { $this->assertTrue(true, '__construct() throws a \\LogicException if the input type is not submit, button, or image'); @@ -55,7 +55,7 @@ public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor() $nodes = $dom->getElementsByTagName('button'); try { - $form = new Form($nodes->item(0), 'http://example.com'); + new Form($nodes->item(0), 'http://example.com'); $this->fail('__construct() throws a \\LogicException if the node has no form ancestor'); } catch (\LogicException $e) { $this->assertTrue(true, '__construct() throws a \\LogicException if the node has no form ancestor'); @@ -63,11 +63,19 @@ public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor() } /** - * __construct() should throw \\LogicException if the form attribute is invalid. + * @dataProvider constructorThrowsExceptionIfNoRelatedFormProvider + * + * __construct() should throw a \LogicException if the form attribute is invalid. */ - public function testConstructorThrowsExceptionIfNoRelatedForm() + public function testConstructorThrowsExceptionIfNoRelatedForm(\DOMElement $node) { $this->expectException('LogicException'); + + new Form($node, 'http://example.com'); + } + + public function constructorThrowsExceptionIfNoRelatedFormProvider() + { $dom = new \DOMDocument(); $dom->loadHTML(' @@ -81,8 +89,10 @@ public function testConstructorThrowsExceptionIfNoRelatedForm() $nodes = $dom->getElementsByTagName('input'); - $form = new Form($nodes->item(0), 'http://example.com'); - $form = new Form($nodes->item(1), 'http://example.com'); + return [ + [$nodes->item(0)], + [$nodes->item(1)], + ]; } public function testConstructorLoadsOnlyFieldsOfTheRightForm() diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index c6fc3cbda9ea5..c2475f204a8bb 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -183,29 +183,24 @@ private function lexValue() throw $this->createFormatException('Whitespace are not supported before the value'); } + $loadedVars = array_flip(explode(',', isset($_SERVER['SYMFONY_DOTENV_VARS']) ? $_SERVER['SYMFONY_DOTENV_VARS'] : (isset($_ENV['SYMFONY_DOTENV_VARS']) ? $_ENV['SYMFONY_DOTENV_VARS'] : ''))); + unset($loadedVars['']); $v = ''; do { if ("'" === $this->data[$this->cursor]) { - $value = ''; - ++$this->cursor; + $len = 0; - while ("\n" !== $this->data[$this->cursor]) { - if ("'" === $this->data[$this->cursor]) { - break; - } - $value .= $this->data[$this->cursor]; - ++$this->cursor; + do { + if ($this->cursor + ++$len === $this->end) { + $this->cursor += $len; - if ($this->cursor === $this->end) { throw $this->createFormatException('Missing quote to end the value'); } - } - if ("\n" === $this->data[$this->cursor]) { - throw $this->createFormatException('Missing quote to end the value'); - } - ++$this->cursor; - $v .= $value; + } while ("'" !== $this->data[$this->cursor + $len]); + + $v .= substr($this->data, 1 + $this->cursor, $len - 1); + $this->cursor += 1 + $len; } elseif ('"' === $this->data[$this->cursor]) { $value = ''; ++$this->cursor; @@ -224,8 +219,8 @@ private function lexValue() ++$this->cursor; $value = str_replace(['\\"', '\r', '\n'], ['"', "\r", "\n"], $value); $resolvedValue = $value; - $resolvedValue = $this->resolveVariables($resolvedValue); - $resolvedValue = $this->resolveCommands($resolvedValue); + $resolvedValue = $this->resolveVariables($resolvedValue, $loadedVars); + $resolvedValue = $this->resolveCommands($resolvedValue, $loadedVars); $resolvedValue = str_replace('\\\\', '\\', $resolvedValue); $v .= $resolvedValue; } else { @@ -247,8 +242,8 @@ private function lexValue() } $value = rtrim($value); $resolvedValue = $value; - $resolvedValue = $this->resolveVariables($resolvedValue); - $resolvedValue = $this->resolveCommands($resolvedValue); + $resolvedValue = $this->resolveVariables($resolvedValue, $loadedVars); + $resolvedValue = $this->resolveCommands($resolvedValue, $loadedVars); $resolvedValue = str_replace('\\\\', '\\', $resolvedValue); if ($resolvedValue === $value && preg_match('/\s+/', $value)) { @@ -301,7 +296,7 @@ private function skipEmptyLines() } } - private function resolveCommands($value) + private function resolveCommands($value, $loadedVars) { if (false === strpos($value, '$')) { return $value; @@ -317,7 +312,7 @@ private function resolveCommands($value) ) /x'; - return preg_replace_callback($regex, function ($matches) { + return preg_replace_callback($regex, function ($matches) use ($loadedVars) { if ('\\' === $matches[1]) { return substr($matches[0], 1); } @@ -332,7 +327,15 @@ private function resolveCommands($value) $process = new Process('echo '.$matches[0]); $process->inheritEnvironmentVariables(true); - $process->setEnv($this->values); + + $env = []; + foreach ($this->values as $name => $value) { + if (isset($loadedVars[$name]) || (!isset($_ENV[$name]) && !(isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')))) { + $env[$name] = $value; + } + } + $process->setEnv($env); + try { $process->mustRun(); } catch (ProcessException $e) { @@ -343,7 +346,7 @@ private function resolveCommands($value) }, $value); } - private function resolveVariables($value) + private function resolveVariables($value, array $loadedVars) { if (false === strpos($value, '$')) { return $value; @@ -359,7 +362,7 @@ private function resolveVariables($value) (?P\})? # optional closing brace /x'; - $value = preg_replace_callback($regex, function ($matches) { + $value = preg_replace_callback($regex, function ($matches) use ($loadedVars) { // odd number of backslashes means the $ character is escaped if (1 === \strlen($matches['backslashes']) % 2) { return substr($matches[0], 1); @@ -375,14 +378,16 @@ private function resolveVariables($value) } $name = $matches['name']; - if (isset($this->values[$name])) { + if (isset($loadedVars[$name]) && isset($this->values[$name])) { $value = $this->values[$name]; - } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { - $value = $_SERVER[$name]; } elseif (isset($_ENV[$name])) { $value = $_ENV[$name]; + } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { + $value = $_SERVER[$name]; + } elseif (isset($this->values[$name])) { + $value = $this->values[$name]; } else { - $value = (string) getenv($name); + $value = ''; } if (!$matches['opening_brace'] && isset($matches['closing_brace'])) { diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index b920270da9d7d..1e493f24bdb5b 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -40,6 +40,7 @@ public function getEnvDataWithFormatErrors() ['FOO', "Missing = in the environment variable declaration in \".env\" at line 1.\n...FOO...\n ^ line 1 offset 3"], ['FOO="foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo...\n ^ line 1 offset 8"], ['FOO=\'foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo...\n ^ line 1 offset 8"], + ['FOO=\'foo'."\n", "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo\\n...\n ^ line 1 offset 9"], ['export FOO', "Unable to unset an environment variable in \".env\" at line 1.\n...export FOO...\n ^ line 1 offset 10"], ['FOO=${FOO', "Unclosed braces on variable expansion in \".env\" at line 1.\n...FOO=\${FOO...\n ^ line 1 offset 9"], ]; @@ -63,6 +64,7 @@ public function testParse($data, $expected) public function getEnvData() { putenv('LOCAL=local'); + $_ENV['LOCAL'] = 'local'; $_ENV['REMOTE'] = 'remote'; $tests = [ @@ -104,6 +106,7 @@ public function getEnvData() ['FOO="bar\rfoo"', ['FOO' => "bar\rfoo"]], ['FOO=\'bar\nfoo\'', ['FOO' => 'bar\nfoo']], ['FOO=\'bar\rfoo\'', ['FOO' => 'bar\rfoo']], + ["FOO='bar\nfoo'", ['FOO' => "bar\nfoo"]], ['FOO=" FOO "', ['FOO' => ' FOO ']], ['FOO=" "', ['FOO' => ' ']], ['PATH="c:\\\\"', ['PATH' => 'c:\\']], @@ -295,4 +298,20 @@ public function testOverridingEnvVarsWithNamesMemorizedInSpecialVar() $this->assertSame('baz1', getenv('BAZ')); $this->assertSame('/var/www', getenv('DOCUMENT_ROOT')); } + + public function testGetVariablesValueFromEnvFirst() + { + $_ENV['APP_ENV'] = 'prod'; + $dotenv = new Dotenv(true); + + $test = "APP_ENV=dev\nTEST1=foo1_\${APP_ENV}"; + $values = $dotenv->parse($test); + $this->assertSame('foo1_prod', $values['TEST1']); + + if ('\\' !== \DIRECTORY_SEPARATOR) { + $test = "APP_ENV=dev\nTEST2=foo2_\$(php -r 'echo \$_SERVER[\"APP_ENV\"];')"; + $values = $dotenv->parse($test); + $this->assertSame('foo2_prod', $values['TEST2']); + } + } } diff --git a/src/Symfony/Component/Dotenv/composer.json b/src/Symfony/Component/Dotenv/composer.json index 3bcfd89c8d350..e35339c98e111 100644 --- a/src/Symfony/Component/Dotenv/composer.json +++ b/src/Symfony/Component/Dotenv/composer.json @@ -19,7 +19,7 @@ "php": "^5.5.9|>=7.0.8" }, "require-dev": { - "symfony/process": "~3.2|~4.0" + "symfony/process": "^3.4.2|^4.0" }, "autoload": { "psr-4": { "Symfony\\Component\\Dotenv\\": "" }, diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index 34e28bcbb21fc..61c047af39c46 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -37,10 +37,6 @@ public function testEventSubscriberWithoutInterface() public function testValidEventSubscriber() { - $services = [ - 'my_event_subscriber' => [0 => []], - ]; - $builder = new ContainerBuilder(); $eventDispatcherDefinition = $builder->register('event_dispatcher'); $builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService') diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 22d1d1649da12..f69ee57982e8a 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -98,7 +98,7 @@ public function testWrongCacheImplementation() $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Cache argument has to implement Psr\Cache\CacheItemPoolInterface.'); $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock(); - $expressionLanguage = new ExpressionLanguage($cacheMock); + new ExpressionLanguage($cacheMock); } public function testConstantFunction() @@ -196,7 +196,7 @@ public function testCachingWithDifferentNamesOrder() $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock(); $expressionLanguage = new ExpressionLanguage($cacheMock); - $savedParsedExpressions = []; + $savedParsedExpression = null; $cacheMock ->expects($this->exactly(2)) diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php index 28e9ef5725043..2e9263307f0dd 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserCache/ParserCacheAdapterTest.php @@ -68,7 +68,7 @@ public function testSave() ->willReturn($value) ; - $cacheItem = $parserCacheAdapter->save($cacheItemMock); + $parserCacheAdapter->save($cacheItemMock); } public function testGetItems() diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index e933f078416be..6624e840791fb 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -541,7 +541,8 @@ public function in($dirs) foreach ((array) $dirs as $dir) { if (is_dir($dir)) { $resolvedDirs[] = $this->normalizeDir($dir); - } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { + } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) { + sort($glob); $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob)); } else { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php index 88fa453a62580..e8545232bf2fb 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php @@ -128,7 +128,8 @@ public function collectDefaultData(FormInterface $form) $hash = spl_object_hash($form); if (!isset($this->dataByForm[$hash])) { - $this->dataByForm[$hash] = []; + // field was created by form event + $this->collectConfiguration($form); } $this->dataByForm[$hash] = array_replace( diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index d4602b88fd66a..ce91d05ff4b6c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -181,10 +181,10 @@ public function testTransformRequiresValidDateTime() public function testTransformWrapsIntlErrors() { - $transformer = new DateTimeToLocalizedStringTransformer(); - $this->markTestIncomplete('Checking for intl errors needs to be reimplemented'); + $transformer = new DateTimeToLocalizedStringTransformer(); + // HOW TO REPRODUCE? //$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException'); diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php index 16aea8dfc4d5c..5cbc37b0a7628 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php @@ -13,10 +13,20 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\Form\Extension\Core\CoreExtension; +use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\DataCollector\FormDataCollector; use Symfony\Component\Form\Form; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormFactory; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ResolvedFormTypeFactory; class FormDataCollectorTest extends TestCase { @@ -69,9 +79,9 @@ protected function setUp() { $this->dataExtractor = $this->getMockBuilder('Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface')->getMock(); $this->dataCollector = new FormDataCollector($this->dataExtractor); - $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(); - $this->dataMapper = $this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock(); + $this->dispatcher = new EventDispatcher(); + $this->factory = new FormFactory(new FormRegistry([new CoreExtension()], new ResolvedFormTypeFactory())); + $this->dataMapper = new PropertyPathMapper(); $this->form = $this->createForm('name'); $this->childForm = $this->createForm('child'); $this->view = new FormView(); @@ -726,6 +736,56 @@ public function testReset() ); } + public function testCollectMissingDataFromChildFormAddedOnFormEvents() + { + $form = $this->factory->createNamedBuilder('root', FormType::class, ['items' => null]) + ->add('items', CollectionType::class, [ + 'entry_type' => TextType::class, + 'allow_add' => true, + // data is locked and modelData (null) is different to the + // configured data, so modifications of the configured data + // won't be allowed at this point. It also means *_SET_DATA + // events won't dispatched either. Therefore, no child form + // is created during the mapping of data to the form. + 'data' => ['foo'], + ]) + ->getForm() + ; + $this->dataExtractor->expects($extractConfiguration = $this->exactly(4)) + ->method('extractConfiguration') + ->willReturn([]) + ; + $this->dataExtractor->expects($extractDefaultData = $this->exactly(4)) + ->method('extractDefaultData') + ->willReturnCallback(static function (FormInterface $form) { + // this simulate the call in extractDefaultData() method + // where (if defaultDataSet is false) it fires *_SET_DATA + // events, adding the form related to the configured data + $form->getNormData(); + + return []; + }) + ; + $this->dataExtractor->expects($this->exactly(4)) + ->method('extractSubmittedData') + ->willReturn([]) + ; + + $this->dataCollector->collectConfiguration($form); + $this->assertSame(2, $extractConfiguration->getInvocationCount(), 'only "root" and "items" forms were collected, the "items" children do not exist yet.'); + + $this->dataCollector->collectDefaultData($form); + $this->assertSame(3, $extractConfiguration->getInvocationCount(), 'extracted missing configuration of the "items" children ["0" => foo].'); + $this->assertSame(3, $extractDefaultData->getInvocationCount()); + $this->assertSame(['foo'], $form->get('items')->getData()); + + $form->submit(['items' => ['foo', 'bar']]); + $this->dataCollector->collectSubmittedData($form); + $this->assertSame(4, $extractConfiguration->getInvocationCount(), 'extracted missing configuration of the "items" children ["1" => bar].'); + $this->assertSame(4, $extractDefaultData->getInvocationCount(), 'extracted missing default data of the "items" children ["1" => bar].'); + $this->assertSame(['foo', 'bar'], $form->get('items')->getData()); + } + private function createForm($name) { $builder = new FormBuilder($name, null, $this->dispatcher, $this->factory); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index b75242afd0d61..cfa76843cc4f7 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -89,7 +89,7 @@ public function guess($path) $type = trim(ob_get_clean()); - if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { + if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\+\.]+)#i', $type, $match)) { // it's not a type, but an error message return null; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index 4186c72a62c2f..2ea924bac2a4d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -153,7 +153,7 @@ public function testMoveLocalFileIsNotAllowed() UPLOAD_ERR_OK ); - $movedFile = $file->move(__DIR__.'/Fixtures/directory'); + $file->move(__DIR__.'/Fixtures/directory'); } public function testMoveLocalFileIsAllowedInTestMode() diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index dcc266f69c41a..cabe038bdf00b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -59,7 +59,7 @@ public function testGetDateException() { $this->expectException('RuntimeException'); $bag = new HeaderBag(['foo' => 'Tue']); - $headerDate = $bag->getDate('foo'); + $bag->getDate('foo'); } public function testGetCacheControlHeader() diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php index 92f4876da4ff1..e1ff3bf2bdb98 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php @@ -29,13 +29,13 @@ public function testGenerateMetaRedirect() public function testRedirectResponseConstructorNullUrl() { $this->expectException('InvalidArgumentException'); - $response = new RedirectResponse(null); + new RedirectResponse(null); } public function testRedirectResponseConstructorWrongStatusCode() { $this->expectException('InvalidArgumentException'); - $response = new RedirectResponse('foo.bar', 404); + new RedirectResponse('foo.bar', 404); } public function testGenerateLocationHeader() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index 9daf1a0eeee7a..7de55798a6413 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -41,7 +41,7 @@ public function testConstruct() */ public function testConstructSavePath($savePath, $expectedSavePath, $path) { - $handler = new NativeFileSessionHandler($savePath); + new NativeFileSessionHandler($savePath); $this->assertEquals($expectedSavePath, ini_get('session.save_path')); $this->assertDirectoryExists(realpath($path)); @@ -62,13 +62,13 @@ public function savePathDataProvider() public function testConstructException() { $this->expectException('InvalidArgumentException'); - $handler = new NativeFileSessionHandler('something;invalid;with;too-many-args'); + new NativeFileSessionHandler('something;invalid;with;too-many-args'); } public function testConstructDefault() { $path = ini_get('session.save_path'); - $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler()); + new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler()); $this->assertEquals($path, ini_get('session.save_path')); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 0d246e1aa560b..f793db144c6ac 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -28,7 +28,7 @@ class NullSessionHandlerTest extends TestCase { public function testSaveHandlers() { - $storage = $this->getStorage(); + $this->getStorage(); $this->assertEquals('user', ini_get('session.save_handler')); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 123b605d28600..e710dca92cf8c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -54,7 +54,7 @@ public function testWrongPdoErrMode() $pdo = $this->getMemorySqlitePdo(); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); - $storage = new PdoSessionHandler($pdo); + new PdoSessionHandler($pdo); } public function testInexistentTable() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index fa170d17d3b32..9ce8108dacc61 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -145,7 +145,7 @@ public function testDefaultSessionCacheLimiter() { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(); + new NativeSessionStorage(); $this->assertEquals('', ini_get('session.cache_limiter')); } @@ -153,7 +153,7 @@ public function testExplicitSessionCacheLimiter() { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(['cache_limiter' => 'public']); + new NativeSessionStorage(['cache_limiter' => 'public']); $this->assertEquals('public', ini_get('session.cache_limiter')); } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 671865aa16b17..246c0c7f6f2ee 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -49,7 +49,6 @@ public function collect(Request $request, Response $response, \Exception $except } } - $content = null; try { $content = $request->getContent(); } catch (\LogicException $e) { @@ -59,7 +58,6 @@ public function collect(Request $request, Response $response, \Exception $except $sessionMetadata = []; $sessionAttributes = []; - $session = null; $flashes = []; if ($request->hasSession()) { $session = $request->getSession(); diff --git a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php index 25c071c335a02..3bdf0f5199891 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php @@ -130,7 +130,6 @@ public function update(Response $response) $response->headers->set('Cache-Control', implode(', ', array_keys($flags))); $maxAge = null; - $sMaxage = null; if (is_numeric($this->ageDirectives['max-age'])) { $maxAge = $this->ageDirectives['max-age'] + $this->age; diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 2f6a6e4612e68..0f310d1087823 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.32'; - const VERSION_ID = 30432; + const VERSION = '3.4.33'; + const VERSION_ID = 30433; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 32; + const RELEASE_VERSION = 33; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; @@ -868,7 +868,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } - $legacyFile = \dirname($dir.$file).'.legacy'; + $legacyFile = \dirname($dir.key($content)).'.legacy'; if (file_exists($legacyFile)) { @unlink($legacyFile); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index 32cfcb8604a84..ef4c8b2172f67 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -256,7 +256,7 @@ public function testArgumentWithNoTypeHintIsOk() public function testControllersAreMadePublic() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument([]); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) ->setPublic(false) diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index fc47ff2c88c56..77cb34cfa5556 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -52,7 +52,7 @@ public function testReadsAnEmptyArrayWithReadWhenNothingCachedAtKey() public function testUnlockFileThatDoesExist() { - $cacheKey = $this->storeSimpleEntry(); + $this->storeSimpleEntry(); $this->store->lock($this->request); $this->assertTrue($this->store->unlock($this->request)); @@ -92,7 +92,7 @@ public function testSetsTheXContentDigestResponseHeaderBeforeStoring() { $cacheKey = $this->storeSimpleEntry(); $entries = $this->getStoreMetadata($cacheKey); - list($req, $res) = $entries[0]; + list(, $res) = $entries[0]; $this->assertEquals('en9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', $res['x-content-digest'][0]); } @@ -208,7 +208,7 @@ public function testOverwritesNonVaryingResponseWithStore() { $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); - $key = $this->store->write($req1, $res1); + $this->store->write($req1, $res1); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); @@ -229,7 +229,7 @@ public function testLocking() $req = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $this->assertTrue($this->store->lock($req)); - $path = $this->store->lock($req); + $this->store->lock($req); $this->assertTrue($this->store->isLocked($req)); $this->store->unlock($req); diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index 8ed03c2af20a7..fd8a603fe24c6 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -734,7 +734,7 @@ public function offsetGet($option) // Validate the type of the resolved option if (isset($this->allowedTypes[$option])) { - $valid = false; + $valid = true; $invalidTypes = []; foreach ($this->allowedTypes[$option] as $type) { @@ -746,13 +746,22 @@ public function offsetGet($option) } if (!$valid) { - $keys = array_keys($invalidTypes); + $fmtActualValue = $this->formatValue($value); + $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]); + $fmtProvidedTypes = implode('|', array_keys($invalidTypes)); + + $allowedContainsArrayType = \count(array_filter( + $this->allowedTypes[$option], + function ($item) { + return '[]' === substr(isset(self::$typeAliases[$item]) ? self::$typeAliases[$item] : $item, -2); + } + )) > 0; - if (1 === \count($keys) && '[]' === substr($keys[0], -2)) { - throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $keys[0])); + if (\is_array($value) && $allowedContainsArrayType) { + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); } - throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), implode('|', array_keys($invalidTypes)))); + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); } } @@ -858,21 +867,14 @@ private function verifyArrayType($type, array $value, array &$invalidTypes, $lev { $type = substr($type, 0, -2); - $suffix = '[]'; - while (\strlen($suffix) <= $level * 2) { - $suffix .= '[]'; - } - if ('[]' === substr($type, -2)) { $success = true; foreach ($value as $item) { if (!\is_array($item)) { - $invalidTypes[$this->formatTypeOf($item, null).$suffix] = true; + $invalidTypes[$this->formatTypeOf($item, null)] = true; - return false; - } - - if (!$this->verifyArrayType($type, $item, $invalidTypes, $level + 1)) { + $success = false; + } elseif (!$this->verifyArrayType($type, $item, $invalidTypes, $level + 1)) { $success = false; } } @@ -880,15 +882,17 @@ private function verifyArrayType($type, array $value, array &$invalidTypes, $lev return $success; } + $valid = true; + foreach ($value as $item) { if (!self::isValueValidType($type, $item)) { - $invalidTypes[$this->formatTypeOf($item, $type).$suffix] = $value; + $invalidTypes[$this->formatTypeOf($item, $type)] = $value; - return false; + $valid = false; } } - return true; + return $valid; } /** diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index cbdaaf024abae..ce90f93791edc 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -466,7 +466,7 @@ public function testFailIfSetAllowedTypesFromLazyOption() public function testResolveFailsIfInvalidTypedArray() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime[]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[]'); @@ -486,9 +486,10 @@ public function testResolveFailsWithNonArray() public function testResolveFailsIfTypedArrayContainsInvalidTypes() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass[]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass|array|DateTime".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[]'); + $values = range(1, 5); $values[] = new \stdClass(); $values[] = []; @@ -501,7 +502,7 @@ public function testResolveFailsIfTypedArrayContainsInvalidTypes() public function testResolveFailsWithCorrectLevelsButWrongScalar() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double[][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); @@ -537,6 +538,11 @@ public function provideInvalidTypes() [42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'], [null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'], ['bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'], + [['foo', 12], 'string[]', 'The option "option" with value array is expected to be of type "string[]", but one of the elements is of type "integer".'], + [123, ['string[]', 'string'], 'The option "option" with value 123 is expected to be of type "string[]" or "string", but is of type "integer".'], + [[null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'], + [['string', null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'], + [[\stdClass::class], ['string'], 'The option "option" with value array is expected to be of type "string", but is of type "array".'], ]; } @@ -585,6 +591,7 @@ public function testResolveSucceedsIfTypedArray() new \DateTime(), ], ]; + $result = $this->resolver->resolve($data); $this->assertEquals($data, $result); } @@ -1535,7 +1542,7 @@ public function testNested2Arrays() public function testNestedArraysException() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer[][][][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'float[][][][]'); @@ -1553,7 +1560,7 @@ public function testNestedArraysException() public function testNestedArrayException1() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); $this->resolver->resolve([ @@ -1566,7 +1573,7 @@ public function testNestedArrayException1() public function testNestedArrayException2() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); $this->resolver->resolve([ @@ -1579,7 +1586,7 @@ public function testNestedArrayException2() public function testNestedArrayException3() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string[][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string|integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[][][]'); $this->resolver->resolve([ @@ -1592,7 +1599,7 @@ public function testNestedArrayException3() public function testNestedArrayException4() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer[][][]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[][][]'); $this->resolver->resolve([ @@ -1606,7 +1613,7 @@ public function testNestedArrayException4() public function testNestedArrayException5() { $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array[]".'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[]'); $this->resolver->resolve([ diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php index a437f2bb6f771..2942695af37e4 100644 --- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php @@ -132,9 +132,6 @@ public function testFindProcessInOpenBasedir() $this->assertSamePath(PHP_BINARY, $result); } - /** - * @requires PHP 5.4 - */ public function testFindBatchExecutableOnWindows() { if (ini_get('open_basedir')) { diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index bb8138dc1a88d..dcb06ee192249 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -103,8 +103,8 @@ public function getProperties($class, array $context = []) if (!$propertyName || isset($properties[$propertyName])) { continue; } - if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) { - $propertyName = lcfirst($propertyName); + if ($reflectionClass->hasProperty($lowerCasedPropertyName = lcfirst($propertyName)) || (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName))) { + $propertyName = $lowerCasedPropertyName; } $properties[$propertyName] = $propertyName; } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 0ed5390bb5882..5a5c0c7b62c6a 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -59,6 +59,8 @@ public function testGetProperties() '123', 'self', 'realParent', + 'xTotals', + 'YT', 'c', 'd', 'e', diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 5b82209e1d417..663fef84c7760 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -93,6 +93,16 @@ class Dummy extends ParentDummy */ public $j; + /** + * @var array + */ + private $xTotals; + + /** + * @var string + */ + private $YT; + /** * This should not be removed. * @@ -166,4 +176,18 @@ public function setSelf(self $self) public function setRealParent(parent $realParent) { } + + /** + * @return array + */ + public function getXTotals() + { + } + + /** + * @return string + */ + public function getYT() + { + } } diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php index 7614caea3dc40..d0cc02d1c3fba 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php @@ -39,7 +39,8 @@ public function __construct(RouteCollection $collection, PhpFileLoader $loader, final public function import($resource, $type = null, $ignoreErrors = false) { $this->loader->setCurrentDir(\dirname($this->path)); - $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file); + $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file) ?: []; + if (!\is_array($imported)) { return new ImportConfigurator($this->collection, $imported); } diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index c114310fc3232..29dfdb1665b56 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -146,7 +146,8 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $ $this->setCurrentDir(\dirname($path)); - $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file); + /** @var RouteCollection[] $imported */ + $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file) ?: []; if (!\is_array($imported)) { $imported = [$imported]; diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index bc21e9cb4db7c..568827695bbea 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -158,7 +158,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path $this->setCurrentDir(\dirname($path)); - $imported = $this->import($config['resource'], $type, false, $file); + $imported = $this->import($config['resource'], $type, false, $file) ?: []; if (!\is_array($imported)) { $imported = [$imported]; diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index 08eed456aaa7a..b698be8f667dc 100644 --- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -19,7 +19,7 @@ class RouteTest extends TestCase public function testInvalidRouteParameter() { $this->expectException('BadMethodCallException'); - $route = new Route(['foo' => 'bar']); + new Route(['foo' => 'bar']); } /** diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php index ee8f4b071a368..c06fb43f6887e 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php @@ -6,7 +6,7 @@ trait FooTrait { public function doBar() { - $baz = self::class; + self::class; if (true) { } } diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index d3ddb9f3b1838..4e725fa8bb510 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -135,7 +135,7 @@ public function testGenerateNonExistingRoute() include $this->testTmpFilepath; $projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext()); - $url = $projectUrlGenerator->generate('NonExisting', []); + $projectUrlGenerator->generate('NonExisting', []); } public function testDumpForRouteWithDefaults() diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index 8af8e2e14ff2d..0b1175f605eec 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -35,9 +35,6 @@ public function testLoad() $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); } - /** - * @requires PHP 5.4 - */ public function testLoadTraitWithClassConstant() { $this->reader->expects($this->never())->method('getClassAnnotation'); diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php index a460c6651cc65..b398b2f35e90f 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php @@ -248,7 +248,7 @@ public function testRouteWithSameVariableTwice() $this->expectException('LogicException'); $route = new Route('/{name}/{name}'); - $compiled = $route->compile(); + $route->compile(); } public function testRouteCharsetMismatch() @@ -256,7 +256,7 @@ public function testRouteCharsetMismatch() $this->expectException('LogicException'); $route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]); - $compiled = $route->compile(); + $route->compile(); } public function testRequirementCharsetMismatch() @@ -264,7 +264,7 @@ public function testRequirementCharsetMismatch() $this->expectException('LogicException'); $route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]); - $compiled = $route->compile(); + $route->compile(); } public function testRouteWithFragmentAsPathParameter() @@ -272,7 +272,7 @@ public function testRouteWithFragmentAsPathParameter() $this->expectException('InvalidArgumentException'); $route = new Route('/{_fragment}'); - $compiled = $route->compile(); + $route->compile(); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php index 0b2c36c72de4a..48b7ebcbb269f 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php @@ -117,7 +117,7 @@ public function testGetInvalidNamedEncoderForEncoderAware() $user = new EncAwareUser('user', 'pass'); $user->encoderName = 'invalid_encoder_name'; - $encoder = $factory->getEncoder($user); + $factory->getEncoder($user); } public function testGetEncoderForEncoderAwareWithClassName() diff --git a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php index 2c4faaa31a90b..c2c1dde623b93 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php @@ -192,7 +192,7 @@ public function testGuardWithNoLongerAuthenticatedTriggersLogout() $token->setAuthenticated(false); $provider = new GuardAuthenticationProvider([], $this->userProvider, $providerKey, $this->userChecker); - $actualToken = $provider->authenticate($token); + $provider->authenticate($token); } public function testSupportsChecksGuardAuthenticatorsTokenOrigin() diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php index 2b6e662700da3..fd49b54ccc2b2 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php @@ -20,7 +20,7 @@ class LogoutListenerTest extends TestCase { public function testHandleUnmatchedPath() { - list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener(); + list($listener, , $httpUtils, $options) = $this->getListener(); list($event, $request) = $this->getGetResponseEvent(); @@ -130,7 +130,7 @@ public function testSuccessHandlerReturnsNonResponse() $this->expectException('RuntimeException'); $successHandler = $this->getSuccessHandler(); - list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener($successHandler); + list($listener, , $httpUtils, $options) = $this->getListener($successHandler); list($event, $request) = $this->getGetResponseEvent(); @@ -152,7 +152,7 @@ public function testCsrfValidationFails() $this->expectException('Symfony\Component\Security\Core\Exception\LogoutException'); $tokenManager = $this->getTokenManager(); - list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener(null, $tokenManager); + list($listener, , $httpUtils, $options) = $this->getListener(null, $tokenManager); list($event, $request) = $this->getGetResponseEvent(); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php index 4478a1a4d8b89..0770872968c5b 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php @@ -221,7 +221,7 @@ public function testOnCoreSecurity() public function testSessionStrategy() { - list($listener, $tokenStorage, $service, $manager, , $dispatcher, $sessionStrategy) = $this->getListener(false, true, true); + list($listener, $tokenStorage, $service, $manager, , , $sessionStrategy) = $this->getListener(false, true, true); $tokenStorage ->expects($this->once()) @@ -286,7 +286,7 @@ public function testSessionStrategy() public function testSessionIsMigratedByDefault() { - list($listener, $tokenStorage, $service, $manager, , $dispatcher, $sessionStrategy) = $this->getListener(false, true, false); + list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, true, false); $tokenStorage ->expects($this->once()) diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php index 02d1ba03ce441..fd29297a5778e 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RemoteUserAuthenticationListenerTest.php @@ -60,7 +60,7 @@ public function testGetPreAuthenticatedDataNoUser() $method = new \ReflectionMethod($listener, 'getPreAuthenticatedData'); $method->setAccessible(true); - $result = $method->invokeArgs($listener, [$request]); + $method->invokeArgs($listener, [$request]); } public function testGetPreAuthenticatedDataWithDifferentKeys() diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php index e35e685d5bf88..c81b2d589ed06 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/X509AuthenticationListenerTest.php @@ -98,7 +98,7 @@ public function testGetPreAuthenticatedDataNoData() $method = new \ReflectionMethod($listener, 'getPreAuthenticatedData'); $method->setAccessible(true); - $result = $method->invokeArgs($listener, [$request]); + $method->invokeArgs($listener, [$request]); } public function testGetPreAuthenticatedDataWithDifferentKeys() diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php index 673a8be7139d0..774db6128f379 100644 --- a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php +++ b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php @@ -48,8 +48,6 @@ public function testOnKernelRequestRegistersExceptionListener() public function testOnKernelRequestStopsWhenThereIsAResponse() { - $response = new Response(); - $first = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock(); $first ->expects($this->once()) diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php index 465636eb9f77e..0a97ea7b8a9d2 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php @@ -65,8 +65,6 @@ public function testRememberMeCookieIsNotSendWithResponse() public function testItSubscribesToTheOnKernelResponseEvent() { - $listener = new ResponseListener(); - $this->assertSame([KernelEvents::RESPONSE => 'onKernelResponse'], ResponseListener::getSubscribedEvents()); } diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 3a76665a0bca1..c1e1109130479 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -426,7 +426,7 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null) return $this->appendNode($parentNode, $data, 'data'); } - throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', var_export($data, true))); + throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); } /** diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index fd6b7dd0598e8..a29a1482ddef8 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -164,7 +164,7 @@ public function normalize($data, $format = null, array $context = []) throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data))); } - throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', var_export($data, true))); + throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); } /** diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 4f83bf3a58790..f1a8b6ab480e0 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\XmlEncoder; +use Symfony\Component\Serializer\Exception\NotEncodableValueException; use Symfony\Component\Serializer\Normalizer\CustomNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Serializer; @@ -679,6 +680,14 @@ public function testEncodeXmlWithDateTimeObjectField() $this->assertEquals($this->createXmlWithDateTimeField(), $actualXml); } + public function testNotEncodableValueExceptionMessageForAResource() + { + $this->expectException(NotEncodableValueException::class); + $this->expectExceptionMessage('An unexpected value could not be serialized: stream resource'); + + (new XmlEncoder())->encode(tmpfile(), 'xml'); + } + /** * @return XmlEncoder */ diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php index c4814e364f53e..5652768fcab4f 100644 --- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php +++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\JsonEncoder; +use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; use Symfony\Component\Serializer\Normalizer\CustomNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -328,6 +329,14 @@ public function testDeserializeObjectConstructorWithObjectTypeHint() $this->assertEquals(new Foo(new Bar('baz')), $serializer->deserialize($jsonData, Foo::class, 'json')); } + + public function testNotNormalizableValueExceptionMessageForAResource() + { + $this->expectException(NotNormalizableValueException::class); + $this->expectExceptionMessage('An unexpected value could not be normalized: stream resource'); + + (new Serializer())->normalize(tmpfile()); + } } class Model diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php index c6dcdefc95f51..781e19d935a71 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php @@ -27,7 +27,6 @@ public static function setUpBeforeClass() public function testConstructor() { $pathPattern = self::$fixturesPath.'/templates/%name%.%engine%'; - $path = self::$fixturesPath.'/templates'; $loader = new ProjectTemplateLoader2($pathPattern); $this->assertEquals([$pathPattern], $loader->getTemplatePathPatterns(), '__construct() takes a path as its second argument'); $loader = new ProjectTemplateLoader2([$pathPattern]); diff --git a/src/Symfony/Component/Translation/Resources/bin/translation-status.php b/src/Symfony/Component/Translation/Resources/bin/translation-status.php index 669b8f2864730..44918c92ec527 100644 --- a/src/Symfony/Component/Translation/Resources/bin/translation-status.php +++ b/src/Symfony/Component/Translation/Resources/bin/translation-status.php @@ -89,7 +89,8 @@ function findTranslationFiles($originalFilePath, $localeToAnalyze) $originalFileName = basename($originalFilePath); $translationFileNamePattern = str_replace('.en.', '.*.', $originalFileName); - $translationFiles = glob($translationsDir.'/'.$translationFileNamePattern); + $translationFiles = glob($translationsDir.'/'.$translationFileNamePattern, GLOB_NOSORT); + sort($translationFiles); foreach ($translationFiles as $filePath) { $locale = extractLocaleFromFilePath($filePath); diff --git a/src/Symfony/Component/Validator/Constraints/FileValidator.php b/src/Symfony/Component/Validator/Constraints/FileValidator.php index d3e3833ab72c0..0a58cd2d687a0 100644 --- a/src/Symfony/Component/Validator/Constraints/FileValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FileValidator.php @@ -60,7 +60,7 @@ public function validate($value, Constraint $constraint) $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } - list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); + list(, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf index db534528d1d99..bfa9b1284e8d9 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf @@ -334,6 +334,38 @@ This value should be valid JSON. Verdien er ikke gyldig JSON. + + This collection should contain only unique elements. + Samlingen kan kun inneholde unike elementer. + + + This value should be positive. + Denne verdien må være positiv. + + + This value should be either positive or zero. + Denne verdien må være positiv eller null. + + + This value should be negative. + Denne verdien må være negativ. + + + This value should be either negative or zero. + Denne verdien må være negativ eller null. + + + This value is not a valid timezone. + Verdien er ikke en gyldig tidssone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dette passordet er lekket i et datainnbrudd, det må ikke tas i bruk. Vennligst bruk et annet passord. + + + This value should be between {{ min }} and {{ max }}. + Verdien må være mellom {{ min }} og {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf index db534528d1d99..bfa9b1284e8d9 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf @@ -334,6 +334,38 @@ This value should be valid JSON. Verdien er ikke gyldig JSON. + + This collection should contain only unique elements. + Samlingen kan kun inneholde unike elementer. + + + This value should be positive. + Denne verdien må være positiv. + + + This value should be either positive or zero. + Denne verdien må være positiv eller null. + + + This value should be negative. + Denne verdien må være negativ. + + + This value should be either negative or zero. + Denne verdien må være negativ eller null. + + + This value is not a valid timezone. + Verdien er ikke en gyldig tidssone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dette passordet er lekket i et datainnbrudd, det må ikke tas i bruk. Vennligst bruk et annet passord. + + + This value should be between {{ min }} and {{ max }}. + Verdien må være mellom {{ min }} og {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf index b3e8f0f42f124..bf7da2f06c907 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf @@ -334,6 +334,38 @@ This value should be valid JSON. Detta värde ska vara giltig JSON. + + This collection should contain only unique elements. + Denna samling bör endast innehålla unika element. + + + This value should be positive. + Detta värde bör vara positivt. + + + This value should be either positive or zero. + Detta värde bör vara antingen positivt eller noll. + + + This value should be negative. + Detta värde bör vara negativt. + + + This value should be either negative or zero. + Detta värde bör vara antingen negativt eller noll. + + + This value is not a valid timezone. + Detta värde är inte en giltig tidszon. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Det här lösenordet har läckt ut vid ett dataintrång, det får inte användas. Använd ett annat lösenord. + + + This value should be between {{ min }} and {{ max }}. + Detta värde bör ligga mellan {{ min }} och {{ max }}. + diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index 67b5a8c7b98b5..c0c89398ce466 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -450,7 +450,7 @@ public function uploadedFileErrorProvider() $reflection = new \ReflectionClass(\get_class(new FileValidator())); $method = $reflection->getMethod('factorizeSizes'); $method->setAccessible(true); - list($sizeAsString, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]); + list(, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]); // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value diff --git a/src/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php b/src/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php index f796463bbc320..99bf9e6eb2ebe 100644 --- a/src/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php +++ b/src/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php @@ -32,6 +32,7 @@ public function provideAppendPaths() ['foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'], ['foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation'], ['0', 'bar', '0.bar', 'Leading zeros are kept.'], + ['0', 1, '0.1', 'Numeric subpaths do not cause PHP 7.4 errors.'], ]; } } diff --git a/src/Symfony/Component/Validator/Util/PropertyPath.php b/src/Symfony/Component/Validator/Util/PropertyPath.php index 4108a02c24f25..5d062356772c0 100644 --- a/src/Symfony/Component/Validator/Util/PropertyPath.php +++ b/src/Symfony/Component/Validator/Util/PropertyPath.php @@ -36,12 +36,13 @@ class PropertyPath */ public static function append($basePath, $subPath) { - if ('' !== (string) $subPath) { + $subPath = (string) $subPath; + if ('' !== $subPath) { if ('[' === $subPath[0]) { return $basePath.$subPath; } - return '' !== (string) $basePath ? $basePath.'.'.$subPath : $subPath; + return '' !== $basePath ? $basePath.'.'.$subPath : $subPath; } return $basePath; diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 2bd347d96a53e..946df78257bae 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -28,7 +28,7 @@ class CliDumper extends AbstractDumper protected $maxStringWidth = 0; protected $styles = [ // See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics - 'default' => '38;5;208', + 'default' => '0;38;5;208', 'num' => '1;38;5;38', 'const' => '1;38;5;208', 'str' => '1;38;5;113', diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php index 7e96c8875e74f..b7ffdec96e59c 100644 --- a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php +++ b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php @@ -11,7 +11,7 @@ class DefinitionBuilderTest extends TestCase public function testAddPlaceInvalidName() { $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); - $builder = new DefinitionBuilder(['a"', 'b']); + new DefinitionBuilder(['a"', 'b']); } public function testSetInitialPlace() diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php index 185d4fd6c9ef4..8df6494a1edc9 100644 --- a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php +++ b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php @@ -22,7 +22,7 @@ public function testAddPlacesInvalidArgument() { $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); $places = ['a"', 'e"']; - $definition = new Definition($places, []); + new Definition($places, []); } public function testSetInitialPlace() @@ -37,7 +37,7 @@ public function testSetInitialPlaceAndPlaceIsNotDefined() { $this->expectException('Symfony\Component\Workflow\Exception\LogicException'); $this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.'); - $definition = new Definition([], [], 'd'); + new Definition([], [], 'd'); } public function testAddTransition() diff --git a/src/Symfony/Component/Workflow/Tests/TransitionTest.php b/src/Symfony/Component/Workflow/Tests/TransitionTest.php index 009f19acfad29..0e049158f77b4 100644 --- a/src/Symfony/Component/Workflow/Tests/TransitionTest.php +++ b/src/Symfony/Component/Workflow/Tests/TransitionTest.php @@ -11,7 +11,7 @@ public function testValidateName() { $this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException'); $this->expectExceptionMessage('The transition "foo.bar" contains invalid characters.'); - $transition = new Transition('foo.bar', 'a', 'b'); + new Transition('foo.bar', 'a', 'b'); } public function testConstructor() diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 6a1d092a0760c..90990d8cbbd79 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -219,7 +219,7 @@ public function testApplyWithSameNameTransition() $this->assertFalse($marking->has('b')); $this->assertFalse($marking->has('c')); - $marking = $workflow->apply($subject, 'a_to_bc'); + $workflow->apply($subject, 'a_to_bc'); $marking = $workflow->apply($subject, 'b_to_c'); $this->assertFalse($marking->has('a')); @@ -291,7 +291,7 @@ public function testApplyWithEventDispatcher() 'workflow.workflow_name.announce.t2', ]; - $marking = $workflow->apply($subject, 't1'); + $workflow->apply($subject, 't1'); $this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents); } @@ -330,7 +330,7 @@ public function testApplyDoesNotTriggerExtraGuardWithEventDispatcher() 'workflow.workflow_name.announce', ]; - $marking = $workflow->apply($subject, 'a-b'); + $workflow->apply($subject, 'a-b'); $this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents); } diff --git a/src/Symfony/Component/Workflow/Validator/StateMachineValidator.php b/src/Symfony/Component/Workflow/Validator/StateMachineValidator.php index 7dbe694940518..6330cabec99c0 100644 --- a/src/Symfony/Component/Workflow/Validator/StateMachineValidator.php +++ b/src/Symfony/Component/Workflow/Validator/StateMachineValidator.php @@ -37,7 +37,7 @@ public function validate(Definition $definition, $name) // Enforcing uniqueness of the names of transitions starting at each node $from = reset($froms); if (isset($transitionFromNames[$from][$transition->getName()])) { - throw new InvalidDefinitionException(sprintf('A transition from a place/state must have an unique name. Multiple transitions named "%s" from place/state "%s" where found on StateMachine "%s". ', $transition->getName(), $from, $name)); + throw new InvalidDefinitionException(sprintf('A transition from a place/state must have an unique name. Multiple transitions named "%s" from place/state "%s" were found on StateMachine "%s".', $transition->getName(), $from, $name)); } $transitionFromNames[$from][$transition->getName()] = true; diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 10fa2702e851c..7d3218a35e187 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -126,15 +126,15 @@ public static function parse($value, $flags = 0, $references = []) $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references); } - if (null !== $tag) { - return new TaggedValue($tag, $result); - } - // some comments are allowed at the end if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) { throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } + if (null !== $tag) { + return new TaggedValue($tag, $result); + } + return $result; } finally { if (isset($mbEncoding)) { diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index b1306f043cdba..349897859f53f 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -85,7 +85,7 @@ public function testLintFileNotReadable() $filename = $this->createFile(''); unlink($filename); - $ret = $tester->execute(['filename' => $filename], ['decorated' => false]); + $tester->execute(['filename' => $filename], ['decorated' => false]); } /** diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 3b3dabf56d1d4..014a12a706723 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -201,6 +201,12 @@ public function testParseInvalidSequenceShouldThrowException() Inline::parse('{ foo: bar } bar'); } + public function testParseInvalidTaggedSequenceShouldThrowException() + { + $this->expectException('Symfony\Component\Yaml\Exception\ParseException'); + Inline::parse('!foo { bar: baz } qux', Yaml::PARSE_CUSTOM_TAGS); + } + public function testParseScalarWithCorrectlyQuotedStringShouldReturnString() { $value = "'don''t do somthin'' like that'"; diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index c48f0b4f4546b..dc7c122d592c2 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -110,7 +110,7 @@ public function testTabsInYaml() foreach ($yamls as $yaml) { try { - $content = $this->parser->parse($yaml); + $this->parser->parse($yaml); $this->fail('YAML files must not contain tabs'); } catch (\Exception $e) {