From 97d28b5e4e23cca3dbe090e29d427275f4d98bf6 Mon Sep 17 00:00:00 2001 From: Stadly Date: Fri, 26 Apr 2019 12:01:40 +0200 Subject: [PATCH 001/167] Load plurals from mo files properly --- .../Translation/Loader/MoFileLoader.php | 13 ++++--------- .../Tests/Loader/MoFileLoaderTest.php | 5 ++++- .../Translation/Tests/fixtures/plurals.mo | Bin 74 -> 448 bytes 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 74d2b2f4411df..4b249df024ec8 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -111,17 +111,12 @@ protected function loadResource($resource) $ids = ['singular' => $singularId, 'plural' => $pluralId]; $item = compact('ids', 'translated'); - if (\is_array($item['translated'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = $item['ids']['singular']; if (isset($item['ids']['plural'])) { - $plurals = []; - foreach ($item['translated'] as $plural => $translated) { - $plurals[] = sprintf('{%d} %s', $plural, $translated); - } - $messages[$item['ids']['plural']] = stripcslashes(implode('|', $plurals)); + $id .= '|'.$item['ids']['plural']; } - } elseif (!empty($item['ids']['singular'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated']); + $messages[$id] = stripcslashes(implode('|', (array) $item['translated'])); } } diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php index 63de5cebaa4dc..d6adecb1736fd 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php @@ -34,7 +34,10 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => '{0} bar|{1} bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo b/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo index 6445e77beab595289cd154ea253c4e49dfd6af47..3945ad95beae6c9ce059cb8d5209c53653c47440 100644 GIT binary patch literal 448 zcmYL_&rSkC493@giP@uP5A{Hzhe047$dWxF7!rsZvl@?^6|RIMVJP@`5{?BFK$r{hUKD*w_WrkMko+TAzA#5p zh<$%fwf5NPz3~C8!RxhV@?u>p^om_Am{C@(3|6YI&B7+Y%TU_1)q#yn&l%2AXkK*U z%;-54P7NmNfs8FRClF`1x#}81C#AYZN5NBf^iukce`|==soWsj3Y|96G(?`Qa7HR8 zTu40{jC#Ad&3Ys5YIel(+uKs6I(l`N%L+^GK=F*ml1uONzH0CK{P-yu)#E}>N}eUq r9+z%=Qv$^Cqq-p`vw1|OX;M09)m!yu9F5UGz5fS3b_Eugd`kOrxNfwcU51|TkGNJ=aM;bH~=*B}U7 From c7cc780373fb2ceb2cb0cfc0ca21c36d44ff436b Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 14 Jun 2019 15:17:07 +0200 Subject: [PATCH 002/167] [FrameworkBundle] Unconditionally register the DateIntervalNormalizer --- .../DependencyInjection/FrameworkExtension.php | 5 ----- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ---- 2 files changed, 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4688c192a05cb..1ce69472c2a25 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -89,7 +89,6 @@ use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer; -use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Stopwatch\Stopwatch; @@ -1312,10 +1311,6 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder { $loader->load('serializer.xml'); - if (!class_exists(DateIntervalNormalizer::class)) { - $container->removeDefinition('serializer.normalizer.dateinterval'); - } - if (!class_exists(ConstraintViolationListNormalizer::class)) { $container->removeDefinition('serializer.normalizer.constraint_violation_list'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 0b27dbff63d5f..81f687c63f355 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1102,10 +1102,6 @@ public function testDataUriNormalizerRegistered() public function testDateIntervalNormalizerRegistered() { - if (!class_exists(DateIntervalNormalizer::class)) { - $this->markTestSkipped('The DateIntervalNormalizer has been introduced in the Serializer Component version 3.4.'); - } - $container = $this->createContainerFromFile('full'); $definition = $container->getDefinition('serializer.normalizer.dateinterval'); From 23db9be884776baa4071cc4f087d7694345b1a34 Mon Sep 17 00:00:00 2001 From: Alex Bowers Date: Wed, 19 Jun 2019 12:46:55 +0100 Subject: [PATCH 003/167] Don't assume port 0 for X-Forwarded-Port --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ea3f460c4692b..fc26304ad236c 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1037,7 +1037,7 @@ public function getPort() $pos = strrpos($host, ':'); } - if (false !== $pos) { + if (false !== $pos && !empty(substr($host, $pos + 1))) { return (int) substr($host, $pos + 1); } From c266d6c7371799cf8d5f803322b24a773e5e1f1b Mon Sep 17 00:00:00 2001 From: Alex Bowers Date: Wed, 19 Jun 2019 17:03:11 +0100 Subject: [PATCH 004/167] Update Request.php --- src/Symfony/Component/HttpFoundation/Request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index fc26304ad236c..38b7fc21691c8 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1037,8 +1037,8 @@ public function getPort() $pos = strrpos($host, ':'); } - if (false !== $pos && !empty(substr($host, $pos + 1))) { - return (int) substr($host, $pos + 1); + if (false !== $pos && '' !== $port = substr($host, $pos + 1)) { + return (int) $port; } return 'https' === $this->getScheme() ? 443 : 80; From 6425639fe0b80de683909b9bdb2765c21b1533ab Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 15:56:21 +0200 Subject: [PATCH 005/167] updated CHANGELOG for 3.4.29 --- CHANGELOG-3.4.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 7b2094530cef7..a358d609f3cc6 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,31 @@ 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.29 (2019-06-26) + + * bug #32137 [HttpFoundation] fix accessing session bags (xabbuh) + * bug #32164 [EventDispatcher] collect called listeners information only once (xabbuh) + * bug #32173 [FrameworkBundle] Fix calling Client::getProfile() before sending a request (dunglas) + * bug #32163 [DoctrineBridge] Fix type error (norkunas) + * bug #32170 [Security/Core] Don't use ParagonIE_Sodium_Compat (nicolas-grekas) + * bug #32123 [Form] fix translation domain (xabbuh) + * bug #32116 [FrameworkBundle] tag the FileType service as a form type (xabbuh) + * bug #32090 [Debug] workaround BC break in PHP 7.3 (nicolas-grekas) + * bug #32071 Fix expired lock not cleaned (jderusse) + * bug #32057 [HttpFoundation] Fix SA/phpdoc JsonResponse (ro0NL) + * bug #32025 SimpleCacheAdapter fails to cache any item if a namespace is used (moufmouf) + * bug #32037 [Form] validate composite constraints in all groups (xabbuh) + * bug #32007 [Serializer] Handle true and false appropriately in CSV encoder (battye) + * bug #32000 [Routing] fix absolute url generation when scheme is not known (Tobion) + * bug #32024 [VarDumper] fix dumping objects that implement __debugInfo() (nicolas-grekas) + * bug #31962 Fix reporting unsilenced deprecations from insulated tests (nicolas-grekas) + * bug #31865 [Form] Fix wrong DateTime on outdated ICU library (aweelex) + * bug #31863 [HttpFoundation] Fixed case-sensitive handling of cache-control header in RedirectResponse constructor (Ivo) + * bug #31869 Fix json-encoding when JSON_THROW_ON_ERROR is used (nicolas-grekas) + * bug #31860 [HttpFoundation] work around PHP 7.3 bug related to json_encode() (nicolas-grekas) + * bug #31407 [Security] added support for updated "distinguished name" format in x509 authentication (Robert Kopera) + * bug #31654 [HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping (vilius-g) + * 3.4.28 (2019-05-28) * bug #31584 [Workflow] Do not trigger extra guards (lyrixx) From 7f886dcef08bec35c18a956fa911569e16d974d9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 15:56:32 +0200 Subject: [PATCH 006/167] update CONTRIBUTORS for 3.4.29 --- CONTRIBUTORS.md | 70 ++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fddccc428e7c9..011ad9bee0777 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -19,8 +19,8 @@ Symfony is the result of the work of many people who made the code better - Jakub Zalas (jakubzalas) - Johannes S (johannes) - Javier Eguiluz (javier.eguiluz) - - Kris Wallsmith (kriswallsmith) - Roland Franssen (ro0) + - Kris Wallsmith (kriswallsmith) - Grégoire Pineau (lyrixx) - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) @@ -31,9 +31,9 @@ Symfony is the result of the work of many people who made the code better - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) + - Yonel Ceruto (yonelceruto) - Martin Hasoň (hason) - Jeremy Mikola (jmikola) - - Yonel Ceruto (yonelceruto) - Jean-François Simon (jfsimon) - Jules Pietri (heah) - Benjamin Eberlei (beberlei) @@ -45,35 +45,35 @@ Symfony is the result of the work of many people who made the code better - Jonathan Wage (jwage) - Tobias Nyholm (tobias) - Lynn van der Berg (kjarli) + - Jérémy DERUSSÉ (jderusse) - Diego Saint Esteben (dosten) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar - - Jérémy DERUSSÉ (jderusse) + - Alexander M. Turek (derrabus) - Dany Maillard (maidmaid) - Francis Besset (francisbesset) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Matthias Pigulla (mpdude) - Bulat Shakirzyanov (avalanche123) - - Alexander M. Turek (derrabus) - Saša Stamenković (umpirsky) - Peter Rehm (rpet) - - Kevin Bond (kbond) - Pierre du Plessis (pierredup) + - Kevin Bond (kbond) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik - Diego Saint Esteben (dii3g0) + - Grégoire Paris (greg0ire) - Konstantin Kudryashov (everzet) - Gábor Egyed (1ed) - - Grégoire Paris (greg0ire) - - Bilal Amarni (bamarni) - Titouan Galopin (tgalopin) + - Konstantin Myakshin (koc) + - Bilal Amarni (bamarni) - Mathieu Piot (mpiot) - David Maicher (dmaicher) - Florin Patan (florinpatan) - Valentin Udaltsov (vudaltsov) - - Konstantin Myakshin (koc) - Gabriel Ostrolucký (gadelat) - Vladimir Reznichenko (kalessil) - Jáchym Toušek (enumag) @@ -95,12 +95,12 @@ Symfony is the result of the work of many people who made the code better - Luis Cordova (cordoval) - Graham Campbell (graham) - Daniel Holmes (dholmes) + - Thomas Calvet (fancyweb) - Toni Uebernickel (havvg) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - Jérôme Tamarelle (gromnan) - John Wards (johnwards) - - Thomas Calvet (fancyweb) - Fran Moreno (franmomu) - Antoine Hérault (herzult) - Paráda József (paradajozsef) @@ -120,6 +120,7 @@ Symfony is the result of the work of many people who made the code better - Peter Kokot (maastermedia) - Jacob Dreesen (jdreesen) - Florian Voutzinos (florianv) + - Jan Schädlich (jschaedl) - Colin Frei - Javier Spagnoletti (phansys) - Adrien Brault (adrienbrault) @@ -152,7 +153,6 @@ Symfony is the result of the work of many people who made the code better - Arnaud Kleinpeter (nanocom) - Jannik Zschiesche (apfelbox) - Guilherme Blanco (guilhermeblanco) - - Jan Schädlich (jschaedl) - SpacePossum - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) @@ -175,13 +175,17 @@ Symfony is the result of the work of many people who made the code better - Alessandro Chitolina (alekitto) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) + - Massimiliano Arione (garak) - Michał Pipa (michal.pipa) - Dawid Nowak + - George Mponos (gmponos) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - Tyson Andre - GDIBass + - Samuel NELA (snela) + - Vincent Touzet (vincenttouzet) - Alexander Schranz (alexander-schranz) - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent) - James Halsall (jaitsu) @@ -194,15 +198,12 @@ Symfony is the result of the work of many people who made the code better - Daniel Espendiller - Possum - Dorian Villet (gnutix) - - George Mponos (gmponos) - Sergey Linnik (linniksa) - Richard Miller (mr_r_miller) - Albert Casademont (acasademont) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) - DQNEO - - Samuel NELA (snela) - - Vincent Touzet (vincenttouzet) - Gregor Harlan (gharlan) - Gary PEGEOT (gary-p) - Ruben Gonzalez (rubenrua) @@ -242,12 +243,12 @@ Symfony is the result of the work of many people who made the code better - Sven Paulus (subsven) - Maxime Veber (nek-) - Rui Marinho (ruimarinho) - - Massimiliano Arione (garak) - Eugene Wissner - Pascal Montoya - Julien Brochet (mewt) - Leo Feyer - Tristan Darricau (nicofuma) + - Victor Bocharsky (bocharsky_bw) - Marcel Beerta (mazen) - Pavel Batanov (scaytrase) - Mantis Development @@ -300,7 +301,6 @@ Symfony is the result of the work of many people who made the code better - Chekote - Antoine Makdessi (amakdessi) - Thomas Adam - - Viktor Bocharskyi (bocharsky_bw) - Jhonny Lidfors (jhonne) - Diego Agulló (aeoris) - jdhoek @@ -374,6 +374,7 @@ Symfony is the result of the work of many people who made the code better - Berny Cantos (xphere81) - Thierry Thuon (lepiaf) - Ricard Clau (ricardclau) + - dFayet - Mark Challoner (markchalloner) - Gennady Telegin (gtelegin) - Erin Millard @@ -438,6 +439,7 @@ Symfony is the result of the work of many people who made the code better - Joe Lencioni - Daniel Tschinder - vladimir.reznichenko + - Ruud Kamphuis (ruudk) - Kai - Lee Rowlands - Krzysztof Piasecki (krzysztek) @@ -458,6 +460,7 @@ Symfony is the result of the work of many people who made the code better - Karel Souffriau - Christophe L. (christophelau) - Anthon Pang (robocoder) + - Michael Käfer (michael_kaefer) - Sébastien Santoro (dereckson) - Brian King - Michel Salib (michelsalib) @@ -539,6 +542,7 @@ Symfony is the result of the work of many people who made the code better - Sergio Santoro - Robin van der Vleuten (robinvdvleuten) - Philipp Rieber (bicpi) + - Tomas Norkūnas (norkunas) - Manuel de Ruiter (manuel) - Eduardo Oliveira (entering) - Ilya Antipenko (aivus) @@ -563,6 +567,7 @@ Symfony is the result of the work of many people who made the code better - Jakub Škvára (jskvara) - Andrew Udvare (audvare) - alexpods + - Saif Eddin G - Adam Szaraniec (mimol) - Dariusz Ruminski - Erik Trapman (eriktrapman) @@ -597,7 +602,6 @@ Symfony is the result of the work of many people who made the code better - Martin Morávek (keeo) - Steven Surowiec - Kevin Saliou (kbsali) - - Ruud Kamphuis (ruudk) - Shawn Iwinski - Gawain Lynch (gawain) - NothingWeAre @@ -630,6 +634,7 @@ Symfony is the result of the work of many people who made the code better - Baptiste Leduc (bleduc) - Jean-Christophe Cuvelier [Artack] - Simon DELICATA + - Dmitry Simushev - alcaeus - Fred Cox - vitaliytv @@ -688,7 +693,6 @@ Symfony is the result of the work of many people who made the code better - Vincent Simonin - Alex Bogomazov (alebo) - maxime.steinhausser - - dFayet - adev - Stefan Warman - Arkadius Stefanski (arkadius) @@ -722,6 +726,7 @@ Symfony is the result of the work of many people who made the code better - Jaroslav Kuba - Stephan Vock - Benjamin Zikarsky (bzikarsky) + - battye - Simon Schick (simonsimcity) - redstar504 - Tristan Roussel @@ -763,10 +768,10 @@ Symfony is the result of the work of many people who made the code better - Arturas Smorgun (asarturas) - Alexander Volochnev (exelenz) - Michael Piecko + - Toni Peric (tperic) - yclian - Alan Poulain - Aleksey Prilipko - - Tomas Norkūnas (norkunas) - Andrew Berry - twifty - Indra Gunawan (guind) @@ -816,6 +821,7 @@ Symfony is the result of the work of many people who made the code better - John Bohn (jbohn) - Marc Morera (mmoreram) - Saif Eddin Gmati (azjezz) + - BENOIT POLASZEK (bpolaszek) - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) @@ -837,6 +843,7 @@ Symfony is the result of the work of many people who made the code better - Olivier Maisonneuve (olineuve) - Pedro Miguel Maymone de Resende (pedroresende) - Masterklavi + - Franco Traversaro (belinde) - Francis Turmel (fturmel) - Nikita Nefedov (nikita2206) - cgonzalez @@ -851,6 +858,7 @@ Symfony is the result of the work of many people who made the code better - Antoine Lamirault - Adrien Lucas (adrienlucas) - Zhuravlev Alexander (scif) + - Stefano Degenkamp (steef) - James Michael DuPont - Tom Klingenberg - Christopher Hall (mythmakr) @@ -904,6 +912,7 @@ Symfony is the result of the work of many people who made the code better - Benoît Bourgeois - mantulo - Stefan Kruppa + - mmokhi - corphi - grizlik - Derek ROTH @@ -912,6 +921,7 @@ Symfony is the result of the work of many people who made the code better - Dmytro Boiko (eagle) - Shin Ohno (ganchiku) - Geert De Deckere (geertdd) + - Jacek Jędrzejewski (jacek.jedrzejewski) - Jan Kramer (jankramer) - abdul malik ikhsan (samsonasik) - Henry Snoek (snoek09) @@ -922,7 +932,6 @@ Symfony is the result of the work of many people who made the code better - Morgan Auchede (mauchede) - Sascha Dens (saschadens) - Don Pinkster - - Saif Eddin G - Maksim Muruev - Emil Einarsson - Thomas Landauer @@ -933,13 +942,14 @@ Symfony is the result of the work of many people who made the code better - Tony Tran - Jacques Moati - Balazs Csaba (balazscsaba2006) + - Bill Hance (billhance) - Douglas Reith (douglas_reith) - Forfarle (forfarle) - Harry Walter (haswalt) - Johnson Page (jwpage) - - Michael Käfer (michael_kaefer) - Ruben Gonzalez (rubenruateltek) - Michael Roterman (wtfzdotnet) + - Andrii Dembitskyi - Arno Geurts - Adán Lobato (adanlobato) - Ian Jenkins (jenkoian) @@ -986,7 +996,6 @@ Symfony is the result of the work of many people who made the code better - d-ph - Renan Taranto (renan-taranto) - Thomas Talbot (ioni) - - Dmitry Simushev - Rikijs Murgs - Uladzimir Tsykun - Ben Ramsey (ramsey) @@ -1132,7 +1141,6 @@ Symfony is the result of the work of many people who made the code better - hugofonseca (fonsecas72) - Martynas Narbutas - Toon Verwerft (veewee) - - battye - Bailey Parker - Eddie Jaoude - Antanas Arvasevicius @@ -1269,6 +1277,7 @@ Symfony is the result of the work of many people who made the code better - Pablo Schläpfer - Gert de Pagter - Jelte Steijaert (jelte) + - David Négrier (moufmouf) - Quique Porta (quiqueporta) - stoccc - Andrea Quintino (dirk39) @@ -1290,7 +1299,6 @@ Symfony is the result of the work of many people who made the code better - Lars Ambrosius Wallenborn (larsborn) - Oriol Mangas Abellan (oriolman) - Sebastian Göttschkes (sgoettschkes) - - Toni Peric (tperic) - Tatsuya Tsuruoka - Ross Tuck - Kévin Gomez (kevin) @@ -1324,7 +1332,6 @@ Symfony is the result of the work of many people who made the code better - Sébastien HOUZÉ - Jingyu Wang - steveYeah - - BENOIT POLASZEK (bpolaszek) - Samy Dindane (dinduks) - Keri Henare (kerihenare) - Cédric Lahouste (rapotor) @@ -1431,6 +1438,7 @@ Symfony is the result of the work of many people who made the code better - BilgeXA - r1pp3rj4ck - phydevs + - mmokhi - Robert Queck - Peter Bouwdewijn - mlively @@ -1455,6 +1463,7 @@ Symfony is the result of the work of many people who made the code better - Mike Meier - Tim Jabs - Sebastian Ionescu + - Robert Kopera - Pablo Ogando Ferreira - Thomas Ploch - Simon Neidhold @@ -1490,6 +1499,7 @@ Symfony is the result of the work of many people who made the code better - LubenZA - Olivier - Cyril PASCAL + - Michael Bessolov - pscheit - Wybren Koelmans - Zdeněk Drahoš @@ -1651,6 +1661,7 @@ Symfony is the result of the work of many people who made the code better - downace - Aarón Nieves Fernández - Mike Meier + - Vilius Grigaliūnas - Kirill Saksin - Julien Pauli - Koalabaerchen @@ -1698,6 +1709,7 @@ Symfony is the result of the work of many people who made the code better - Nicole Cordes - Martin Kirilov - amcastror + - Alexander Li (aweelex) - Bram Van der Sype (brammm) - Guile (guile) - Julien Moulin (lizjulien) @@ -1717,6 +1729,7 @@ Symfony is the result of the work of many people who made the code better - Sam Ward - Walther Lalk - Adam + - Ivo - Sören Bernstein - devel - taiiiraaa @@ -1751,7 +1764,6 @@ Symfony is the result of the work of many people who made the code better - Hans Nilsson (hansnilsson) - Andrew Marcinkevičius (ifdattic) - Ioana Hazsda (ioana-hazsda) - - Jacek Jędrzejewski (jacek.jedrzejewski) - Jan Marek (janmarek) - Mark de Haan (markdehaan) - Dan Patrick (mdpatrick) @@ -1760,6 +1772,7 @@ Symfony is the result of the work of many people who made the code better - tante kinast (tante) - Ahmed Hannachi (tiecoders) - Vincent LEFORT (vlefort) + - Walid BOUGHDIRI (walidboughdiri) - Darryl Hein (xmmedia) - Sadicov Vladimir (xtech) - Kevin EMO (zarcox) @@ -1774,6 +1787,7 @@ Symfony is the result of the work of many people who made the code better - Vincent Chalnot - James Hudson - Tom Maguire + - Mateusz Lerczak - Richard Quadling - David Zuelke - Adrian @@ -1948,6 +1962,7 @@ Symfony is the result of the work of many people who made the code better - Ulf Reimers (ureimers) - Wotre - goohib + - Chi-teck - Tom Counsell - Xavier HAUSHERR - Ron Gähler @@ -2007,6 +2022,7 @@ Symfony is the result of the work of many people who made the code better - Cédric Bertolini - n-aleha - Anatol Belski + - Anderson Müller - Şəhriyar İmanov - Alexis BOYER - Kaipi Yann @@ -2019,7 +2035,6 @@ Symfony is the result of the work of many people who made the code better - Tammy D - Daniel STANCU - Ryan Rud - - mmokhi - Ondrej Slinták - vlechemin - Brian Corrigan @@ -2110,10 +2125,10 @@ Symfony is the result of the work of many people who made the code better - Alex Olmos (alexolmos) - Antonio Mansilla (amansilla) - Robin Kanters (anddarerobin) + - Andrii Popov (andrii-popov) - Juan Ases García (ases) - Siragusa (asiragusa) - Daniel Basten (axhm3a) - - Bill Hance (billhance) - Bernd Matzner (bmatzner) - Bram Tweedegolf (bram_tweedegolf) - Brandon Kelly (brandonkelly) @@ -2150,6 +2165,7 @@ Symfony is the result of the work of many people who made the code better - Justin Rainbow (jrainbow) - Juan Luis (juanlugb) - JuntaTom (juntatom) + - Julien Manganne (juuuuuu) - Ismail Faizi (kanafghan) - Sébastien Armand (khepin) - Pierre-Chanel Gauthier (kmecnin) From 5296d2dfa08d99890ea31f684fc03f6c0f3ff3ab Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 15:56:39 +0200 Subject: [PATCH 007/167] updated VERSION for 3.4.29 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 092fb6c762717..21d03f4ba5867 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.29-DEV'; + const VERSION = '3.4.29'; const VERSION_ID = 30429; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 29; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From fe5a4ee9998b1696d0733e421e8d20cd8041e415 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 16:17:55 +0200 Subject: [PATCH 008/167] bumped Symfony version to 3.4.30 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 21d03f4ba5867..551bb36f744a9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.29'; - const VERSION_ID = 30429; + const VERSION = '3.4.30-DEV'; + const VERSION_ID = 30430; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 29; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 30; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 3b145df403d22ec7f7eb8835a641403d2e8bfbcb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 16:19:37 +0200 Subject: [PATCH 009/167] updated CHANGELOG for 4.2.10 --- CHANGELOG-4.2.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CHANGELOG-4.2.md b/CHANGELOG-4.2.md index 7c7c018037c6d..40e3209d1d568 100644 --- a/CHANGELOG-4.2.md +++ b/CHANGELOG-4.2.md @@ -7,6 +7,41 @@ in 4.2 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.2.0...v4.2.1 +* 4.2.10 (2019-06-26) + + * bug #31972 Add missing rendering of form help block. (alexsegura) + * bug #32137 [HttpFoundation] fix accessing session bags (xabbuh) + * bug #32164 [EventDispatcher] collect called listeners information only once (xabbuh) + * bug #32173 [FrameworkBundle] Fix calling Client::getProfile() before sending a request (dunglas) + * bug #32163 [DoctrineBridge] Fix type error (norkunas) + * bug #32170 [Security/Core] Don't use ParagonIE_Sodium_Compat (nicolas-grekas) + * bug #32094 [Validator] Use LogicException for missing Property Access Component in comparison constraints (Lctrs) + * bug #32123 [Form] fix translation domain (xabbuh) + * bug #32116 [FrameworkBundle] tag the FileType service as a form type (xabbuh) + * bug #32090 [Debug] workaround BC break in PHP 7.3 (nicolas-grekas) + * bug #32076 [Lock] Fix PDO prune not called (jderusse) + * bug #32071 Fix expired lock not cleaned (jderusse) + * bug #32057 [HttpFoundation] Fix SA/phpdoc JsonResponse (ro0NL) + * bug #32025 SimpleCacheAdapter fails to cache any item if a namespace is used (moufmouf) + * bug #32037 [Form] validate composite constraints in all groups (xabbuh) + * bug #32007 [Serializer] Handle true and false appropriately in CSV encoder (battye) + * bug #32000 [Routing] fix absolute url generation when scheme is not known (Tobion) + * bug #32024 [VarDumper] fix dumping objects that implement __debugInfo() (nicolas-grekas) + * bug #31962 Fix reporting unsilenced deprecations from insulated tests (nicolas-grekas) + * bug #31925 [Form] fix usage of legacy TranslatorInterface (nicolas-grekas) + * bug #31908 [Validator] fix deprecation layer of ValidatorBuilder (nicolas-grekas) + * bug #31894 Fix wrong requirements for ocramius/proxy-manager in root composer.json (henrikvolmer) + * bug #31865 [Form] Fix wrong DateTime on outdated ICU library (aweelex) + * bug #31879 [Cache] Pass arg to get callback everywhere (fancyweb) + * bug #31863 [HttpFoundation] Fixed case-sensitive handling of cache-control header in RedirectResponse constructor (Ivo) + * bug #31869 Fix json-encoding when JSON_THROW_ON_ERROR is used (nicolas-grekas) + * bug #31868 [HttpKernel] Fix handling non-catchable fatal errors (nicolas-grekas) + * bug #31860 [HttpFoundation] work around PHP 7.3 bug related to json_encode() (nicolas-grekas) + * bug #31407 [Security] added support for updated "distinguished name" format in x509 authentication (Robert Kopera) + * bug #31786 [Translation] Fixed case sensitivity of lint:xliff command (javiereguiluz) + * bug #31757 [DomCrawler] Fix type error with null Form::$currentUri (chalasr) + * bug #31654 [HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping (vilius-g) + * 4.2.9 (2019-05-28) * bug #31584 [Workflow] Do not trigger extra guards (lyrixx) From c8899f37046eb54ac8331c5fc6decb92ce0ce415 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 16:19:57 +0200 Subject: [PATCH 010/167] updated VERSION for 4.2.10 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4e316cdfdc02e..2cac878a584e3 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.2.10-DEV'; + const VERSION = '4.2.10'; const VERSION_ID = 40210; const MAJOR_VERSION = 4; const MINOR_VERSION = 2; const RELEASE_VERSION = 10; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2019'; const END_OF_LIFE = '01/2020'; From a84fb88d071c3def0555e7980e2e06d84261c70e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 16:23:57 +0200 Subject: [PATCH 011/167] bumped Symfony version to 4.2.11 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 2cac878a584e3..fab1ef5165283 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.2.10'; - const VERSION_ID = 40210; + const VERSION = '4.2.11-DEV'; + const VERSION_ID = 40211; const MAJOR_VERSION = 4; const MINOR_VERSION = 2; - const RELEASE_VERSION = 10; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 11; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2019'; const END_OF_LIFE = '01/2020'; From 2afa71e0d8fa315997d44ca250611e0842f01cea Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 26 Jun 2019 16:31:16 +0200 Subject: [PATCH 012/167] bumped Symfony version to 4.3.3 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4752759004acf..58e765d385a5c 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.2'; - const VERSION_ID = 40302; + const VERSION = '4.3.3-DEV'; + const VERSION_ID = 40303; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; - const RELEASE_VERSION = 2; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 3; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020'; From df50685abfcc2b4f2ba8f79c6ec96f5fb5f22fe0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 26 Jun 2019 20:07:24 +0200 Subject: [PATCH 013/167] [Security/Core] work around sodium_compat issue --- .../Component/Security/Core/Encoder/Argon2iPasswordEncoder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index dae682bf31028..99738365ad4cf 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -26,7 +26,7 @@ public static function isSupported() return true; } - return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium'); + return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); } /** From 9c76790ee81da45803a5f6b0398684aae0857cfb Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 27 Jun 2019 09:45:05 +0545 Subject: [PATCH 014/167] Catch JsonException and rethrow in JsonEncode --- .../Component/Serializer/Encoder/JsonEncode.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 76e532c4b7a34..71f69503940de 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -35,14 +35,19 @@ public function __construct($bitmask = 0) public function encode($data, $format, array $context = []) { $context = $this->resolveContext($context); + $options = $context['json_encode_options']; - $encodedJson = json_encode($data, $context['json_encode_options']); + try { + $encodedJson = json_encode($data, $options); + } catch (\JsonException $e) { + throw new NotEncodableValueException($e->getMessage(), 0, $e); + } - if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $context['json_encode_options'])) { + if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $options)) { return $encodedJson; } - if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($context['json_encode_options'] & JSON_PARTIAL_OUTPUT_ON_ERROR))) { + if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } From 0b381dbe1d50a40f12115ea97b9bd0dd5a04b075 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Jun 2019 17:59:51 +0200 Subject: [PATCH 015/167] improve error messages in the event dispatcher --- .../EventDispatcher/EventDispatcher.php | 10 +++---- .../LegacyEventDispatcherProxy.php | 12 ++++---- .../Tests/EventDispatcherTest.php | 27 +++++++++++++++++ .../Tests/LegacyEventDispatcherTest.php | 30 +++++++++++++++++++ 4 files changed, 66 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php index 304caec1d1a79..a5f0b7eda5433 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php @@ -54,15 +54,13 @@ public function dispatch($event/*, string $eventName = null*/) if (\is_object($event)) { $eventName = $eventName ?? \get_class($event); - } else { - @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED); + } elseif (\is_string($event) && (null === $eventName || $eventName instanceof Event)) { + @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.', EventDispatcherInterface::class), E_USER_DEPRECATED); $swap = $event; $event = $eventName ?? new Event(); $eventName = $swap; - - if (!$event instanceof Event) { - throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event))); - } + } else { + throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, %s given.', EventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event))); } if (null !== $this->optimized && null !== $eventName) { diff --git a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php index 534eec98a5b63..afa3e988d0057 100644 --- a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php +++ b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php @@ -16,7 +16,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface; /** - * An helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch(). + * A helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch(). * * This class should be deprecated in Symfony 5.1 * @@ -57,15 +57,13 @@ public function dispatch($event/*, string $eventName = null*/) if (\is_object($event)) { $eventName = $eventName ?? \get_class($event); - } else { - @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', ContractsEventDispatcherInterface::class), E_USER_DEPRECATED); + } elseif (\is_string($event) && (null === $eventName || $eventName instanceof Event)) { + @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.', ContractsEventDispatcherInterface::class), E_USER_DEPRECATED); $swap = $event; $event = $eventName ?? new Event(); $eventName = $swap; - - if (!$event instanceof Event) { - throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', ContractsEventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event))); - } + } else { + throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, %s given.', ContractsEventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event))); } $listeners = $this->getListeners($eventName); diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index e89f78cda8e89..658a94123933e 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -412,6 +412,33 @@ public function testMutatingWhilePropagationIsStopped() $this->assertTrue($testLoaded); } + + /** + * @group legacy + * @expectedDeprecation Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. + */ + public function testLegacySignatureWithoutEvent() + { + $this->dispatcher->dispatch('foo'); + } + + /** + * @group legacy + * @expectedDeprecation Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. + */ + public function testLegacySignatureWithEvent() + { + $this->dispatcher->dispatch('foo', new Event()); + } + + /** + * @expectedException \TypeError + * @expectedExceptionMessage Argument 1 passed to "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" must be an object, string given. + */ + public function testLegacySignatureWithNewEventObject() + { + $this->dispatcher->dispatch('foo', new ContractsEvent()); + } } class CallableClass diff --git a/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php index 49aa2f9ff3f92..ffa767cf8b45c 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php @@ -14,12 +14,42 @@ use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy; +use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; /** * @group legacy */ class LegacyEventDispatcherTest extends EventDispatcherTest { + /** + * @group legacy + * @expectedDeprecation The signature of the "Symfony\Component\EventDispatcher\Tests\TestLegacyEventDispatcher::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3. + * @expectedDeprecation Calling the "Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. + */ + public function testLegacySignatureWithoutEvent() + { + $this->createEventDispatcher()->dispatch('foo'); + } + + /** + * @group legacy + * @expectedDeprecation The signature of the "Symfony\Component\EventDispatcher\Tests\TestLegacyEventDispatcher::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3. + * @expectedDeprecation Calling the "Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. + */ + public function testLegacySignatureWithEvent() + { + $this->createEventDispatcher()->dispatch('foo', new Event()); + } + + /** + * @expectedException \TypeError + * @expectedExceptionMessage Argument 1 passed to "Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch()" must be an object, string given. + */ + public function testLegacySignatureWithNewEventObject() + { + $this->createEventDispatcher()->dispatch('foo', new ContractsEvent()); + } + protected function createEventDispatcher() { return LegacyEventDispatcherProxy::decorate(new TestLegacyEventDispatcher()); From 0e7ed9e45cb623aed52f0d58be800873f92e21a3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 27 Jun 2019 10:51:02 +0200 Subject: [PATCH 016/167] [Mailer] fixed timeout type hint --- .../Component/Mailer/Transport/Smtp/Stream/SocketStream.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php index 308201d538f0e..0d075b0b6e94b 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php @@ -34,14 +34,14 @@ final class SocketStream extends AbstractStream private $sourceIp; private $streamContextOptions = []; - public function setTimeout(int $timeout): self + public function setTimeout(float $timeout): self { $this->timeout = $timeout; return $this; } - public function getTimeout(): int + public function getTimeout(): float { return $this->timeout; } From eb15bffa78a74ad4c003e79f5b4bff958c3836fb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 27 Jun 2019 11:08:50 +0200 Subject: [PATCH 017/167] [Mailer] fixed error message when connecting to a stream raises an error before connect() --- .../Smtp/Stream/SocketStreamTest.php | 49 +++++++++++++++++++ .../Transport/Smtp/Stream/SocketStream.php | 12 +++-- 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php new file mode 100644 index 0000000000000..1f532d7c107ff --- /dev/null +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mailer\Tests\Transport\Smtp\Stream; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream; + +class SocketStreamTest extends TestCase +{ + /** + * @expectedException \Symfony\Component\Mailer\Exception\TransportException + * @expectedExceptionMessage Connection refused + */ + public function testSocketErrorNoConnection() + { + $s = new SocketStream(); + $s->setTimeout(0.1); + $s->setPort(9999); + $s->initialize(); + } + + /** + * @expectedException \Symfony\Component\Mailer\Exception\TransportException + * @expectedExceptionMessage no valid certs found cafile stream + */ + public function testSocketErrorBeforeConnectError() + { + $s = new SocketStream(); + $s->setStreamOptions([ + 'ssl' => [ + // not a CA file :) + 'cafile' => __FILE__, + ], + ]); + $s->setEncryption('ssl'); + $s->setHost('smtp.gmail.com'); + $s->setPort(465); + $s->initialize(); + } +} diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php index 0d075b0b6e94b..a502c85e822aa 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/SocketStream.php @@ -144,10 +144,16 @@ public function initialize(): void $options['ssl']['crypto_method'] = $options['ssl']['crypto_method'] ?? STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } $streamContext = stream_context_create($options); - $this->stream = @stream_socket_client($this->url, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $streamContext); - if (false === $this->stream) { - throw new TransportException(sprintf('Connection could not be established with host "%s": %s (%s)', $this->url, $errstr, $errno)); + + set_error_handler(function ($type, $msg) { + throw new TransportException(sprintf('Connection could not be established with host "%s": %s.', $this->url, $msg)); + }); + try { + $this->stream = stream_socket_client($this->url, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $streamContext); + } finally { + restore_error_handler(); } + stream_set_blocking($this->stream, true); stream_set_timeout($this->stream, $this->timeout); $this->in = &$this->stream; From 332135186a78d1dd6c0af7d9d33427538c4bb67a Mon Sep 17 00:00:00 2001 From: Teoh Han Hui Date: Thu, 27 Jun 2019 11:53:29 +0200 Subject: [PATCH 018/167] [HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client --- src/Symfony/Component/HttpKernel/Client.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 66ce0649f06ca..d4ae5f8e65073 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -23,6 +23,9 @@ /** * Client simulates a browser and makes requests to an HttpKernel instance. * + * @method Request getRequest() A Request instance + * @method Response getResponse() A Response instance + * * @deprecated since Symfony 4.3, use HttpKernelBrowser instead. */ class Client extends AbstractBrowser From 9b69dc651a3ba8f913688eaa7dd46d9cfe37cf55 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 27 Jun 2019 18:03:00 +0200 Subject: [PATCH 019/167] [PhpUnitBridge] fix tests --- composer.json | 2 +- .../Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt | 4 +++- .../Tests/DeprecationErrorHandler/deprecated_regexp.phpt | 3 ++- .../PhpUnit/Tests/DeprecationErrorHandler/disabled.phpt | 3 ++- .../PhpUnit/Tests/DeprecationErrorHandler/eval_not_self.phpt | 3 ++- .../PhpUnit/Tests/DeprecationErrorHandler/lagging_vendor.phpt | 3 ++- .../Bridge/PhpUnit/Tests/DeprecationErrorHandler/quiet.phpt | 3 ++- .../Tests/DeprecationErrorHandler/self_on_non_vendor.phpt | 3 ++- .../Tests/DeprecationErrorHandler/shutdown_deprecations.phpt | 4 +++- .../Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt | 3 ++- .../weak_vendors_on_eval_d_deprecation.phpt | 3 ++- .../DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt | 3 ++- .../weak_vendors_on_phar_deprecation.phpt | 3 ++- .../Tests/DeprecationErrorHandler/weak_vendors_on_vendor.phpt | 3 ++- 14 files changed, 29 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 897516fd30bca..206141f8a7382 100644 --- a/composer.json +++ b/composer.json @@ -115,7 +115,7 @@ "psr/http-client": "^1.0", "psr/simple-cache": "^1.0", "egulias/email-validator": "~1.2,>=1.2.8|~2.0", - "symfony/phpunit-bridge": "~3.4|~4.0", + "symfony/phpunit-bridge": "~3.4|~4.0|~5.0", "symfony/security-acl": "~2.8|~3.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0" }, diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index 126d23389a516..7b4625979cb0c 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -3,7 +3,9 @@ Test DeprecationErrorHandler in default mode --FILE-- Date: Thu, 27 Jun 2019 18:11:56 +0200 Subject: [PATCH 020/167] [travis] not all components have a master branch --- .github/build-packages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build-packages.php b/.github/build-packages.php index e61eae51df550..5e9bcc141544e 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -57,7 +57,7 @@ $versions = @file_get_contents('https://repo.packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"dev-master":%s}}}', $package->name, file_get_contents($dir.'/composer.json')); $versions = json_decode($versions)->packages->{$package->name}; - if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { + if (isset($versions->{'dev-master'}) && $package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { unset($versions->{'dev-master'}); } From 90f61e9efa8883ca995349d02d889cf8dc98650f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 27 Jun 2019 18:29:52 +0200 Subject: [PATCH 021/167] [Mailer] fixed tests on Windows --- .../Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php index 1f532d7c107ff..b825d1d19a7b9 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/Stream/SocketStreamTest.php @@ -18,7 +18,7 @@ class SocketStreamTest extends TestCase { /** * @expectedException \Symfony\Component\Mailer\Exception\TransportException - * @expectedExceptionMessage Connection refused + * @expectedExceptionMessageRegExp /Connection refused|unable to connect/ */ public function testSocketErrorNoConnection() { @@ -30,7 +30,7 @@ public function testSocketErrorNoConnection() /** * @expectedException \Symfony\Component\Mailer\Exception\TransportException - * @expectedExceptionMessage no valid certs found cafile stream + * @expectedExceptionMessageRegExp /no valid certs found cafile stream|Unable to find the socket transport "ssl"/ */ public function testSocketErrorBeforeConnectError() { From 901fe0d7c54d675ca2d68435bb075587855cf630 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2019 09:31:23 +0200 Subject: [PATCH 022/167] pass error code as a string --- .../Component/Validator/Tests/Validator/AbstractTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php index 2bc3d11ef6d49..c9c05a0edfa36 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php @@ -511,7 +511,7 @@ public function testAddCustomizedViolation() ->setParameter('%param%', 'value') ->setInvalidValue('Invalid value') ->setPlural(2) - ->setCode(42) + ->setCode('42') ->addViolation(); }; @@ -528,7 +528,7 @@ public function testAddCustomizedViolation() $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); $this->assertSame(2, $violations[0]->getPlural()); - $this->assertSame(42, $violations[0]->getCode()); + $this->assertSame('42', $violations[0]->getCode()); } public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() From 02ee4d0b059ff7c253733c1b5987a9548f917903 Mon Sep 17 00:00:00 2001 From: smoench Date: Fri, 28 Jun 2019 10:02:59 +0200 Subject: [PATCH 023/167] [Finder] docblock fixes --- src/Symfony/Component/Finder/Finder.php | 2 +- .../Finder/Iterator/ExcludeDirectoryFilterIterator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 133c4b8c50b15..e933f078416be 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -528,7 +528,7 @@ public function ignoreUnreadableDirs($ignore = true) /** * Searches files and directories which match defined rules. * - * @param string|array $dirs A directory path or an array of directories + * @param string|string[] $dirs A directory path or an array of directories * * @return $this * diff --git a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php index bc0e6fc1e1a9f..60bc4e814c9d2 100644 --- a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -25,7 +25,7 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv /** * @param \Iterator $iterator The Iterator to filter - * @param array $directories An array of directories to exclude + * @param string[] $directories An array of directories to exclude */ public function __construct(\Iterator $iterator, array $directories) { From 5d55b91faebc9690fe58ea213cd291b73fdfd916 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 27 Jun 2019 23:36:22 +0200 Subject: [PATCH 024/167] [Cache] work aroung PHP memory leak --- .../Component/Cache/Traits/PhpFilesTrait.php | 57 ++++++++++++++++--- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index 6afdd8c3a5425..5ed4d6023ef80 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -50,12 +50,15 @@ public function prune() { $time = time(); $pruned = true; + $getExpiry = true; set_error_handler($this->includeHandler); try { foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { try { - list($expiresAt) = include $file; + if (\is_array($expiresAt = include $file)) { + $expiresAt = $expiresAt[0]; + } } catch (\ErrorException $e) { $expiresAt = $time; } @@ -87,15 +90,21 @@ protected function doFetch(array $ids) $values = []; begin: + $getExpiry = false; + foreach ($ids as $id) { if (null === $value = $this->values[$id] ?? null) { $missingIds[] = $id; } elseif ('N;' === $value) { $values[$id] = null; - } elseif ($value instanceof \Closure) { - $values[$id] = $value(); - } else { + } elseif (!\is_object($value)) { $values[$id] = $value; + } elseif (!$value instanceof LazyValue) { + // calling a Closure is for @deprecated BC and should be removed in Symfony 5.0 + $values[$id] = $value(); + } elseif (false === $values[$id] = include $value->file) { + unset($values[$id], $this->values[$id]); + $missingIds[] = $id; } if (!$this->appendOnly) { unset($this->values[$id]); @@ -108,10 +117,18 @@ protected function doFetch(array $ids) set_error_handler($this->includeHandler); try { + $getExpiry = true; + foreach ($missingIds as $k => $id) { try { $file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id); - list($expiresAt, $this->values[$id]) = include $file; + + if (\is_array($expiresAt = include $file)) { + [$expiresAt, $this->values[$id]] = $expiresAt; + } elseif ($now < $expiresAt) { + $this->values[$id] = new LazyValue($file); + } + if ($now >= $expiresAt) { unset($this->values[$id], $missingIds[$k]); } @@ -140,7 +157,13 @@ protected function doHave($id) set_error_handler($this->includeHandler); try { $file = $this->files[$id] ?? $this->files[$id] = $this->getFile($id); - list($expiresAt, $value) = include $file; + $getExpiry = true; + + if (\is_array($expiresAt = include $file)) { + [$expiresAt, $value] = $expiresAt; + } elseif ($this->appendOnly) { + $value = new LazyValue($file); + } } catch (\ErrorException $e) { return false; } finally { @@ -189,13 +212,16 @@ protected function doSave(array $values, $lifetime) } if (!$isStaticValue) { - $value = str_replace("\n", "\n ", $value); - $value = "static function () {\n\n return {$value};\n\n}"; + // We cannot use a closure here because of https://bugs.php.net/76982 + $value = str_replace('\Symfony\Component\VarExporter\Internal\\', '', $value); + $value = "files[$key] = $this->getFile($key, true); // Since OPcache only compiles files older than the script execution start, set the file's mtime in the past - $ok = $this->write($file, "write($file, $value, self::$startTime - 10) && $ok; if ($allowCompile) { @opcache_invalidate($file, true); @@ -241,3 +267,16 @@ protected function doUnlink($file) return @unlink($file); } } + +/** + * @internal + */ +class LazyValue +{ + public $file; + + public function __construct($file) + { + $this->file = $file; + } +} From 87fe077a89df56c93c09f703beafe89cd038c65b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2019 10:45:07 +0200 Subject: [PATCH 025/167] fix Debug component dependencies --- .../Bundle/FrameworkBundle/composer.json | 1 + src/Symfony/Bundle/TwigBundle/composer.json | 1 + .../ClassNotFoundFatalErrorHandlerTest.php | 18 +++++++++--------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 78d7ae1e564e7..40cff711ae8ad 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -22,6 +22,7 @@ "symfony/class-loader": "~3.2", "symfony/dependency-injection": "^3.4.24|^4.2.5", "symfony/config": "~3.4|~4.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/event-dispatcher": "~3.4|~4.0", "symfony/http-foundation": "^3.3.11|~4.0", "symfony/http-kernel": "~3.4|~4.0", diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 5d27f06ff92be..4cc08e1b35b27 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -18,6 +18,7 @@ "require": { "php": "^5.5.9|>=7.0.8", "symfony/config": "~3.2|~4.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/twig-bridge": "^3.4.3|^4.0.3", "symfony/http-foundation": "~2.8|~3.0|~4.0", "symfony/http-kernel": "^3.3|~4.0", diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 8e615ac640be9..112dfbb7f7520 100644 --- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -61,7 +61,7 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader } $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception); - $this->assertSame($translatedMessage, $exception->getMessage()); + $this->assertRegExp($translatedMessage, $exception->getMessage()); $this->assertSame($error['type'], $exception->getSeverity()); $this->assertSame($error['file'], $exception->getFile()); $this->assertSame($error['line'], $exception->getLine()); @@ -82,7 +82,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'WhizBangFactory\' not found', ], - "Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?", + "/^Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement\?$/", ], [ [ @@ -91,7 +91,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found', ], - "Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", + "/^Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for another namespace\?$/", ], [ [ @@ -100,7 +100,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", ], [ [ @@ -109,7 +109,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'PEARClass\' not found', ], - "Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?", + "/^Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"\?$/", ], [ [ @@ -118,7 +118,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", ], [ [ @@ -127,7 +127,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", [$autoloader, 'loadClass'], ], [ @@ -137,7 +137,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?/", [$debugClassLoader, 'loadClass'], ], [ @@ -147,7 +147,7 @@ public function provideClassNotFoundData() 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", + "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for another namespace\?$/", function ($className) { /* do nothing here */ }, ], ]; From 379bbee37074b330053f2406ed1c42b6ec40e16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 27 Jun 2019 19:20:54 +0200 Subject: [PATCH 026/167] [Serializer] Fixed PHP of DenormalizableInterface::denormalize It can return an array of objects --- .../Component/Serializer/Normalizer/DenormalizableInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 31e27a85cb024..3e7021b130876 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -34,7 +34,7 @@ interface DenormalizableInterface * differently based on different input formats * @param array $context Options for denormalizing * - * @return object + * @return object|object[] */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); } From d1261e78a48046657ace2e337a380f70b125a041 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2019 12:14:37 +0200 Subject: [PATCH 027/167] remove invalid test cases --- .../AbstractComparisonValidatorTestCase.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 2f27974a801ab..3a84694cc7aca 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -148,20 +148,6 @@ public function testValidComparisonToPropertyPath($comparedValue) $this->assertNoViolation(); } - /** - * @dataProvider provideValidComparisonsToPropertyPath - */ - public function testValidComparisonToPropertyPathOnArray($comparedValue) - { - $constraint = $this->createConstraint(['propertyPath' => '[root][value]']); - - $this->setObject(['root' => ['value' => 5]]); - - $this->validator->validate($comparedValue, $constraint); - - $this->assertNoViolation(); - } - public function testNoViolationOnNullObjectWithPropertyPath() { $constraint = $this->createConstraint(['propertyPath' => 'propertyPath']); From 9000c1eab4e7352f6c4d69b77658c87f9fce2d15 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2019 12:14:37 +0200 Subject: [PATCH 028/167] remove invalid test case --- .../Validator/Tests/Constraints/BicValidatorTest.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php index 174bbb2863437..4d9d8a0ea46cb 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php @@ -50,17 +50,6 @@ public function testValidComparisonToPropertyPath() $this->assertNoViolation(); } - public function testValidComparisonToPropertyPathOnArray() - { - $constraint = new Bic(['ibanPropertyPath' => '[root][value]']); - - $this->setObject(['root' => ['value' => 'FR14 2004 1010 0505 0001 3M02 606']]); - - $this->validator->validate('SOGEFRPP', $constraint); - - $this->assertNoViolation(); - } - public function testInvalidComparisonToPropertyPath() { $constraint = new Bic(['ibanPropertyPath' => 'value']); From b0c663071b247f86c4e34a83b9a5635be67493ff Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Thu, 27 Jun 2019 13:35:22 +0300 Subject: [PATCH 029/167] [HttpFoundation] Throw exception when the \"session\" extension is not loaded --- .../DependencyInjection/FrameworkExtension.php | 4 ++++ .../HttpFoundation/Session/Storage/NativeSessionStorage.php | 4 ++++ .../Session/Storage/PhpBridgeSessionStorage.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4e792ded2e08d..a75402d6c1109 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -233,6 +233,10 @@ public function load(array $configs, ContainerBuilder $container) } if ($this->isConfigEnabled($container, $config['session'])) { + if (!\extension_loaded('session')) { + throw new \LogicException('PHP extension "session" is required.'); + } + $this->sessionConfigEnabled = true; $this->registerSessionConfiguration($config['session'], $container, $loader); } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index c4dbe75868226..809d7002cf1cb 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -100,6 +100,10 @@ class NativeSessionStorage implements SessionStorageInterface */ public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null) { + if (!\extension_loaded('session')) { + throw new \LogicException('PHP extension "session" is required.'); + } + $options += [ 'cache_limiter' => '', 'cache_expire' => 0, diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index 662ed5015adec..8969e609aaf95 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -24,6 +24,10 @@ class PhpBridgeSessionStorage extends NativeSessionStorage */ public function __construct($handler = null, MetadataBag $metaBag = null) { + if (!\extension_loaded('session')) { + throw new \LogicException('PHP extension "session" is required.'); + } + $this->setMetadataBag($metaBag); $this->setSaveHandler($handler); } From 4d002e839741f1ed31e5126c3beb25658880dc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 28 Jun 2019 15:01:48 +0200 Subject: [PATCH 030/167] [Workflow] Deprecated DefinitionBuilder::setInitialPlace() Added missing part of #30468 --- UPGRADE-4.3.md | 2 ++ UPGRADE-5.0.md | 5 ++-- .../FrameworkExtension.php | 11 +++----- src/Symfony/Component/Workflow/CHANGELOG.md | 1 + src/Symfony/Component/Workflow/Definition.php | 4 +-- .../Component/Workflow/DefinitionBuilder.php | 26 +++++++++++++++---- .../Workflow/Tests/DefinitionBuilderTest.php | 10 +++++++ 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index 531a8e61b99b6..7a6abcca81566 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -297,6 +297,8 @@ Workflow type: method ``` + * Using `DefinitionBuilder::setInitialPlace()` is deprecated, use `DefinitionBuilder::setInitialPlaces()` instead. + Yaml ---- diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index b753931008327..e16fb86c79850 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -385,11 +385,11 @@ TwigBundle * The default value (`false`) of the `twig.strict_variables` configuration option has been changed to `%kernel.debug%`. * The `transchoice` tag and filter have been removed, use the `trans` ones instead with a `%count%` parameter. * Removed support for legacy templates directories `src/Resources/views/` and `src/Resources//views/`, use `templates/` and `templates/bundles//` instead. - + TwigBridge ---------- - * removed the `$requestStack` and `$requestContext` arguments of the + * removed the `$requestStack` and `$requestContext` arguments of the `HttpFoundationExtension`, pass a `Symfony\Component\HttpFoundation\UrlHelper` instance as the only argument instead @@ -417,6 +417,7 @@ Workflow * `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`. * Removed support of `initial_place`. Use `initial_places` instead. * `MultipleStateMarkingStore` has been removed. Use `MethodMarkingStore` instead. + * `DefinitionBuilder::setInitialPlace()` has been removed, use `DefinitionBuilder::setInitialPlaces()` instead. Before: ```yaml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index fdff97bfcd42d..b5bb52a17f137 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -706,13 +706,10 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $ } if ($validator) { - $realDefinition = (new Workflow\DefinitionBuilder($places)) - ->addTransitions(array_map(function (Reference $ref) use ($container): Workflow\Transition { - return $container->get((string) $ref); - }, $transitions)) - ->setInitialPlace($initialMarking) - ->build() - ; + $trs = array_map(function (Reference $ref) use ($container): Workflow\Transition { + return $container->get((string) $ref); + }, $transitions); + $realDefinition = new Workflow\Definition($places, $trs, $initialMarking); $validator->validate($realDefinition, $name); } diff --git a/src/Symfony/Component/Workflow/CHANGELOG.md b/src/Symfony/Component/Workflow/CHANGELOG.md index 5a32b915e50e7..2d0870d34b7c5 100644 --- a/src/Symfony/Component/Workflow/CHANGELOG.md +++ b/src/Symfony/Component/Workflow/CHANGELOG.md @@ -28,6 +28,7 @@ CHANGELOG * Dispatch `CompletedEvent` on `workflow.completed` * Dispatch `AnnounceEvent` on `workflow.announce` * Added support for many `initialPlaces` + * Deprecated `DefinitionBuilder::setInitialPlace()` method, use `DefinitionBuilder::setInitialPlaces()` instead. * Deprecated the `MultipleStateMarkingStore` class, use the `MethodMarkingStore` instead. * Deprecated the `SingleStateMarkingStore` class, use the `MethodMarkingStore` instead. diff --git a/src/Symfony/Component/Workflow/Definition.php b/src/Symfony/Component/Workflow/Definition.php index 1ecbc0dfb56e0..8a6e94206d49c 100644 --- a/src/Symfony/Component/Workflow/Definition.php +++ b/src/Symfony/Component/Workflow/Definition.php @@ -48,13 +48,13 @@ public function __construct(array $places, array $transitions, $initialPlaces = } /** - * @deprecated since Symfony 4.3. Use the getInitialPlaces() instead. + * @deprecated since Symfony 4.3. Use getInitialPlaces() instead. * * @return string|null */ public function getInitialPlace() { - @trigger_error(sprintf('Calling %s::getInitialPlace() is deprecated. Call %s::getInitialPlaces() instead.', __CLASS__, __CLASS__)); + @trigger_error(sprintf('Calling %s::getInitialPlace() is deprecated since Symfony 4.3. Call getInitialPlaces() instead.', __CLASS__), E_USER_DEPRECATED); if (!$this->initialPlaces) { return null; diff --git a/src/Symfony/Component/Workflow/DefinitionBuilder.php b/src/Symfony/Component/Workflow/DefinitionBuilder.php index 8fa90471ddec1..4bb6df4b0dc5e 100644 --- a/src/Symfony/Component/Workflow/DefinitionBuilder.php +++ b/src/Symfony/Component/Workflow/DefinitionBuilder.php @@ -24,7 +24,7 @@ class DefinitionBuilder { private $places = []; private $transitions = []; - private $initialPlace; + private $initialPlaces; private $metadataStore; /** @@ -42,7 +42,7 @@ public function __construct(array $places = [], array $transitions = []) */ public function build() { - return new Definition($this->places, $this->transitions, $this->initialPlace, $this->metadataStore); + return new Definition($this->places, $this->transitions, $this->initialPlaces, $this->metadataStore); } /** @@ -54,20 +54,36 @@ public function clear() { $this->places = []; $this->transitions = []; - $this->initialPlace = null; + $this->initialPlaces = null; $this->metadataStore = null; return $this; } /** + * @deprecated since Symfony 4.3. Use setInitialPlaces() instead. + * * @param string $place * * @return $this */ public function setInitialPlace($place) { - $this->initialPlace = $place; + @trigger_error(sprintf('Calling %s::setInitialPlace() is deprecated since Symfony 4.3. Call setInitialPlaces() instead.', __CLASS__), E_USER_DEPRECATED); + + $this->initialPlaces = $place; + + return $this; + } + + /** + * @param string|string[]|null $initialPlaces + * + * @return $this + */ + public function setInitialPlaces($initialPlaces) + { + $this->initialPlaces = $initialPlaces; return $this; } @@ -80,7 +96,7 @@ public function setInitialPlace($place) public function addPlace($place) { if (!$this->places) { - $this->initialPlace = $place; + $this->initialPlaces = $place; } $this->places[$place] = $place; diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php index 62351d7d9218a..df8d9bb8b36bd 100644 --- a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php +++ b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php @@ -9,6 +9,7 @@ class DefinitionBuilderTest extends TestCase { + /** @group legacy */ public function testSetInitialPlace() { $builder = new DefinitionBuilder(['a', 'b']); @@ -18,6 +19,15 @@ public function testSetInitialPlace() $this->assertEquals(['b'], $definition->getInitialPlaces()); } + public function testSetInitialPlaces() + { + $builder = new DefinitionBuilder(['a', 'b']); + $builder->setInitialPlaces('b'); + $definition = $builder->build(); + + $this->assertEquals(['b'], $definition->getInitialPlaces()); + } + public function testAddTransition() { $places = range('a', 'b'); From b3e32475579ca7aeabb8d17076eaf83f9eb773c9 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Fri, 28 Jun 2019 18:44:52 +0200 Subject: [PATCH 031/167] [FrameworkBundle] better message for disabled sessions --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index a75402d6c1109..68f0713b6df51 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -234,7 +234,7 @@ public function load(array $configs, ContainerBuilder $container) if ($this->isConfigEnabled($container, $config['session'])) { if (!\extension_loaded('session')) { - throw new \LogicException('PHP extension "session" is required.'); + throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://www.php.net/session.installation for instructions.'); } $this->sessionConfigEnabled = true; From ba241ce3cc9957fbfac1206e5e14a4f6b031f59a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2019 18:36:51 +0200 Subject: [PATCH 032/167] deprecate the framework.templating option --- UPGRADE-4.3.md | 1 + UPGRADE-5.0.md | 2 +- src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 1 + .../FrameworkBundle/DependencyInjection/Configuration.php | 1 + .../Tests/DependencyInjection/ConfigurationTest.php | 3 +++ .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ++++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index 7a6abcca81566..5b581405ce01b 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -71,6 +71,7 @@ Form FrameworkBundle --------------- + * Deprecated the `framework.templating` option, use Twig instead. * Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will be mandatory in 5.0. * Deprecated the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead. diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index e16fb86c79850..f8e2c70d25ced 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -169,8 +169,8 @@ Form FrameworkBundle --------------- + * Remved the `framework.templating` option, use Twig instead. * The project dir argument of the constructor of `AssetsInstallCommand` is required. - * Removed support for `bundle:controller:action` syntax to reference controllers. Use `serviceOrFqcn::method` instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller. diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 8c877f562d38e..d8c07db3fc138 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 4.3.0 ----- + * Deprecated the `framework.templating` option, use Twig instead. * Added `WebTestAssertionsTrait` (included by default in `WebTestCase`) * Renamed `Client` to `KernelBrowser` * Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index ea64157fde9bc..e7233cd49e71f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -605,6 +605,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode) ->arrayNode('templating') ->info('templating configuration') ->canBeEnabled() + ->setDeprecated('The "%path%.%node%" configuration is deprecated since Symfony 4.3. Use the "twig" service directly instead.') ->beforeNormalization() ->ifTrue(function ($v) { return false === $v || \is_array($v) && false === $v['enabled']; }) ->then(function () { return ['enabled' => false, 'engines' => false]; }) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 3980036006b11..4a5001e106e49 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -35,6 +35,9 @@ public function testDefaultConfig() ); } + /** + * @group legacy + */ public function testDoNoDuplicateDefaultFormResources() { $input = ['templating' => [ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index fab27d4897502..01cd04a74335d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -602,6 +602,9 @@ public function testTemplating() $this->assertEquals('global_hinclude_template', $container->getParameter('fragment.renderer.hinclude.global_template'), '->registerTemplatingConfiguration() registers the global hinclude.js template'); } + /** + * @group legacy + */ public function testTemplatingCanBeDisabled() { $container = $this->createContainerFromFile('templating_disabled'); @@ -867,6 +870,7 @@ public function testTranslatorMultipleFallbacks() } /** + * @group legacy * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException */ public function testTemplatingRequiresAtLeastOneEngine() From 28882f52cbe8fc086d6ed32beff6290ee997793c Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 29 Jun 2019 18:43:59 +0200 Subject: [PATCH 033/167] Annotated correct return type for getInEdges()/getOutEdges(). --- .../Compiler/ServiceReferenceGraphNode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php index 6abd6c86af703..50140b5fffd67 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -81,7 +81,7 @@ public function getId() /** * Returns the in edges. * - * @return array The in ServiceReferenceGraphEdge array + * @return ServiceReferenceGraphEdge[] */ public function getInEdges() { @@ -91,7 +91,7 @@ public function getInEdges() /** * Returns the out edges. * - * @return array The out ServiceReferenceGraphEdge array + * @return ServiceReferenceGraphEdge[] */ public function getOutEdges() { From 848e881d5d540d4b4a24a0e34f9f9bb77bffc977 Mon Sep 17 00:00:00 2001 From: Thomas Bisignani Date: Fri, 28 Jun 2019 14:56:51 +0200 Subject: [PATCH 034/167] [Security] [Guard] Removed useless param annotations --- .../Guard/AbstractGuardAuthenticator.php | 3 +-- .../AbstractFormLoginAuthenticator.php | 4 +--- .../Security/Guard/AuthenticatorInterface.php | 4 ---- .../Guard/GuardAuthenticatorHandler.php | 15 +++------------ .../Guard/GuardAuthenticatorInterface.php | 18 ++---------------- 5 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php index 8c09267d0facc..7bcfc39438dd9 100644 --- a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php @@ -36,8 +36,7 @@ public function supports(Request $request) * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really * care about which authenticated token you're using. * - * @param UserInterface $user - * @param string $providerKey + * @param string $providerKey * * @return PostAuthenticationGuardToken */ diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index 7986b16b4c11f..a9c565b6bb9b2 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -55,9 +55,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio /** * Override to change what happens after successful authentication. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey + * @param string $providerKey * * @return RedirectResponse */ diff --git a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php index 90df7610ad2bb..4912cb3bad594 100644 --- a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php @@ -30,8 +30,6 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface * * If this returns false, the authenticator will be skipped. * - * @param Request $request - * * @return bool */ public function supports(Request $request); @@ -53,8 +51,6 @@ public function supports(Request $request); * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed Any non-null value * * @throws \UnexpectedValueException If null is returned diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 1cdcf6b967ed3..24a16e3f0c523 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -70,10 +70,7 @@ public function authenticateWithToken(TokenInterface $token, Request $request/*, /** * Returns the "on success" response for the given GuardAuthenticator. * - * @param TokenInterface $token - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -93,10 +90,7 @@ public function handleAuthenticationSuccess(TokenInterface $token, Request $requ * Convenience method for authenticating the user and returning the * Response *if any* for success. * - * @param UserInterface $user - * @param Request $request - * @param AuthenticatorInterface $authenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -115,10 +109,7 @@ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $r * Handles an authentication failure and returns the Response for the * GuardAuthenticator. * - * @param AuthenticationException $authenticationException - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The key of the firewall + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php index 3a9828dfd607f..7372eb844a6d0 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php @@ -55,8 +55,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed|null */ public function getCredentials(Request $request); @@ -69,9 +67,6 @@ public function getCredentials(Request $request); * You may throw an AuthenticationException if you wish. If you return * null, then a UsernameNotFoundException is thrown for you. * - * @param mixed $credentials - * @param UserProviderInterface $userProvider - * * @throws AuthenticationException * * @return UserInterface|null @@ -87,9 +82,6 @@ public function getUser($credentials, UserProviderInterface $userProvider); * * The *credentials* are the return value from getCredentials() * - * @param mixed $credentials - * @param UserInterface $user - * * @return bool * * @throws AuthenticationException @@ -105,8 +97,7 @@ public function checkCredentials($credentials, UserInterface $user); * * @see AbstractGuardAuthenticator * - * @param UserInterface $user - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return GuardTokenInterface */ @@ -121,9 +112,6 @@ public function createAuthenticatedToken(UserInterface $user, $providerKey); * If you return null, the request will continue, but the user will * not be authenticated. This is probably not what you want to do. * - * @param Request $request - * @param AuthenticationException $exception - * * @return Response|null */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception); @@ -137,9 +125,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio * If you return null, the current request will continue, and the user * will be authenticated. This makes sense, for example, with an API. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ From 6c49a0c758c0dfacbe812bef8348ae7356029137 Mon Sep 17 00:00:00 2001 From: Alex Bowers Date: Sun, 30 Jun 2019 23:48:04 +0100 Subject: [PATCH 035/167] Add test case --- .../Component/HttpFoundation/Tests/RequestTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index d266e1f68a4cc..650d8fca7dba9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -2427,6 +2427,18 @@ public function testTrustedPort() $this->assertSame(443, $request->getPort()); } + + public function testTrustedPortDoesNotDefaultToZero() + { + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('X-Forwarded-Host', 'test.example.com'); + $request->headers->set('X-Forwarded-Port', null); + + $this->assertSame(80, $request->getPort()); + } } class RequestContentProxy extends Request From a03b5d8089f273ef778123bf4190dc888f422b89 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Mon, 1 Jul 2019 01:07:21 +0200 Subject: [PATCH 036/167] fix invalid call to PhpFileLoader::load() in a test --- .../Tests/DependencyInjection/Fixtures/php/merge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php index 3e1541a0e56e6..45ec00448f82d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php @@ -1,6 +1,6 @@ load('merge_import.php', $container); +$this->load('merge_import.php'); $container->loadFromExtension('security', [ 'providers' => [ From 8930335934ff5c2dbf24a0cc2bac68c2d9bf0fea Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sat, 29 Jun 2019 22:01:40 +0200 Subject: [PATCH 037/167] fix invalid call to PhpFileLoader::load() in a test --- .../Tests/DependencyInjection/Fixtures/php/sodium_encoder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/sodium_encoder.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/sodium_encoder.php index 5fdef4b8046fa..ec0851bdfaa34 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/sodium_encoder.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/sodium_encoder.php @@ -1,6 +1,6 @@ load('container1.php', $container); +$this->load('container1.php'); $container->loadFromExtension('security', [ 'encoders' => [ From c986c86d1c015f611f1683e5db35135abecbef98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Mon, 1 Jul 2019 09:18:49 +0200 Subject: [PATCH 038/167] =?UTF-8?q?[Lock]=C2=A0Stores=20must=20implement?= =?UTF-8?q?=20`putOffExpiration`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Symfony/Component/Lock/Store/ZookeeperStore.php | 2 +- src/Symfony/Component/Lock/StoreInterface.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Component/Lock/Store/ZookeeperStore.php b/src/Symfony/Component/Lock/Store/ZookeeperStore.php index 4f8b4ee374e86..030289992144d 100644 --- a/src/Symfony/Component/Lock/Store/ZookeeperStore.php +++ b/src/Symfony/Component/Lock/Store/ZookeeperStore.php @@ -91,7 +91,7 @@ public function waitAndSave(Key $key) */ public function putOffExpiration(Key $key, $ttl) { - throw new NotSupportedException(); + // do nothing, zookeeper locks forever. } /** diff --git a/src/Symfony/Component/Lock/StoreInterface.php b/src/Symfony/Component/Lock/StoreInterface.php index 519c3e4731aa2..e5a1dfa58870c 100644 --- a/src/Symfony/Component/Lock/StoreInterface.php +++ b/src/Symfony/Component/Lock/StoreInterface.php @@ -49,7 +49,6 @@ public function waitAndSave(Key $key); * @param float $ttl amount of seconds to keep the lock in the store * * @throws LockConflictedException - * @throws NotSupportedException */ public function putOffExpiration(Key $key, $ttl); From 8544a35e52a4a1acdfc134a9fb68c31fa3a677ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Mon, 1 Jul 2019 10:51:14 +0200 Subject: [PATCH 039/167] Remove @internal annotations for the serilize methods --- src/Symfony/Component/Mime/Message.php | 6 ------ src/Symfony/Component/Mime/RawMessage.php | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/Symfony/Component/Mime/Message.php b/src/Symfony/Component/Mime/Message.php index db6e13fae6a4d..4d6af1c94d4b4 100644 --- a/src/Symfony/Component/Mime/Message.php +++ b/src/Symfony/Component/Mime/Message.php @@ -130,17 +130,11 @@ private function generateMessageId(string $email): string return bin2hex(random_bytes(16)).strstr($email, '@'); } - /** - * @internal - */ public function __serialize(): array { return [$this->headers, $this->body]; } - /** - * @internal - */ public function __unserialize(array $data): void { [$this->headers, $this->body] = $data; diff --git a/src/Symfony/Component/Mime/RawMessage.php b/src/Symfony/Component/Mime/RawMessage.php index 16b090c95474e..40a2795e2369e 100644 --- a/src/Symfony/Component/Mime/RawMessage.php +++ b/src/Symfony/Component/Mime/RawMessage.php @@ -69,17 +69,11 @@ final public function unserialize($serialized) $this->__unserialize(unserialize($serialized)); } - /** - * @internal - */ public function __serialize(): array { return [$this->message]; } - /** - * @internal - */ public function __unserialize(array $data): void { [$this->message] = $data; From 58651409b47e86ece0473f22b08b9e63c067c8eb Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 1 Jul 2019 14:42:30 +0200 Subject: [PATCH 040/167] Removed unused field. --- .../Compiler/AnalyzeServiceReferencesPass.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index 2dafb5378946e..87bb14780de13 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -34,7 +34,6 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe private $onlyConstructorArguments; private $hasProxyDumper; private $lazy; - private $expressionLanguage; private $byConstructor; private $definitions; private $aliases; From c6e18374a25518384ae094c8871cb5196a719890 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 1 Jul 2019 10:32:47 -0400 Subject: [PATCH 041/167] Fixing validation for messenger transports retry_strategy service key --- .../DependencyInjection/Configuration.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index ea64157fde9bc..e7034b411e7ed 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1195,9 +1195,14 @@ function ($a) { ->end() ->arrayNode('retry_strategy') ->addDefaultsIfNotSet() - ->validate() - ->ifTrue(function ($v) { return null !== $v['service'] && (isset($v['max_retries']) || isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay'])); }) - ->thenInvalid('"service" cannot be used along with the other retry_strategy options.') + ->beforeNormalization() + ->always(function ($v) { + if (isset($v['service']) && (isset($v['max_retries']) || isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay']))) { + throw new \InvalidArgumentException('The "service" cannot be used along with the other "retry_strategy" options.'); + } + + return $v; + }) ->end() ->children() ->scalarNode('service')->defaultNull()->info('Service id to override the retry strategy entirely')->end() From d59ec2a34cc3174929a6fd3d37507a95d26e6d8e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 1 Jul 2019 21:17:30 +0200 Subject: [PATCH 042/167] fix workflow config examples --- UPGRADE-4.3.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index 7a6abcca81566..20b970c15a78e 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -234,10 +234,10 @@ Workflow ```yaml framework: workflows: - type: workflow article: + type: workflow marking_store: - type: multiple + type: multiple_state arguments: states ``` @@ -245,8 +245,8 @@ Workflow ```yaml framework: workflows: - type: workflow article: + type: workflow marking_store: type: method property: states @@ -267,8 +267,8 @@ Workflow ```yaml framework: workflows: - type: state_machine article: + type: state_machine marking_store: type: method property: state From fa6ae8ce5073f8ccdcffcc8d719e01caa470d4b3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jul 2019 17:10:36 +0200 Subject: [PATCH 043/167] [FrmaeworkBundle] More simplifications in the DI configuration --- .../FrameworkBundle/DependencyInjection/Configuration.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index ea64157fde9bc..443332f2cee92 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -339,10 +339,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode) ->defaultNull() ->end() ->arrayNode('initial_marking') - ->beforeNormalization() - ->ifTrue(function ($v) { return !\is_array($v); }) - ->then(function ($v) { return [$v]; }) - ->end() + ->beforeNormalization()->castToArray()->end() ->defaultValue([]) ->prototype('scalar')->end() ->end() From f19f28a41d62acf89f11ad077550ebb38767aad6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 3 Jul 2019 09:52:02 +0200 Subject: [PATCH 044/167] only decorate when an event dispatcher was passed --- src/Symfony/Component/Workflow/Workflow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Workflow/Workflow.php b/src/Symfony/Component/Workflow/Workflow.php index e3df8cb0d072d..76e53eda5120e 100644 --- a/src/Symfony/Component/Workflow/Workflow.php +++ b/src/Symfony/Component/Workflow/Workflow.php @@ -43,7 +43,7 @@ public function __construct(Definition $definition, MarkingStoreInterface $marki { $this->definition = $definition; $this->markingStore = $markingStore ?: new MultipleStateMarkingStore(); - $this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher); + $this->dispatcher = null !== $dispatcher ? LegacyEventDispatcherProxy::decorate($dispatcher) : null; $this->name = $name; } From bedae5dde9ee9430e4ac077d905159e1968f272d Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 3 Jul 2019 11:22:31 +0200 Subject: [PATCH 045/167] Fix authentication for redis transport --- .../Tests/Transport/RedisExt/ConnectionTest.php | 10 ++++++++++ .../Messenger/Transport/RedisExt/Connection.php | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php index 177f6b90384c5..0d80e920c3571 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php @@ -79,6 +79,16 @@ public function testKeepGettingPendingMessages() $this->assertNotNull($connection->get()); } + public function testAuth() + { + $redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock(); + + $redis->expects($this->exactly(1))->method('auth') + ->with('password'); + + Connection::fromDsn('redis://password@localhost/queue', [], $redis); + } + public function testFirstGetPendingMessagesThenNewMessages() { $redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock(); diff --git a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php index 18b6091e9c64f..8524c1fe03b65 100644 --- a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php @@ -51,6 +51,11 @@ public function __construct(array $configuration, array $connectionCredentials = $this->connection = $redis ?: new \Redis(); $this->connection->connect($connectionCredentials['host'] ?? '127.0.0.1', $connectionCredentials['port'] ?? 6379); $this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP); + + if (isset($connectionCredentials['auth'])) { + $this->connection->auth($connectionCredentials['auth']); + } + $this->stream = $configuration['stream'] ?? self::DEFAULT_OPTIONS['stream']; $this->group = $configuration['group'] ?? self::DEFAULT_OPTIONS['group']; $this->consumer = $configuration['consumer'] ?? self::DEFAULT_OPTIONS['consumer']; @@ -72,6 +77,7 @@ public static function fromDsn(string $dsn, array $redisOptions = [], \Redis $re $connectionCredentials = [ 'host' => $parsedUrl['host'] ?? '127.0.0.1', 'port' => $parsedUrl['port'] ?? 6379, + 'auth' => $parsedUrl['pass'] ?? $parsedUrl['user'] ?? null, ]; if (isset($parsedUrl['query'])) { From b5c6a349ab38d8526bb6747b66a8c8da7bb4349a Mon Sep 17 00:00:00 2001 From: smoench Date: Wed, 3 Jul 2019 13:34:39 +0200 Subject: [PATCH 046/167] [Filesystem] added missing deprecations to UPGRADE-4.3.md --- UPGRADE-4.3.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index 20b970c15a78e..40d50e583f9c8 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -57,6 +57,12 @@ EventDispatcher * The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated * The `Event` class has been deprecated, use `Symfony\Contracts\EventDispatcher\Event` instead +Filesystem +---------- + + * Support for passing arrays to `Filesystem::dumpFile()` is deprecated. + * Support for passing arrays to `Filesystem::appendToFile()` is deprecated. + Form ---- From 5909e6f336320ed661459395225f735472b790a1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 3 Jul 2019 14:31:50 +0200 Subject: [PATCH 047/167] fixed typo --- UPGRADE-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index f8e2c70d25ced..6e7bb0a73641d 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -169,7 +169,7 @@ Form FrameworkBundle --------------- - * Remved the `framework.templating` option, use Twig instead. + * Removed the `framework.templating` option, use Twig instead. * The project dir argument of the constructor of `AssetsInstallCommand` is required. * Removed support for `bundle:controller:action` syntax to reference controllers. Use `serviceOrFqcn::method` instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller. From 5f4ab23991ee5d70746366d2384d8e33215d3482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 3 Jul 2019 14:56:57 +0200 Subject: [PATCH 048/167] [Messenger] Added more test for MessageBus --- .../Messenger/Tests/MessageBusTest.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php index bcddcffd8aac7..c8644623b7b5f 100644 --- a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php +++ b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Messenger\MessageBus; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\Middleware\MiddlewareInterface; +use Symfony\Component\Messenger\Middleware\StackInterface; use Symfony\Component\Messenger\Stamp\BusNameStamp; use Symfony\Component\Messenger\Stamp\DelayStamp; use Symfony\Component\Messenger\Stamp\ReceivedStamp; @@ -148,4 +149,44 @@ public function testItAddsTheStampsToEnvelope() $finalEnvelope = (new MessageBus())->dispatch(new Envelope(new \stdClass()), [new DelayStamp(5), new BusNameStamp('bar')]); $this->assertCount(2, $finalEnvelope->all()); } + + public function provideConstructorDataStucture() + { + yield 'iterator' => [new \ArrayObject([ + new SimpleMiddleware(), + new SimpleMiddleware(), + ])]; + + yield 'array' => [[ + new SimpleMiddleware(), + new SimpleMiddleware(), + ]]; + + yield 'generator' => [(function (): \Generator { + yield new SimpleMiddleware(); + yield new SimpleMiddleware(); + })()]; + } + + /** @dataProvider provideConstructorDataStucture */ + public function testConstructDataStructure($dataStructure) + { + $bus = new MessageBus($dataStructure); + $envelope = new Envelope(new DummyMessage('Hello')); + $newEnvelope = $bus->dispatch($envelope); + $this->assertSame($envelope->getMessage(), $newEnvelope->getMessage()); + + // Test rewindable capacity + $envelope = new Envelope(new DummyMessage('Hello')); + $newEnvelope = $bus->dispatch($envelope); + $this->assertSame($envelope->getMessage(), $newEnvelope->getMessage()); + } +} + +class SimpleMiddleware implements MiddlewareInterface +{ + public function handle(Envelope $envelope, StackInterface $stack): Envelope + { + return $envelope; + } } From 1f8927a9a64dc80124389fe482ba9ccc40ed8689 Mon Sep 17 00:00:00 2001 From: misterx <216417+misterx@users.noreply.github.com> Date: Wed, 26 Jun 2019 14:51:54 +0300 Subject: [PATCH 049/167] Fixes windows error --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index c0f4b782b64a9..3f5d14574de71 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -95,7 +95,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true))); + $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p)); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); From 5ff45bac6669c3269f460c5490d0c8f754a5fcf2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 4 Jul 2019 10:44:43 +0200 Subject: [PATCH 050/167] [FrameworkBundle] reset cache pools between requests --- .../FrameworkBundle/Resources/config/cache.xml | 14 +++++++------- .../DependencyInjection/FrameworkExtensionTest.php | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 36db49a497982..a7aaaec7c0785 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ - + 0 @@ -39,7 +39,7 @@ - + 0 @@ -50,7 +50,7 @@ - + @@ -61,7 +61,7 @@ - + 0 @@ -72,14 +72,14 @@ - + 0 - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 51b4ff1524267..73c33a3f5011d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -19,7 +19,6 @@ use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\ApcuAdapter; use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\Adapter\ChainAdapter; use Symfony\Component\Cache\Adapter\DoctrineAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; @@ -1244,10 +1243,6 @@ private function assertCachePoolServiceDefinitionIsCreated(ContainerBuilder $con $this->assertSame(DoctrineAdapter::class, $parentDefinition->getClass()); break; case 'cache.app': - if (ChainAdapter::class === $parentDefinition->getClass()) { - break; - } - // no break case 'cache.adapter.filesystem': $this->assertSame(FilesystemAdapter::class, $parentDefinition->getClass()); break; From b06d0003a3ab73d7e583cfb687d43e8e5a0c0870 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 4 Jul 2019 11:24:58 +0200 Subject: [PATCH 051/167] [DI] fix processing of regular parameter bags by MergeExtensionConfigurationPass --- .../Compiler/MergeExtensionConfigurationPass.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index 63f8013c313fb..caa1fd2251672 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -186,6 +186,10 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs $bag = $this->getParameterBag(); $value = $bag->resolveValue($value); + if (!$bag instanceof EnvPlaceholderParameterBag) { + return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); + } + foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { if (false === strpos($env, ':')) { continue; From af850146a4d610295141bbfbfff952111822de2d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 4 Jul 2019 18:09:01 +0200 Subject: [PATCH 052/167] [Bridge/PhpUnit] fix running composer to install phpunit --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 3f5d14574de71..04e0ed46157a5 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -95,7 +95,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p)); + $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd())); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); From ea34d6dcf5c1177dccc6877c7e19e12862d215ff Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 4 Jul 2019 19:06:26 +0200 Subject: [PATCH 053/167] bump phpunit-bridge cache ids --- phpunit | 2 +- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit b/phpunit index dc9e127b78fb7..6d5bdc279bcd7 100755 --- a/phpunit +++ b/phpunit @@ -1,7 +1,7 @@ #!/usr/bin/env php Date: Thu, 4 Jul 2019 21:43:27 +0200 Subject: [PATCH 054/167] conditionally register services --- .../DependencyInjection/SecurityExtension.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 2db17aa130c39..8d9ac136b0c42 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -28,6 +28,8 @@ use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder; +use Symfony\Component\Templating\Helper\Helper; +use Twig\Extension\AbstractExtension; /** * SecurityExtension. @@ -69,8 +71,18 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('security.xml'); $loader->load('security_listeners.xml'); $loader->load('security_rememberme.xml'); - $loader->load('templating_php.xml'); - $loader->load('templating_twig.xml'); + + if (class_exists(Helper::class)) { + $loader->load('templating_php.xml'); + + $container->getDefinition('templating.helper.logout_url')->setPrivate(true); + $container->getDefinition('templating.helper.security')->setPrivate(true); + } + + if (class_exists(AbstractExtension::class)) { + $loader->load('templating_twig.xml'); + } + $loader->load('collectors.xml'); $loader->load('guard.xml'); @@ -79,8 +91,6 @@ public function load(array $configs, ContainerBuilder $container) $container->getDefinition('security.firewall.context')->setPrivate(true); $container->getDefinition('security.validator.user_password')->setPrivate(true); $container->getDefinition('security.rememberme.response_listener')->setPrivate(true); - $container->getDefinition('templating.helper.logout_url')->setPrivate(true); - $container->getDefinition('templating.helper.security')->setPrivate(true); $container->getAlias('security.encoder_factory')->setPrivate(true); if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) { From 9931b3e1833c2502c03f2f345bae7eae875c06da Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 4 Jul 2019 22:24:44 +0200 Subject: [PATCH 055/167] [Messenger] fix broken key normalization --- .../FrameworkBundle/DependencyInjection/Configuration.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index b407513bef508..f723a64439146 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1114,6 +1114,7 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode) ->end() ->children() ->arrayNode('routing') + ->normalizeKeys(false) ->useAttributeAsKey('message_class') ->beforeNormalization() ->always() @@ -1173,6 +1174,7 @@ function ($a) { ->end() ->end() ->arrayNode('transports') + ->normalizeKeys(false) ->useAttributeAsKey('name') ->arrayPrototype() ->beforeNormalization() @@ -1220,6 +1222,7 @@ function ($a) { ->scalarNode('default_bus')->defaultNull()->end() ->arrayNode('buses') ->defaultValue(['messenger.bus.default' => ['default_middleware' => true, 'middleware' => []]]) + ->normalizeKeys(false) ->useAttributeAsKey('name') ->arrayPrototype() ->addDefaultsIfNotSet() From adcdd938a4e29599b7c4135fecffc216e9ca17a6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 4 Jul 2019 22:58:06 +0200 Subject: [PATCH 056/167] PHP 5 compat --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 38b7fc21691c8..7185d75e92209 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1037,7 +1037,7 @@ public function getPort() $pos = strrpos($host, ':'); } - if (false !== $pos && '' !== $port = substr($host, $pos + 1)) { + if (false !== $pos && $port = substr($host, $pos + 1)) { return (int) $port; } From 77747a94729b74b2353f5c0c9467662ed88f0cdb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 5 Jul 2019 06:51:06 +0200 Subject: [PATCH 057/167] fixed phpdocs --- .../Bundle/FrameworkBundle/Command/AbstractConfigCommand.php | 3 +++ src/Symfony/Component/Config/Definition/ArrayNode.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index cc1b858abb337..fe0d60b5554ff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -52,6 +52,9 @@ protected function listBundles($output) } } + /** + * @return ExtensionInterface + */ protected function findExtension($name) { $bundles = $this->initializeBundles(); diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index ac310819d4199..2afa629cdae46 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -141,7 +141,7 @@ public function setPerformDeepMerging($boolean) } /** - * Whether extra keys should just be ignore without an exception. + * Whether extra keys should just be ignored without an exception. * * @param bool $boolean To allow extra keys * @param bool $remove To remove extra keys From d9833ace32c69681a0a01f309f5f2b6cc57b0485 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 5 Jul 2019 08:33:15 +0200 Subject: [PATCH 058/167] [PhpUnitBridge] fix running simple-phpunit on Windows --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 49b88ed969a3a..7afcbeedc768d 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -94,8 +94,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ } $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); + $q = '\\' === DIRECTORY_SEPARATOR ? '"' : ''; // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd())); + $exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", array(), $p, getcwd())); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($exit) { exit($exit); From ec5d7346b397d2ce8c4837d83da6d6881db31651 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 5 Jul 2019 09:04:50 +0200 Subject: [PATCH 059/167] Fix CS regarding nullable arguments --- src/Symfony/Component/Console/Helper/ProgressBar.php | 2 +- src/Symfony/Component/HttpFoundation/UrlHelper.php | 2 +- .../Component/HttpKernel/DataCollector/LoggerDataCollector.php | 2 +- .../Component/HttpKernel/EventListener/LocaleAwareListener.php | 2 +- .../Core/Authentication/AuthenticationTrustResolver.php | 2 +- .../Serializer/Extractor/ObjectPropertyListExtractor.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php index e30fe786e3ab6..cb2bc21379c54 100644 --- a/src/Symfony/Component/Console/Helper/ProgressBar.php +++ b/src/Symfony/Component/Console/Helper/ProgressBar.php @@ -248,7 +248,7 @@ public function setRedrawFrequency(int $freq) * * @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable */ - public function iterate(iterable $iterable, ?int $max = null): iterable + public function iterate(iterable $iterable, int $max = null): iterable { $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0)); diff --git a/src/Symfony/Component/HttpFoundation/UrlHelper.php b/src/Symfony/Component/HttpFoundation/UrlHelper.php index 3c06e9321734f..f114c0a9fb838 100644 --- a/src/Symfony/Component/HttpFoundation/UrlHelper.php +++ b/src/Symfony/Component/HttpFoundation/UrlHelper.php @@ -23,7 +23,7 @@ final class UrlHelper private $requestStack; private $requestContext; - public function __construct(RequestStack $requestStack, ?RequestContext $requestContext = null) + public function __construct(RequestStack $requestStack, RequestContext $requestContext = null) { $this->requestStack = $requestStack; $this->requestContext = $requestContext; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 4091b6760f4d1..405a951526bde 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -149,7 +149,7 @@ private function getContainerDeprecationLogs() return $logs; } - private function getContainerCompilerLogs(?string $compilerLogsFilepath = null): array + private function getContainerCompilerLogs(string $compilerLogsFilepath = null): array { if (!file_exists($compilerLogsFilepath)) { return []; diff --git a/src/Symfony/Component/HttpKernel/EventListener/LocaleAwareListener.php b/src/Symfony/Component/HttpKernel/EventListener/LocaleAwareListener.php index 325b8cbc0d569..fb8e67e7ed492 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/LocaleAwareListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/LocaleAwareListener.php @@ -63,7 +63,7 @@ public static function getSubscribedEvents() ]; } - private function setLocale(string $locale, ?string $defaultLocale = null): void + private function setLocale(string $locale, string $defaultLocale = null): void { foreach ($this->localeAwareServices as $service) { try { diff --git a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php index cba6a8708243e..bc057445da501 100644 --- a/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php +++ b/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php @@ -25,7 +25,7 @@ class AuthenticationTrustResolver implements AuthenticationTrustResolverInterfac private $anonymousClass; private $rememberMeClass; - public function __construct(?string $anonymousClass = null, ?string $rememberMeClass = null) + public function __construct(string $anonymousClass = null, string $rememberMeClass = null) { $this->anonymousClass = $anonymousClass; $this->rememberMeClass = $rememberMeClass; diff --git a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php index 2ea19d28faa20..c3e117945e2f7 100644 --- a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php +++ b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php @@ -23,7 +23,7 @@ final class ObjectPropertyListExtractor implements ObjectPropertyListExtractorIn private $propertyListExtractor; private $objectClassResolver; - public function __construct(PropertyListExtractorInterface $propertyListExtractor, ?callable $objectClassResolver = null) + public function __construct(PropertyListExtractorInterface $propertyListExtractor, callable $objectClassResolver = null) { $this->propertyListExtractor = $propertyListExtractor; $this->objectClassResolver = $objectClassResolver; From 416502df4ec916599ebd27aee967f8f354f4062a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 5 Jul 2019 12:25:01 +0200 Subject: [PATCH 060/167] pass default cache lifetime as an integer --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 68f0713b6df51..bacd35b910d00 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1710,7 +1710,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con if (!$container->getParameter('kernel.debug')) { $propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']); - $propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); + $propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']); $propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']); } else { From e110603e5e99e6eaf5d8ed2eb6f9a0b85fc63ffe Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Fri, 5 Jul 2019 21:20:21 +0200 Subject: [PATCH 061/167] Don't pass objects as class name to ContainerBuilder::register. --- .../Messenger/Tests/DependencyInjection/MessengerPassTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php index 6c97608c9f4fc..b484bc3abe98d 100644 --- a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php +++ b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php @@ -448,10 +448,8 @@ public function testNeedsToHandleAtLeastOneMessage() public function testRegistersTraceableBusesToCollector() { - $dataCollector = $this->getMockBuilder(MessengerDataCollector::class)->getMock(); - $container = $this->getContainerBuilder($fooBusId = 'messenger.bus.foo'); - $container->register('data_collector.messenger', $dataCollector); + $container->register('data_collector.messenger', MessengerDataCollector::class); $container->setParameter('kernel.debug', true); (new MessengerPass())->process($container); From 6a1bae27d1449e67aa8f087c03f77a7800f0765f Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Fri, 5 Jul 2019 22:59:32 +0200 Subject: [PATCH 062/167] fix merge --- .../SecurityBundle/DependencyInjection/SecurityExtension.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index f527d0181e0ed..21c890d4b5435 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -102,9 +102,6 @@ public function load(array $configs, ContainerBuilder $container) if (class_exists(Helper::class)) { $loader->load('templating_php.xml'); - - $container->getDefinition('templating.helper.logout_url')->setPrivate(true); - $container->getDefinition('templating.helper.security')->setPrivate(true); } if (class_exists(AbstractExtension::class)) { From 5e26d96a6b9c4b3529c1dd54560b888e09b5689b Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sat, 6 Jul 2019 10:17:29 +0200 Subject: [PATCH 063/167] [Intl] Init compile tmp volume --- src/Symfony/Component/Intl/Resources/bin/compile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Intl/Resources/bin/compile b/src/Symfony/Component/Intl/Resources/bin/compile index a59380960441a..d66558395d1ad 100755 --- a/src/Symfony/Component/Intl/Resources/bin/compile +++ b/src/Symfony/Component/Intl/Resources/bin/compile @@ -1,8 +1,7 @@ #!/usr/bin/env bash -if [[ $1 == force ]]; then - docker pull jakzal/php-intl -fi; +[[ $1 == force ]] && docker pull jakzal/php-intl +[[ ! -d /tmp/symfony/icu ]] && mkdir -p /tmp/symfony/icu docker run \ -it --rm --name symfony-intl \ From 0c52a531e2af2b2434cf409564bf7ed4e2d3fae9 Mon Sep 17 00:00:00 2001 From: Bruno Nogueira Nascimento Wowk Date: Fri, 5 Jul 2019 15:17:39 -0300 Subject: [PATCH 064/167] Remove call to deprecated method --- .../Component/Messenger/DependencyInjection/MessengerPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php index f0ed17627f840..a7a0a3aec3e22 100644 --- a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php +++ b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php @@ -214,7 +214,7 @@ private function guessHandledClasses(\ReflectionClass $handlerClass, string $ser throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type)); } - return [(string) $parameters[0]->getType()]; + return [$parameters[0]->getType()->getName()]; } private function registerReceivers(ContainerBuilder $container, array $busIds) From 50b3ec4dc507c6448411f14f8051e449470016ad Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 7 Jul 2019 01:09:30 +0200 Subject: [PATCH 065/167] [Messenger] fix publishing headers set on AmqpStamp --- .../Tests/Transport/AmqpExt/ConnectionTest.php | 15 +++++++++++++++ .../Messenger/Transport/AmqpExt/AmqpStamp.php | 4 ++-- .../Messenger/Transport/AmqpExt/Connection.php | 15 +++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/ConnectionTest.php b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/ConnectionTest.php index e7dee84219e3f..a81f54c4bc347 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/ConnectionTest.php @@ -418,6 +418,21 @@ public function testObfuscatePasswordInDsn() $connection->channel(); } + public function testAmqpStampHeadersAreUsed() + { + $factory = new TestAmqpFactory( + $this->createMock(\AMQPConnection::class), + $this->createMock(\AMQPChannel::class), + $this->createMock(\AMQPQueue::class), + $amqpExchange = $this->createMock(\AMQPExchange::class) + ); + + $amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => ['Foo' => 'X', 'Bar' => 'Y']]); + + $connection = Connection::fromDsn('amqp://localhost', [], $factory); + $connection->publish('body', ['Foo' => 'X'], 0, new AmqpStamp(null, AMQP_NOPARAM, ['headers' => ['Bar' => 'Y']])); + } + public function testItCanPublishWithTheDefaultRoutingKey() { $factory = new TestAmqpFactory( diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpStamp.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpStamp.php index d7a00c09b4436..b8298d5697d96 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpStamp.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpStamp.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt; -use Symfony\Component\Messenger\Stamp\StampInterface; +use Symfony\Component\Messenger\Stamp\NonSendableStampInterface; /** * @author Guillaume Gammelin @@ -19,7 +19,7 @@ * * @experimental in 4.3 */ -final class AmqpStamp implements StampInterface +final class AmqpStamp implements NonSendableStampInterface { private $routingKey; private $flags; diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php index ecd72a7be9d90..3c7a91f62186a 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php @@ -191,9 +191,7 @@ public function publish(string $body, array $headers = [], int $delay = 0, AmqpS $this->exchange(), $body, $this->getRoutingKeyForMessage($amqpStamp), - [ - 'headers' => $headers, - ], + $headers, $amqpStamp ); } @@ -223,20 +221,21 @@ private function publishWithDelay(string $body, array $headers, int $delay, Amqp $this->getDelayExchange(), $body, $this->getRoutingKeyForDelay($delay, $routingKey), - [ - 'headers' => $headers, - ], + $headers, $amqpStamp ); } - private function publishOnExchange(\AMQPExchange $exchange, string $body, string $routingKey = null, array $attributes = [], AmqpStamp $amqpStamp = null) + private function publishOnExchange(\AMQPExchange $exchange, string $body, string $routingKey = null, array $headers = [], AmqpStamp $amqpStamp = null) { + $attributes = $amqpStamp ? $amqpStamp->getAttributes() : []; + $attributes['headers'] = array_merge($headers, $attributes['headers'] ?? []); + $exchange->publish( $body, $routingKey, $amqpStamp ? $amqpStamp->getFlags() : AMQP_NOPARAM, - array_merge($amqpStamp ? $amqpStamp->getAttributes() : [], $attributes) + $attributes ); } From 8ffc61692d03799ab3eb55798186774646fbb871 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 7 Jul 2019 09:15:14 +0200 Subject: [PATCH 066/167] [Intl] Remove --dev from intl compile autoloader --- src/Symfony/Component/Intl/Resources/bin/autoload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Resources/bin/autoload.php b/src/Symfony/Component/Intl/Resources/bin/autoload.php index 13e056478168c..14167a5f4abf5 100644 --- a/src/Symfony/Component/Intl/Resources/bin/autoload.php +++ b/src/Symfony/Component/Intl/Resources/bin/autoload.php @@ -12,7 +12,7 @@ $autoload = __DIR__.'/../../vendor/autoload.php'; if (!file_exists($autoload)) { - bailout('You should run "composer install --dev" in the component before running this script.'); + bailout('You should run "composer install" in the component before running this script.'); } require_once $autoload; From 0c326d0b5533ef871169abea57498a876daa3625 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Sun, 7 Jul 2019 18:36:17 +0200 Subject: [PATCH 067/167] Add missing test for workflow dump description --- src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php | 1 + .../Tests/fixtures/puml/square/simple-workflow-marking.puml | 3 ++- .../Tests/fixtures/puml/square/simple-workflow-nomarking.puml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php index 12c8f745e07f9..ae48d52d07ee5 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php @@ -56,6 +56,7 @@ private function createSimpleWorkflowDefinition() $placesMetadata = []; $placesMetadata['c'] = [ 'bg_color' => 'DeepSkyBlue', + 'description' => 'My custom place description', ]; $transitionsMetadata = new \SplObjectStorage(); diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml index a316b64253809..0ea138f83f725 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml @@ -17,7 +17,8 @@ skinparam agent { } state "a" <> state "b" <> -state "c" <> +state "c" <> as c +c : My custom place description agent "t1" agent "t2" "a" -[#Purple]-> "t1": "My custom transition label 2" diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml index 348ff6476b751..02e7f396eacb3 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml @@ -17,7 +17,8 @@ skinparam agent { } state "a" <> state "b" -state "c" <> +state "c" <> as c +c : My custom place description agent "t1" agent "t2" "a" -[#Purple]-> "t1": "My custom transition label 2" From ff0c14171ba08300c99220f4085d26cdbff2deb2 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Sun, 7 Jul 2019 09:09:54 +0200 Subject: [PATCH 068/167] [Console] Update to inherit and add licence --- .../CommandLoader/CommandLoaderInterface.php | 9 ++++++ .../CommandLoader/ContainerCommandLoader.php | 9 ++++++ .../Formatter/OutputFormatterStyle.php | 30 ++++--------------- .../OutputFormatterStyleInterface.php | 2 +- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php index 9462996f6d2af..ca1029cb60042 100644 --- a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php +++ b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Symfony\Component\Console\Command\Command; diff --git a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php index 753ad0fb705c2..8000c7d5eca82 100644 --- a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Psr\Container\ContainerInterface; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index b27439a761355..477bd87f0c4aa 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -75,11 +75,7 @@ public function __construct($foreground = null, $background = null, array $optio } /** - * Sets style foreground color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setForeground($color = null) { @@ -97,11 +93,7 @@ public function setForeground($color = null) } /** - * Sets style background color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setBackground($color = null) { @@ -119,11 +111,7 @@ public function setBackground($color = null) } /** - * Sets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function setOption($option) { @@ -137,11 +125,7 @@ public function setOption($option) } /** - * Unsets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function unsetOption($option) { @@ -168,11 +152,7 @@ public function setOptions(array $options) } /** - * Applies the style to a given text. - * - * @param string $text The text to style - * - * @return string + * {@inheritdoc} */ public function apply($text) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index 4c7dc4134d723..af171c27020c9 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -21,7 +21,7 @@ interface OutputFormatterStyleInterface /** * Sets style foreground color. * - * @param string $color The color name + * @param string|null $color The color name */ public function setForeground($color = null); From 5249eaf9d56e44d8343a7068731b2a12c55f4596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 8 Jul 2019 00:10:35 +0200 Subject: [PATCH 069/167] [EventDispatcher] Add tag kernel.rest on 'debug.event_dispatcher' service --- src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index 24df7d50597d7..9f1da6a83cb39 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -9,6 +9,7 @@ + From 9fc56c7e2836adc90e7739c1d46050e729912648 Mon Sep 17 00:00:00 2001 From: Sander Date: Fri, 5 Jul 2019 07:45:32 +0200 Subject: [PATCH 070/167] [Serializer]: AbstractObjectNormalizer ignores the property types of discriminated classes Add tests Remove test group Allow null Add quux null attribute Add quux value to serialize test --- .../Normalizer/AbstractObjectNormalizer.php | 7 +-- .../Fixtures/AbstractDummyFirstChild.php | 13 ++++++ .../Fixtures/AbstractDummySecondChild.php | 13 ++++++ .../Tests/Fixtures/DummyFirstChildQuux.php | 30 +++++++++++++ .../Tests/Fixtures/DummySecondChildQuux.php | 30 +++++++++++++ .../AbstractObjectNormalizerTest.php | 44 ++++++++++++++++++- .../Serializer/Tests/SerializerTest.php | 7 ++- 7 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php create mode 100644 src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 620fa8a626abf..6c1e816a9439c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -281,13 +281,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $reflectionClass = new \ReflectionClass($class); $object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format); + $resolvedClass = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object); foreach ($normalizedData as $attribute => $value) { if ($this->nameConverter) { - $attribute = $this->nameConverter->denormalize($attribute, $class, $format, $context); + $attribute = $this->nameConverter->denormalize($attribute, $resolvedClass, $format, $context); } - if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($class, $attribute, $format, $context)) { + if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($resolvedClass, $attribute, $format, $context)) { if (!($context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES])) { $extraAttributes[] = $attribute; } @@ -295,7 +296,7 @@ public function denormalize($data, $class, $format = null, array $context = []) continue; } - $value = $this->validateAndDenormalize($class, $attribute, $value, $format, $context); + $value = $this->validateAndDenormalize($resolvedClass, $attribute, $value, $format, $context); try { $this->setAttributeValue($object, $attribute, $value, $format, $context); } catch (InvalidArgumentException $e) { diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php index 645c307c35735..20672c39b5fe7 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php @@ -15,10 +15,23 @@ class AbstractDummyFirstChild extends AbstractDummy { public $bar; + /** @var DummyFirstChildQuux|null */ + public $quux; + public function __construct($foo = null, $bar = null) { parent::__construct($foo); $this->bar = $bar; } + + public function getQuux(): ?DummyFirstChildQuux + { + return $this->quux; + } + + public function setQuux(DummyFirstChildQuux $quux): void + { + $this->quux = $quux; + } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php index 5a41b9441ad8b..67a72977e2c09 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php @@ -15,10 +15,23 @@ class AbstractDummySecondChild extends AbstractDummy { public $baz; + /** @var DummySecondChildQuux|null */ + public $quux; + public function __construct($foo = null, $baz = null) { parent::__construct($foo); $this->baz = $baz; } + + public function getQuux(): ?DummySecondChildQuux + { + return $this->quux; + } + + public function setQuux(DummySecondChildQuux $quux): void + { + $this->quux = $quux; + } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php new file mode 100644 index 0000000000000..7ba39fc346b1f --- /dev/null +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests\Fixtures; + +class DummyFirstChildQuux +{ + /** + * @var string + */ + private $value; + + public function __construct(string $value) + { + $this->value = $value; + } + + public function getValue(): string + { + return $this->value; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php new file mode 100644 index 0000000000000..11c4d0eccdf77 --- /dev/null +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests\Fixtures; + +class DummySecondChildQuux +{ + /** + * @var string + */ + private $value; + + public function __construct(string $value) + { + $this->value = $value; + } + + public function getValue(): string + { + return $this->value; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index a45009d2330d5..9d6debb0e7496 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -16,13 +16,22 @@ use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Type; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; +use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; +use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; +use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; +use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerAwareInterface; use Symfony\Component\Serializer\SerializerInterface; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild; +use Symfony\Component\Serializer\Tests\Fixtures\DummySecondChildQuux; class AbstractObjectNormalizerTest extends TestCase { @@ -147,6 +156,39 @@ private function getDenormalizerForDummyCollection() return $denormalizer; } + public function testDenormalizeWithDiscriminatorMapUsesCorrectClassname() + { + $factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $loaderMock = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock(); + $loaderMock->method('hasMetadataFor')->willReturnMap([ + [ + AbstractDummy::class, + true, + ], + ]); + + $loaderMock->method('getMetadataFor')->willReturnMap([ + [ + AbstractDummy::class, + new ClassMetadata( + AbstractDummy::class, + new ClassDiscriminatorMapping('type', [ + 'first' => AbstractDummyFirstChild::class, + 'second' => AbstractDummySecondChild::class, + ]) + ), + ], + ]); + + $discriminatorResolver = new ClassDiscriminatorFromClassMetadata($loaderMock); + $normalizer = new AbstractObjectNormalizerDummy($factory, null, new PhpDocExtractor(), $discriminatorResolver); + $serializer = new Serializer([$normalizer]); + $normalizer->setSerializer($serializer); + $normalizedData = $normalizer->denormalize(['foo' => 'foo', 'baz' => 'baz', 'quux' => ['value' => 'quux'], 'type' => 'second'], AbstractDummy::class); + + $this->assertInstanceOf(DummySecondChildQuux::class, $normalizedData->quux); + } + /** * Test that additional attributes throw an exception if no metadata factory is specified. * @@ -190,7 +232,7 @@ protected function setAttributeValue($object, $attribute, $value, $format = null protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { - return \in_array($attribute, ['foo', 'baz']); + return \in_array($attribute, ['foo', 'baz', 'quux', 'value']); } public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php index a3b931b5243c5..26a94b2f6fd02 100644 --- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php +++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php @@ -13,6 +13,7 @@ use Doctrine\Common\Annotations\AnnotationReader; use PHPUnit\Framework\TestCase; +use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; @@ -34,6 +35,7 @@ use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild; +use Symfony\Component\Serializer\Tests\Fixtures\DummyFirstChildQuux; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberOne; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberTwo; @@ -382,6 +384,7 @@ public function testDeserializeObjectConstructorWithObjectTypeHint() public function testDeserializeAndSerializeAbstractObjectsWithTheClassMetadataDiscriminatorResolver() { $example = new AbstractDummyFirstChild('foo-value', 'bar-value'); + $example->setQuux(new DummyFirstChildQuux('quux')); $loaderMock = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock(); $loaderMock->method('hasMetadataFor')->willReturnMap([ @@ -405,9 +408,9 @@ public function testDeserializeAndSerializeAbstractObjectsWithTheClassMetadataDi ]); $discriminatorResolver = new ClassDiscriminatorFromClassMetadata($loaderMock); - $serializer = new Serializer([new ObjectNormalizer(null, null, null, null, $discriminatorResolver)], ['json' => new JsonEncoder()]); + $serializer = new Serializer([new ObjectNormalizer(null, null, null, new PhpDocExtractor(), $discriminatorResolver)], ['json' => new JsonEncoder()]); - $jsonData = '{"type":"first","bar":"bar-value","foo":"foo-value"}'; + $jsonData = '{"type":"first","quux":{"value":"quux"},"bar":"bar-value","foo":"foo-value"}'; $deserialized = $serializer->deserialize($jsonData, AbstractDummy::class, 'json'); $this->assertEquals($example, $deserialized); From 6b69a992304d4281420a5f60d1fd08a3f525c3e7 Mon Sep 17 00:00:00 2001 From: Stadly Date: Fri, 26 Apr 2019 11:57:49 +0200 Subject: [PATCH 071/167] [Translator] Load plurals from po files properly --- .../Translation/Loader/PoFileLoader.php | 31 ++++++++++--------- .../Tests/Loader/PoFileLoaderTest.php | 23 +++++++++++--- .../Tests/fixtures/missing-plurals.po | 4 +++ .../Translation/Tests/fixtures/plurals.po | 2 ++ 4 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 1412a786a79b7..cf8a4b8553dd4 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -126,23 +126,24 @@ protected function loadResource($resource) */ private function addMessage(array &$messages, array $item) { - if (\is_array($item['translated'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = stripcslashes($item['ids']['singular']); if (isset($item['ids']['plural'])) { - $plurals = $item['translated']; - // PO are by definition indexed so sort by index. - ksort($plurals); - // Make sure every index is filled. - end($plurals); - $count = key($plurals); - // Fill missing spots with '-'. - $empties = array_fill(0, $count + 1, '-'); - $plurals += $empties; - ksort($plurals); - $messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals)); + $id .= '|'.stripcslashes($item['ids']['plural']); } - } elseif (!empty($item['ids']['singular'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']); + + $translated = (array) $item['translated']; + // PO are by definition indexed so sort by index. + ksort($translated); + // Make sure every index is filled. + end($translated); + $count = key($translated); + // Fill missing spots with '-'. + $empties = array_fill(0, $count + 1, '-'); + $translated += $empties; + ksort($translated); + + $messages[$id] = stripcslashes(implode('|', $translated)); } } } diff --git a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php index d8e2c1993ba1c..cb94e90a9408f 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php @@ -34,7 +34,10 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => 'bar|bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } @@ -89,10 +92,8 @@ public function testEscapedIdPlurals() $catalogue = $loader->load($resource, 'en', 'domain1'); $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('escaped "foo"', $messages); - $this->assertArrayHasKey('escaped "foos"', $messages); - $this->assertEquals('escaped "bar"', $messages['escaped "foo"']); - $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']); + $this->assertArrayHasKey('escaped "foo"|escaped "foos"', $messages); + $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foo"|escaped "foos"']); } public function testSkipFuzzyTranslations() @@ -106,4 +107,16 @@ public function testSkipFuzzyTranslations() $this->assertArrayNotHasKey('foo2', $messages); $this->assertArrayHasKey('foo3', $messages); } + + public function testMissingPlurals() + { + $loader = new PoFileLoader(); + $resource = __DIR__.'/../fixtures/missing-plurals.po'; + $catalogue = $loader->load($resource, 'en', 'domain1'); + + $this->assertEquals([ + 'foo|foos' => '-|bar|-|bars', + ], $catalogue->all('domain1')); + $this->assertEquals('en', $catalogue->getLocale()); + } } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po new file mode 100644 index 0000000000000..3b47fca805b91 --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po @@ -0,0 +1,4 @@ +msgid "foo" +msgid_plural "foos" +msgstr[3] "bars" +msgstr[1] "bar" diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po index 439c41ad7fef4..61d1ba42b41a1 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po +++ b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po @@ -3,3 +3,5 @@ msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" +msgid "{0} no foos|one foo|%count% foos" +msgstr "{0} no bars|one bar|%count% bars" From 213dfd149271a426b9d5024c150767ac4d39bff9 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Fri, 5 Jul 2019 10:40:43 +0100 Subject: [PATCH 072/167] [Messenger] Doctrine Transport: Support setting auto_setup from DSN --- .../Transport/Doctrine/ConnectionTest.php | 114 +++++++++++------- .../Transport/Doctrine/Connection.php | 15 +-- 2 files changed, 76 insertions(+), 53 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php b/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php index 83708c5085a75..e50b48fcf4174 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php @@ -157,62 +157,88 @@ private function getSchemaSynchronizerMock() /** * @dataProvider buildConfigurationProvider */ - public function testBuildConfiguration($dsn, $options, $expectedManager, $expectedTableName, $expectedRedeliverTimeout, $expectedQueue) + public function testBuildConfiguration($dsn, $options, $expectedConnection, $expectedTableName, $expectedRedeliverTimeout, $expectedQueue, $expectedAutoSetup) { $config = Connection::buildConfiguration($dsn, $options); - $this->assertEquals($expectedManager, $config['connection']); + $this->assertEquals($expectedConnection, $config['connection']); $this->assertEquals($expectedTableName, $config['table_name']); $this->assertEquals($expectedRedeliverTimeout, $config['redeliver_timeout']); $this->assertEquals($expectedQueue, $config['queue_name']); + $this->assertEquals($expectedAutoSetup, $config['auto_setup']); } public function buildConfigurationProvider() { - return [ - [ - 'dsn' => 'doctrine://default', - 'options' => [], - 'expectedManager' => 'default', - 'expectedTableName' => 'messenger_messages', - 'expectedRedeliverTimeout' => 3600, - 'expectedQueue' => 'default', - ], - // test options from options array - [ - 'dsn' => 'doctrine://default', - 'options' => [ - 'table_name' => 'name_from_options', - 'redeliver_timeout' => 1800, - 'queue_name' => 'important', - ], - 'expectedManager' => 'default', - 'expectedTableName' => 'name_from_options', - 'expectedRedeliverTimeout' => 1800, - 'expectedQueue' => 'important', - ], - // tests options from dsn - [ - 'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal', - 'options' => [], - 'expectedManager' => 'default', - 'expectedTableName' => 'name_from_dsn', - 'expectedRedeliverTimeout' => 1200, - 'expectedQueue' => 'normal', + yield 'no options' => [ + 'dsn' => 'doctrine://default', + 'options' => [], + 'expectedConnection' => 'default', + 'expectedTableName' => 'messenger_messages', + 'expectedRedeliverTimeout' => 3600, + 'expectedQueue' => 'default', + 'expectedAutoSetup' => true, + ]; + + yield 'test options array' => [ + 'dsn' => 'doctrine://default', + 'options' => [ + 'table_name' => 'name_from_options', + 'redeliver_timeout' => 1800, + 'queue_name' => 'important', + 'auto_setup' => false, ], - // test options from options array wins over options from dsn - [ - 'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal', - 'options' => [ - 'table_name' => 'name_from_options', - 'redeliver_timeout' => 1800, - 'queue_name' => 'important', - ], - 'expectedManager' => 'default', - 'expectedTableName' => 'name_from_options', - 'expectedRedeliverTimeout' => 1800, - 'expectedQueue' => 'important', + 'expectedConnection' => 'default', + 'expectedTableName' => 'name_from_options', + 'expectedRedeliverTimeout' => 1800, + 'expectedQueue' => 'important', + 'expectedAutoSetup' => false, + ]; + + yield 'options from dsn' => [ + 'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal&auto_setup=false', + 'options' => [], + 'expectedConnection' => 'default', + 'expectedTableName' => 'name_from_dsn', + 'expectedRedeliverTimeout' => 1200, + 'expectedQueue' => 'normal', + 'expectedAutoSetup' => false, + ]; + + yield 'options from options array wins over options from dsn' => [ + 'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal&auto_setup=true', + 'options' => [ + 'table_name' => 'name_from_options', + 'redeliver_timeout' => 1800, + 'queue_name' => 'important', + 'auto_setup' => false, ], + 'expectedConnection' => 'default', + 'expectedTableName' => 'name_from_options', + 'expectedRedeliverTimeout' => 1800, + 'expectedQueue' => 'important', + 'expectedAutoSetup' => false, + ]; + + yield 'options from dsn with falsey boolean' => [ + 'dsn' => 'doctrine://default?auto_setup=0', + 'options' => [], + 'expectedConnection' => 'default', + 'expectedTableName' => 'messenger_messages', + 'expectedRedeliverTimeout' => 3600, + 'expectedQueue' => 'default', + 'expectedAutoSetup' => false, ]; + + yield 'options from dsn with thruthy boolean' => [ + 'dsn' => 'doctrine://default?auto_setup=1', + 'options' => [], + 'expectedConnection' => 'default', + 'expectedTableName' => 'messenger_messages', + 'expectedRedeliverTimeout' => 3600, + 'expectedQueue' => 'default', + 'expectedAutoSetup' => true, + ]; + } /** diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php index 74a85bbfbe1e9..c8692ba3486c6 100644 --- a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php @@ -76,22 +76,19 @@ public static function buildConfiguration($dsn, array $options = []) parse_str($components['query'], $query); } - $configuration = [ - 'connection' => $components['host'], - 'table_name' => $options['table_name'] ?? ($query['table_name'] ?? self::DEFAULT_OPTIONS['table_name']), - 'queue_name' => $options['queue_name'] ?? ($query['queue_name'] ?? self::DEFAULT_OPTIONS['queue_name']), - 'redeliver_timeout' => $options['redeliver_timeout'] ?? ($query['redeliver_timeout'] ?? self::DEFAULT_OPTIONS['redeliver_timeout']), - 'auto_setup' => $options['auto_setup'] ?? ($query['auto_setup'] ?? self::DEFAULT_OPTIONS['auto_setup']), - ]; + $configuration = ['connection' => $components['host']]; + $configuration += $options + $query + self::DEFAULT_OPTIONS; + + $configuration['auto_setup'] = filter_var($configuration['auto_setup'], FILTER_VALIDATE_BOOLEAN); // check for extra keys in options - $optionsExtraKeys = array_diff(array_keys($options), array_keys($configuration)); + $optionsExtraKeys = array_diff(array_keys($options), array_keys(self::DEFAULT_OPTIONS)); if (0 < \count($optionsExtraKeys)) { throw new InvalidArgumentException(sprintf('Unknown option found : [%s]. Allowed options are [%s]', implode(', ', $optionsExtraKeys), implode(', ', self::DEFAULT_OPTIONS))); } // check for extra keys in options - $queryExtraKeys = array_diff(array_keys($query), array_keys($configuration)); + $queryExtraKeys = array_diff(array_keys($query), array_keys(self::DEFAULT_OPTIONS)); if (0 < \count($queryExtraKeys)) { throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s]', implode(', ', $queryExtraKeys), implode(', ', self::DEFAULT_OPTIONS))); } From 853e032c1972d5a9447927b3da6dc332f3dbb831 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 8 Jul 2019 11:24:04 +0200 Subject: [PATCH 073/167] fixed CS --- .../Messenger/Tests/Transport/Doctrine/ConnectionTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php b/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php index e50b48fcf4174..d2caf2dfab10f 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php @@ -238,7 +238,6 @@ public function buildConfigurationProvider() 'expectedQueue' => 'default', 'expectedAutoSetup' => true, ]; - } /** From f7738d934bba4bf3d33168cae2d30aab8e30e80d Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 3 Jun 2019 16:43:29 +0200 Subject: [PATCH 074/167] [SecurityBundle] Fix profiler dump for non-invokable security listeners --- .../SecurityBundle/Debug/WrappedListener.php | 25 ++++++++++++++----- .../Debug/TraceableFirewallListenerTest.php | 6 +---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php index 2a36e10102c27..42735a1025e1c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php +++ b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php @@ -39,10 +39,6 @@ final class WrappedListener implements ListenerInterface public function __construct($listener) { $this->listener = $listener; - - if (null === self::$hasVarDumper) { - self::$hasVarDumper = class_exists(ClassStub::class); - } } /** @@ -76,8 +72,25 @@ public function getWrappedListener() public function getInfo(): array { - if (null === $this->stub) { - $this->stub = self::$hasVarDumper ? new ClassStub(\get_class($this->listener)) : \get_class($this->listener); + if (null !== $this->stub) { + // no-op + } elseif (self::$hasVarDumper ?? self::$hasVarDumper = class_exists(ClassStub::class)) { + $this->stub = ClassStub::wrapCallable($this->listener); + } elseif (\is_array($this->listener)) { + $this->stub = (\is_object($this->listener[0]) ? \get_class($this->listener[0]) : $this->listener[0]).'::'.$this->listener[1]; + } elseif ($this->listener instanceof \Closure) { + $r = new \ReflectionFunction($this->listener); + if (false !== strpos($r->name, '{closure}')) { + $this->stub = 'closure'; + } elseif ($class = $r->getClosureScopeClass()) { + $this->stub = $class->name.'::'.$r->name; + } else { + $this->stub = $r->name; + } + } elseif (\is_string($this->listener)) { + $this->stub = $this->listener; + } else { + $this->stub = \get_class($this->listener).'::__invoke'; } return [ diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php index c301ead2fae1b..b7c6bcc076631 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php @@ -20,7 +20,6 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; -use Symfony\Component\VarDumper\Caster\ClassStub; /** * @group time-sensitive @@ -56,9 +55,6 @@ public function testOnKernelRequestRecordsListeners() $listeners = $firewall->getWrappedListeners(); $this->assertCount(1, $listeners); - $this->assertSame($response, $listeners[0]['response']); - $this->assertInstanceOf(ClassStub::class, $listeners[0]['stub']); - $this->assertSame(\get_class($listener), (string) $listeners[0]['stub']); - $this->assertSame(1, $listenerCalled); + $this->assertSame($listener, $listeners[0]['stub']); } } From bd498f2503fb725a0ee509b0de7e70b4f71291d2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 8 Jul 2019 13:57:06 +0200 Subject: [PATCH 075/167] fixed CS --- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 650d8fca7dba9..73d12cb3f74f4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -2435,7 +2435,7 @@ public function testTrustedPortDoesNotDefaultToZero() $request = Request::create('/'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $request->headers->set('X-Forwarded-Host', 'test.example.com'); - $request->headers->set('X-Forwarded-Port', null); + $request->headers->set('X-Forwarded-Port', ''); $this->assertSame(80, $request->getPort()); } From a0901294d4376a940b1b9b8cae441c10a5624513 Mon Sep 17 00:00:00 2001 From: "Nathanael d. Noblet" Date: Sat, 25 May 2019 08:21:47 -0600 Subject: [PATCH 076/167] [FrameworkBundle] Inform the user when save_path will be ignored --- .../DependencyInjection/Configuration.php | 8 +++++++- .../DependencyInjection/FrameworkExtension.php | 9 +++++++++ .../Tests/DependencyInjection/ConfigurationTest.php | 1 - .../Fixtures/php/session_savepath.php | 8 ++++++++ .../Fixtures/xml/session_savepath.xml | 12 ++++++++++++ .../Fixtures/yml/session_savepath.yml | 4 ++++ .../DependencyInjection/FrameworkExtensionTest.php | 7 +++++++ 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 52c7706456c9f..52369bbffaa99 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -470,6 +470,12 @@ private function addSessionSection(ArrayNodeDefinition $rootNode) $rootNode ->children() ->arrayNode('session') + ->validate() + ->ifTrue(function ($v) { + return empty($v['handler_id']) && !empty($v['save_path']); + }) + ->thenInvalid('Session save path is ignored without a handler service') + ->end() ->info('session configuration') ->canBeEnabled() ->children() @@ -498,7 +504,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode) ->defaultTrue() ->setDeprecated('The "%path%.%node%" option is enabled by default and deprecated since Symfony 3.4. It will be always enabled in 4.0.') ->end() - ->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end() + ->scalarNode('save_path')->end() ->integerNode('metadata_update_threshold') ->defaultValue('0') ->info('seconds to wait between 2 session metadata updates') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4e792ded2e08d..650e1f2f50f1b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -873,6 +873,11 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c // session handler (the internal callback registered with PHP session management) if (null === $config['handler_id']) { + // If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored + if (isset($config['save_path'])) { + throw new LogicException('Session save path is ignored without a handler service'); + } + // Set the handler class to be null $container->getDefinition('session.storage.native')->replaceArgument(1, null); $container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null); @@ -880,6 +885,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c $container->setAlias('session.handler', $config['handler_id'])->setPrivate(true); } + if (!isset($config['save_path'])) { + $config['save_path'] = ini_get('session.save_path'); + } + $container->setParameter('session.save_path', $config['save_path']); if (\PHP_VERSION_ID < 70000) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 91764a642e8de..b1dea4cba4b01 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -378,7 +378,6 @@ protected static function getBundleDefaultConfig() 'handler_id' => 'session.handler.native_file', 'cookie_httponly' => true, 'gc_probability' => 1, - 'save_path' => '%kernel.cache_dir%/sessions', 'metadata_update_threshold' => '0', 'use_strict_mode' => true, ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php new file mode 100644 index 0000000000000..89841bca43d51 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php @@ -0,0 +1,8 @@ +loadFromExtension('framework', [ + 'session' => [ + 'handler_id' => null, + 'save_path' => '/some/path', + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml new file mode 100644 index 0000000000000..a9ddd8016b879 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml new file mode 100644 index 0000000000000..174ebe586947e --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml @@ -0,0 +1,4 @@ +framework: + session: + handler_id: null + save_path: /some/path diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 51b4ff1524267..2572c3aadf17f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -24,6 +24,7 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -474,6 +475,12 @@ public function testNullSessionHandler() $this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0)); } + public function testNullSessionHandlerWithSavePath() + { + $this->expectException(InvalidConfigurationException::class); + $this->createContainerFromFile('session_savepath'); + } + public function testRequest() { $container = $this->createContainerFromFile('full'); From 5328c4b55293149802bb38ed904f86a1d7f681b6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 8 Jul 2019 14:55:32 +0200 Subject: [PATCH 077/167] fixed tests on old PHP versions --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index ce305d16cc35d..b0356b3c140d2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -474,9 +474,11 @@ public function testNullSessionHandler() $this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0)); } + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ public function testNullSessionHandlerWithSavePath() { - $this->expectException(InvalidConfigurationException::class); $this->createContainerFromFile('session_savepath'); } From 60939d988dff2a0a4fa14cd3c1126c04759d8bb6 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 8 Jul 2019 15:34:24 +0200 Subject: [PATCH 078/167] Added tests to cover the possibility of having scalars as services. --- .../Tests/ContainerBuilderTest.php | 15 ++++++++++++++ .../Tests/ContainerTest.php | 10 ++++++++++ .../Tests/Dumper/PhpDumperTest.php | 20 +++++++++++++++++++ .../Tests/Fixtures/ScalarFactory.php | 14 +++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index b3bea30b749b9..46074a67a5937 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -38,6 +38,7 @@ use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\ExpressionLanguage\Expression; @@ -1532,6 +1533,20 @@ public function testDecoratedSelfReferenceInvolvingPrivateServices() $this->assertSame(['service_container'], array_keys($container->getDefinitions())); } + + public function testScalarService() + { + $c = new ContainerBuilder(); + $c->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $c->compile(); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } } class FooClass diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index d2616a34ba6b4..5dbec886e6fb3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -386,6 +386,16 @@ public function testLegacyHas() $this->assertTrue($sc->has('foo\\baz'), '->has() returns true if a get*Method() is defined'); } + public function testScalarService() + { + $c = new Container(); + + $c->set('foo', 'some value'); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } + public function testInitialized() { $sc = new ProjectServiceContainer(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index a1ccb52b60329..926933bb0e410 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -30,6 +30,7 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; use Symfony\Component\DependencyInjection\TypedReference; @@ -1115,6 +1116,25 @@ public function testReferenceWithLowerCaseId() $this->assertEquals((object) ['foo' => (object) []], $container->get('Bar')); } + + public function testScalarService() + { + $container = new ContainerBuilder(); + $container->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Scalar_Service'])); + + $container = new \Symfony_DI_PhpDumper_Test_Scalar_Service(); + + $this->assertTrue($container->has('foo')); + $this->assertSame('some value', $container->get('foo')); + } } class Rot13EnvVarProcessor implements EnvVarProcessorInterface diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php new file mode 100644 index 0000000000000..15646a8d0c5d7 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php @@ -0,0 +1,14 @@ + Date: Mon, 8 Jul 2019 16:06:09 +0200 Subject: [PATCH 079/167] [Serializer] XmlEncoder: don't cast padded strings --- .../Component/Serializer/Encoder/XmlEncoder.php | 2 +- .../Serializer/Tests/Encoder/XmlEncoderTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index f0a4afb191b3a..afbd63e4962af 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -303,7 +303,7 @@ private function parseXmlAttributes(\DOMNode $node, array $context = []) $typeCastAttributes = $this->resolveXmlTypeCastAttributes($context); foreach ($node->attributes as $attr) { - if (!is_numeric($attr->nodeValue) || !$typeCastAttributes) { + if (!is_numeric($attr->nodeValue) || !$typeCastAttributes || (isset($attr->nodeValue[1]) && '0' === $attr->nodeValue[0])) { $data['@'.$attr->nodeName] = $attr->nodeValue; continue; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 7a6a7d3fbca19..573605c1ab092 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -306,6 +306,17 @@ public function testNoTypeCastAttribute() $this->assertSame($expected, $data); } + public function testDoesNotTypeCastStringsStartingWith0() + { + $source = << + +XML; + + $data = $this->encoder->decode($source, 'xml'); + $this->assertSame('018', $data['@a']); + } + public function testEncode() { $source = $this->getXmlSource(); From cad5f9a106e786fda1cdeb092f2bf3e8582af241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 8 Jul 2019 19:17:40 +0200 Subject: [PATCH 080/167] Spell "triggering" properly As a side effect, the property name matches the one in the declaration, which was correct. --- .../PhpUnit/DeprecationErrorHandler/Deprecation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index 6d5b39fd54212..ea84256663528 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -76,7 +76,7 @@ public function __construct($message, array $trace, $file) // No-op } $line = $trace[$i]; - $this->trigerringFilePathType = $this->getPathType($file); + $this->triggeringFilePathType = $this->getPathType($file); if (isset($line['object']) || isset($line['class'])) { if (isset($line['class']) && 0 === strpos($line['class'], SymfonyTestsListenerFor::class)) { $parsedMsg = unserialize($this->message); @@ -88,7 +88,7 @@ public function __construct($message, array $trace, $file) // then we need to use the serialized information to determine // if the error has been triggered from vendor code. if (isset($parsedMsg['triggering_file'])) { - $this->trigerringFilePathType = $this->getPathType($parsedMsg['triggering_file']); + $this->triggeringFilePathType = $this->getPathType($parsedMsg['triggering_file']); } return; @@ -177,10 +177,10 @@ public function isLegacy($utilPrefix) */ public function getType() { - if (self::PATH_TYPE_SELF === $this->trigerringFilePathType) { + if (self::PATH_TYPE_SELF === $this->triggeringFilePathType) { return self::TYPE_SELF; } - if (self::PATH_TYPE_UNDETERMINED === $this->trigerringFilePathType) { + if (self::PATH_TYPE_UNDETERMINED === $this->triggeringFilePathType) { return self::TYPE_UNDETERMINED; } $erroringFile = $erroringPackage = null; From 90d1b059fddfbe4e12e63c297194ce1b5871c8ad Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 8 Jul 2019 13:53:30 -0400 Subject: [PATCH 081/167] Adding missing event_dispatcher wiring for messenger.middleware.send_message --- .../Bundle/FrameworkBundle/Resources/config/messenger.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml index a060b723b87d1..5ef47e751efd0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml @@ -15,6 +15,7 @@ + From e9abc7d654fa519ce647025a85621626d62d9d53 Mon Sep 17 00:00:00 2001 From: Arman <44655055+Arman-Hosseini@users.noreply.github.com> Date: Tue, 9 Jul 2019 10:43:23 +0430 Subject: [PATCH 082/167] Improve fa translations --- .../Resources/translations/validators.fa.xlf | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf index ff1aa7c0b1ec0..2cfcbea4b086c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf @@ -16,19 +16,19 @@ This value should be blank. - این فیلد باید خالی باشد. + این مقدار باید خالی باشد. The value you selected is not a valid choice. - گزینه انتخابی معتبر نیست. + مقدار انتخاب شده شامل گزینه های معتبر نمی باشد. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - باید حداقل {{ limit }} گزینه انتخاب کنید.|باید حداقل {{ limit }} گزینه انتخاب کنید. + باید حداقل {{ limit }} گزینه انتخاب نمایید.|باید حداقل {{ limit }} گزینه انتخاب نمایید. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - حداکثر {{ limit }} گزینه می توانید انتخاب کنید.|حداکثر {{ limit }} گزینه می توانید انتخاب کنید. + حداکثر {{ limit }} گزینه می توانید انتخاب نمایید.|حداکثر {{ limit }} گزینه می توانید انتخاب نمایید. One or more of the given values is invalid. @@ -44,87 +44,87 @@ This value is not a valid date. - این مقدار یک تاریخ معتبر نیست. + این مقدار یک تاریخ معتبر نمی باشد. This value is not a valid datetime. - این مقدار یک تاریخ و زمان معتبر نیست. + این مقدار یک تاریخ و زمان معتبر نمی باشد. This value is not a valid email address. - این یک رایانامه معتبر نیست. + این یک رایانامه معتبر نمی باشد. The file could not be found. - فایل پیدا نشد. + فایل یافت نشد. The file is not readable. - فایل قابلیت خواندن ندارد. + فایل قابلیت خوانده شدن ندارد. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - این نوع فایل مجاز نیست({{ type }}). نوع های مجاز {{ types }} هستند. + این نوع فایل مجاز نمی باشد({{ type }}). نوع های مجاز شامل {{ types }} می باشند. This value should be {{ limit }} or less. - این مقدار باید کوچکتر یا مساوی {{ limit }} باشد. + این مقدار باید کوچکتر و یا مساوی {{ limit }} باشد. This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است. + بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد. This value should be {{ limit }} or more. - این مقدار باید برابر و یا بیشتر از {{ limit }} باشد. + این مقدار باید بزرگتر و یا مساوی {{ limit }} باشد. This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد.|بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد. + مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد.|مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد. This value should not be blank. - این مقدار نباید تهی باشد. + این مقدار نباید خالی باشد. This value should not be null. - باید مقداری داشته باشد.. + این مقدار باید شامل چیزی باشد. This value should be null. - نباید مقداری داشته باشد. + این مقدار باید شامل چیزی نباشد. This value is not valid. - این مقدار معتبر نیست. + این مقدار معتبر نمی باشد. This value is not a valid time. - این مقدار یک زمان صحیح نیست. + این مقدار یک زمان صحیح نمی باشد. This value is not a valid URL. - این یک URL معتبر نیست. + این مقدار شامل یک URL معتبر نمی باشد. The two values should be equal. - دو مقدار باید برابر باشند. + دو مقدار باید با یکدیگر برابر باشند. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The file is too large. - فایل بیش از اندازه بزرگ است. + فایل بیش از اندازه بزرگ می باشد. The file could not be uploaded. - بارگذاری فایل با شکست مواجه شد. + بارگذاری فایل با شکست مواجه گردید. This value should be a valid number. @@ -132,23 +132,23 @@ This file is not a valid image. - این فایل یک تصویر نیست. + این فایل یک تصویر نمی باشد. This is not a valid IP address. - این مقدار یک IP معتبر نیست. + این مقدار یک IP معتبر نمی باشد. This value is not a valid language. - این مقدار یک زبان صحیح نیست. + این مقدار یک زبان صحیح نمی باشد. This value is not a valid locale. - این مقدار یک محل صحیح نیست. + این مقدار یک محل صحیح نمی باشد. This value is not a valid country. - این مقدار یک کشور صحیح نیست. + این مقدار یک کشور صحیح نمی باشد. This value is already used. @@ -156,23 +156,23 @@ The size of the image could not be detected. - اندازه تصویر قابل شناسایی نیست. + اندازه تصویر قابل شناسایی نمی باشد. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px است. + طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px می باشد. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px است. + طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px می باشد. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px است. + ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px می باشد. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px است. + ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px می باشد. This value should be the user's current password. @@ -184,67 +184,67 @@ The file was only partially uploaded. - فایل به صورت جزیی بارگذاری شده است. + پرونده به صورت جزیی بارگذاری گردیده است. No file was uploaded. - هیچ فایلی بارگذاری نشد. + هیچ پرونده ای بارگذاری نگردیده است. No temporary folder was configured in php.ini. - فولدر موقت در php.ini پیکربندی نشده است. + فولدر موقت در php.ini پیکربندی نگردیده است. Cannot write temporary file to disk. - فایل موقت را نمی توان در دیسک نوشت. + فایل موقتی را نمی توان در دیسک نوشت. A PHP extension caused the upload to fail. - اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه شود. + یک اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه گردد. This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد. + این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا کمتر باشد. + این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - این مجموعه می بایست به طور دقیق دارا {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} قلم باشد. + این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد. Invalid card number. - شماره کارت نامعتبر است. + شماره کارت نامعتبر می باشد. Unsupported card type or invalid card number. - نوع کارت پشتیبانی نمی شود یا شماره کارت نامعتبر است. + نوع کارت پشتیبانی نمی شود و یا شماره کارت نامعتبر می باشد. This is not a valid International Bank Account Number (IBAN). - این یک شماره حساب بین المللی بانک (IBAN) درست نیست. + این یک شماره حساب بانک بین المللی معتبر نمی باشد (IBAN). This value is not a valid ISBN-10. - این مقدار یک ISBN-10 درست نیست. + این مقدار یک ISBN-10 معتبر نمی باشد. This value is not a valid ISBN-13. - این مقدار یک ISBN-13 درست نیست. + این مقدار یک ISBN-13 معتبر نمی باشد. This value is neither a valid ISBN-10 nor a valid ISBN-13. - این مقدار یک ISBN-10 درست یا ISBN-13 درست نیست. + این مقدار یک ISBN-10 صحیح و یا ISBN-13 معتبر نمی باشد. This value is not a valid ISSN. - این مقدار یک ISSN درست نیست. + این مقدار یک ISSN معتبر نمی باشد. This value is not a valid currency. - این مقدار یک یکای پول درست نیست. + این مقدار یک واحد پول معتبر نمی باشد. This value should be equal to {{ compared_value }}. @@ -256,11 +256,11 @@ This value should be greater than or equal to {{ compared_value }}. - این مقدار باید بزرگتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید بزرگتر و یا مساوی با {{ compared_value }} باشد. This value should be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. This value should be less than {{ compared_value }}. @@ -268,7 +268,7 @@ This value should be less than or equal to {{ compared_value }}. - این مقدار باید کمتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید کمتر و یا مساوی با {{ compared_value }} باشد. This value should not be equal to {{ compared_value }}. @@ -276,43 +276,43 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار نباید {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار نباید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} می باشد. The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} می باشد. The image is square ({{ width }}x{{ height }}px). Square images are not allowed. - این عکس مربع width }}x{{ height }}px}} می باشد.عکس مربع مجاز نمی باشد. + این تصویر یک مربع width }}x{{ height }}px}} می باشد.تصویر مربع مجاز نمی باشد. The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. - این عکس افقی width }}x{{ height }}px}} می باشد.عکس افقی مجاز نمی باشد. + این تصویر افقی width }}x{{ height }}px}} می باشد.تصویر افقی مجاز نمی باشد. The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. - این عکس عمودی width }}x{{ height }}px}} می باشد.عکس عمودی مجاز نمی باشد. + این تصویر عمودی width }}x{{ height }}px}} می باشد.تصویر عمودی مجاز نمی باشد. An empty file is not allowed. - فایل خالی مجاز نمی باشد. + پرونده خالی مجاز نمی باشد. The host could not be resolved. - هاست قابل حل نیست. + میزبان قابل حل نمی باشد. This value does not match the expected {{ charset }} charset. - این مقدار مورد نظر نمی باشد. مقدار مورد نظر {{ charset }} می باشد. + این مقدار مطابق با مقدار مورد انتظار {{ charset }} نمی باشد. This is not a valid Business Identifier Code (BIC). - این مقدار یک BIC درست نیست. + این مقدار یک BIC معتبر نمی باشد. Error @@ -320,7 +320,7 @@ This is not a valid UUID. - این مقدار یک UUID درست نیست. + این مقدار یک UUID معتبر نمی باشد. This value should be a multiple of {{ compared_value }}. @@ -328,7 +328,7 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. - این BIC با IBAN ارتباط ندارد. + این BIC با IBAN ارتباطی ندارد. From 346ce8811ed0f2e51177e2ee6ada24778445b933 Mon Sep 17 00:00:00 2001 From: Amin-Hosseini Date: Tue, 9 Jul 2019 14:02:42 +0430 Subject: [PATCH 083/167] [Translator] Improve farsi(persian) translations for Form --- .../Component/Form/Resources/translations/validators.fa.xlf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf index 468d2f6fdd8dd..1c784c24a0e2d 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf @@ -4,15 +4,15 @@ This form should not contain extra fields. - این فرم نباید فیلد اضافی داشته باشد. + این فرم نباید شامل فیلد اضافه ای باشد. The uploaded file was too large. Please try to upload a smaller file. - فایل بارگذاری شده بسیار بزرگ است. لطفا فایل کوچکتری را بارگزاری کنید. + فایل بارگذاری شده بسیار بزرگ می باشد. لطفا فایل کوچکتری را بارگذاری نمایید. The CSRF token is invalid. Please try to resubmit the form. - مقدار CSRF نامعتبر است. لطفا فرم را مجددا ارسال فرمایید.. + توکن CSRF نامعتبر می باشد. لطفا فرم را مجددا ارسال نمایید. From a9a6eb5c5802d76656f1f38f18c733eb7e69b803 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Tue, 9 Jul 2019 11:57:56 -0400 Subject: [PATCH 084/167] Fix Twig 1.x compatibility --- .../Bundle/WebProfilerBundle/Controller/ExceptionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index 4ae1afcf8324f..d5b0f5e66b6c8 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -60,7 +60,7 @@ public function showAction($token) $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException(); $template = $this->getTemplate(); - if (!$this->twig->getLoader()->exists($template)) { + if (!$this->templateExists($template)) { $handler = new ExceptionHandler($this->debug, $this->twig->getCharset(), $this->fileLinkFormat); return new Response($handler->getContent($exception), 200, ['Content-Type' => 'text/html']); From 6eee2a814484b5aa0668a60fe54e916004fc6a1f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 11 Jul 2019 12:21:37 +0200 Subject: [PATCH 085/167] [HttpKernel] fix tests --- .../HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php index 60ad1b89c4dfb..c66732a37ccd3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -25,7 +25,7 @@ class TraceableEventDispatcherTest extends TestCase public function testStopwatchSections() { $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch = new Stopwatch()); - $kernel = $this->getHttpKernel($dispatcher, function () { return new Response(); }); + $kernel = $this->getHttpKernel($dispatcher, function () { return new Response('', 200, ['X-Debug-Token' => '292e1e']); }); $request = Request::create('/'); $response = $kernel->handle($request); $kernel->terminate($request, $response); From c7141c82d1e62ef1320a4652283ddff4fdd5bd83 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Thu, 11 Jul 2019 20:09:53 +0200 Subject: [PATCH 086/167] [Debug][DebugClassLoader] Include found files instead of requiring them --- src/Symfony/Component/Debug/DebugClassLoader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 9ceac9af162b0..b63c6adee954c 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -149,11 +149,11 @@ public function loadClass($class) if (!$file = $this->classLoader[0]->findFile($class) ?: false) { // no-op } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) { - require $file; + include $file; return; } else { - require $file; + include $file; } } else { \call_user_func($this->classLoader, $class); From c5ee4bedc2bd4208b6677078029c40332ef73ee5 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Thu, 11 Jul 2019 16:09:41 -0300 Subject: [PATCH 087/167] [FrameworkBundle] Fix descriptor of routes described as callable array --- .../FrameworkBundle/Console/Descriptor/TextDescriptor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 796beaee01441..18b13a215c1e1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -540,7 +540,7 @@ private function formatControllerLink($controller, string $anchorText): string try { if (\is_array($controller)) { - $r = new \ReflectionMethod($controller); + $r = new \ReflectionMethod($controller[0], $controller[1]); } elseif ($controller instanceof \Closure) { $r = new \ReflectionFunction($controller); } elseif (method_exists($controller, '__invoke')) { From ee5e5de9e031fa037bf099ef12e485d583e36fcd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 12 Jul 2019 08:50:39 +0300 Subject: [PATCH 088/167] fixed CS --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b0356b3c140d2..c114f38177bec 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -23,7 +23,6 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; From 29ecf224a5757731eb6a2be29860e0892bfd488e Mon Sep 17 00:00:00 2001 From: JoppeDC Date: Fri, 12 Jul 2019 10:08:35 +0200 Subject: [PATCH 089/167] Added Nl translations Added NL translations for the validator when both `min` and `max` are set. --- .../Validator/Resources/translations/validators.nl.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index 478ca19753a64..3b2eb4131bd3a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Dit wachtwoord is gelekt vanwege een data-inbreuk, het moet niet worden gebruikt. Kies een ander wachtwoord. + + This value should be between {{ min }} and {{ max }}. + Deze waarde moet zich tussen {{ min }} en {{ max }} bevinden. + From 41f51fd7c126b48d7cf8c3ae1b8928e707ed15c4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Jul 2019 10:19:17 +0200 Subject: [PATCH 090/167] [Validator] Added the Spanish translation for the new Range validator --- .../Validator/Resources/translations/validators.es.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index f248f1cf3f20b..eb46a2bfca87f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña. + + This value should be between {{ min }} and {{ max }}. + Este valor debe ser entre {{ min }} y {{ max }}. + From 0185527297df920c719a1475d1ba475853737a36 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 12 Jul 2019 10:24:01 +0200 Subject: [PATCH 091/167] [Debug][DebugClassLoader] Don't check class if the included file don't exist --- src/Symfony/Component/Debug/DebugClassLoader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index b63c6adee954c..13ab9e700c743 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -152,8 +152,8 @@ public function loadClass($class) include $file; return; - } else { - include $file; + } elseif (false === include $file) { + return; } } else { \call_user_func($this->classLoader, $class); From 5ba6cc9b7c5d0859f8b269ead7ee4b06fdbe6674 Mon Sep 17 00:00:00 2001 From: Lctrs Date: Fri, 12 Jul 2019 10:45:11 +0200 Subject: [PATCH 092/167] [Validator] Add missing en and fr translation ids from 4.4 --- .../Validator/Resources/translations/validators.en.xlf | 4 ++++ .../Validator/Resources/translations/validators.fr.xlf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index d5d9d20997fc0..100d552076f2c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. This password has been leaked in a data breach, it must not be used. Please use another password. + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index 9b021cd68214f..dc7e73e3c7581 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Ce mot de passe a été divulgué lors d'une fuite de données, il ne doit plus être utilisé. Veuillez utiliser un autre mot de passe. + + This value should be between {{ min }} and {{ max }}. + Cette valeur doit être comprise entre {{ min }} et {{ max }}. + From b5a96409b707d9b5e23d35eea3b57fa6526a74fa Mon Sep 17 00:00:00 2001 From: Pablo Lozano Date: Fri, 12 Jul 2019 13:06:55 +0200 Subject: [PATCH 093/167] Update validators.es.xlf --- .../Validator/Resources/translations/validators.es.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index eb46a2bfca87f..75cb60605a6b3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -364,7 +364,7 @@ This value should be between {{ min }} and {{ max }}. - Este valor debe ser entre {{ min }} y {{ max }}. + Este valor debe estar entre {{ min }} y {{ max }}. From d392e49993afc9d8b3bf5c6baf06521958f62efd Mon Sep 17 00:00:00 2001 From: Patrick Reimers Date: Fri, 12 Jul 2019 11:52:34 +0200 Subject: [PATCH 094/167] Add german translation for Range validator --- .../Validator/Resources/translations/validators.de.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index f33e4d602ca15..8ee3120482267 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Dieses Passwort ist Teil eines Datenlecks, es darf nicht verwendet werden. + + This value should be between {{ min }} and {{ max }}. + Dieser Wert sollte zwischen {{ min }} und {{ max }} sein. + From dc2e36d7c72d646d20c607a28cf66b018081dadc Mon Sep 17 00:00:00 2001 From: Patrick Reimers Date: Fri, 12 Jul 2019 11:56:26 +0200 Subject: [PATCH 095/167] Add danish translation for Range validator --- .../Validator/Resources/translations/validators.da.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf index 3a545c80b6409..e27bb2930f676 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf @@ -246,6 +246,10 @@ Error Fejl + + This value should be between {{ min }} and {{ max }}. + Værdien skal være mellem {{ min }} og {{ max }}. + From b35131a9bfde2c8bd4608effb8f0f1cf1d071531 Mon Sep 17 00:00:00 2001 From: Ion Bazan Date: Fri, 12 Jul 2019 17:23:05 +0800 Subject: [PATCH 096/167] Add notInRange translation --- .../Validator/Resources/translations/validators.pl.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 888e73b157007..f1910c99d5751 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -330,6 +330,10 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}. + + This value should be between {{ min }} and {{ max }}. + Ta wartość powinna być pomiędzy {{ min }} a {{ max }}. + From eae95c4e494558a9985b800c83b7bc1350021b4c Mon Sep 17 00:00:00 2001 From: Valentin Date: Sat, 13 Jul 2019 00:04:51 +0300 Subject: [PATCH 097/167] PHPDoc fixes --- src/Symfony/Component/Form/Form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 3e8d632d939a0..63ef109e67624 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -140,9 +140,9 @@ class Form implements \IteratorAggregate, FormInterface private $lockSetData = false; /** - * @var string|int|null + * @var string */ - private $name; + private $name = ''; /** * @var bool Whether the form inherits its underlying data from its parent @@ -211,7 +211,7 @@ public function getPropertyPath() return $this->propertyPath; } - if (null === $this->name || '' === $this->name) { + if ('' === $this->name) { return null; } From 209226a3f60ab156f295424ffa3d8b15e32f9446 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 13 Jul 2019 12:18:45 +0200 Subject: [PATCH 098/167] sync translation files --- .../Resources/translations/validators.ro.xlf | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf index 63af47042b199..26b069ab02774 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf @@ -278,10 +278,62 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Această valoare nu trebuie să fie identică cu {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Raportul imaginii este prea mare ({{ ratio }}). Raportul maxim permis este {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Raportul imaginii este prea mic ({{ ratio }}). Raportul minim permis este {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Imaginea este un pătrat ({{ width }}x{{ height }}px). Imaginile pătrat nu sunt permise. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Imaginea are orientarea peisaj ({{ width }}x{{ height }}px). Imaginile cu orientare peisaj nu sunt permise. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Imaginea are orientarea portret ({{ width }}x{{ height }}px). Imaginile cu orientare portret nu sunt permise. + + + An empty file is not allowed. + Nu se permite un fișier gol. + + + The host could not be resolved. + Numele host nu a putut fi rezolvat către o adresă IP. + + + This value does not match the expected {{ charset }} charset. + Această valoare nu corespunde setului de caractere {{ charset }} așteptat. + + + This is not a valid Business Identifier Code (BIC). + Codul BIC (Business Identifier Code) nu este valid. + Error Eroare + + This is not a valid UUID. + Identificatorul universal unic (UUID) nu este valid. + + + This value should be a multiple of {{ compared_value }}. + Această valoare trebuie să fie un multiplu de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Codul BIC (Business Identifier Code) nu este asociat cu codul IBAN {{ iban }}. + + + This value should be valid JSON. + Această valoare trebuie să fie un JSON valid. + From 8a5a8fa835c8c293bd82612835032a910714680f Mon Sep 17 00:00:00 2001 From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com> Date: Sun, 14 Jul 2019 15:17:28 +0430 Subject: [PATCH 099/167] Add HTTPS to a URL --- src/Symfony/Component/Validator/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/README.md b/src/Symfony/Component/Validator/README.md index 3ccb2901adeac..410a4213eef07 100644 --- a/src/Symfony/Component/Validator/README.md +++ b/src/Symfony/Component/Validator/README.md @@ -13,4 +13,4 @@ Resources [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) -[1]: http://jcp.org/en/jsr/detail?id=303 +[1]: https://jcp.org/en/jsr/detail?id=303 From 20ef151eb3f9ff389be8ba15ed73a79ca682384d Mon Sep 17 00:00:00 2001 From: Tomas Date: Mon, 15 Jul 2019 08:12:34 +0300 Subject: [PATCH 100/167] [Validator] Add Lithuanian translation for Range validator --- .../Validator/Resources/translations/validators.lt.xlf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index 79171bc0dfa6e..2a079aacbf9b1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -362,6 +362,10 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Slaptažodis yra nutekėjęs duomenų saugumo pažeidime, jo naudoti negalima. Prašome naudoti kitą slaptažodį. + + This value should be between {{ min }} and {{ max }}. + Ši reikšmė turi būti tarp {{ min }} ir {{ max }}. + From 2fee9124ba79a073ac1488d4c4ba63130530c461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= Date: Sun, 14 Jul 2019 11:25:23 +0200 Subject: [PATCH 101/167] [Validator] Add missing Hungarian translations --- .../Validator/Resources/translations/validators.hu.xlf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf index 300eb5f68fb97..18a50e86f8756 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf @@ -358,6 +358,14 @@ This value is not a valid timezone. Ez az érték nem egy érvényes időzóna. + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ez a jelszó korábban egy adatvédelmi incidens során illetéktelenek kezébe került, így nem használható. Kérjük, használjon másik jelszót. + + + This value should be between {{ min }} and {{ max }}. + Ennek az értéknek {{ min }} és {{ max }} között kell lennie. + From bad2a2c87ac57fd0c6d91b47c1efd0644255f997 Mon Sep 17 00:00:00 2001 From: Timon van der Vorm Date: Tue, 9 Jul 2019 22:40:35 +0200 Subject: [PATCH 102/167] [Config] Fix for signatures of typed properties --- .../Component/Config/Resource/ReflectionClassResource.php | 2 +- .../Config/Tests/Resource/ReflectionClassResourceTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index a86a37ed8dcbd..0ece672216390 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -140,7 +140,7 @@ private function generateSignature(\ReflectionClass $class) foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { yield $p->getDocComment().$p; - yield print_r($defaults[$p->name], true); + yield print_r($defaults[$p->name] ?? null, true); } } diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index 23f2cc567c4cd..1f0bcb17b4f5e 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -137,6 +137,14 @@ public function provideHashedSignature() yield [1, 13, 'protected function prot($a = [123]) {}']; yield [0, 14, '/** priv docblock */']; yield [0, 15, '']; + + if (\PHP_VERSION_ID >= 70400) { + // PHP7.4 typed properties without default value are + // undefined, make sure this doesn't throw an error + yield [1, 5, 'public array $pub;']; + yield [0, 7, 'protected int $prot;']; + yield [0, 9, 'private string $priv;']; + } } public function testEventSubscriber() From e346ee68880b684df6ac757a4c8d4d05e71338d6 Mon Sep 17 00:00:00 2001 From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com> Date: Sun, 14 Jul 2019 00:08:42 +0430 Subject: [PATCH 103/167] [Translation] Use HTTPS and fix a url --- src/Symfony/Component/Translation/Loader/PoFileLoader.php | 4 ++-- .../Component/Validator/Constraints/CardSchemeValidator.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index cf8a4b8553dd4..5e460fbfb84ff 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Translation\Loader; /** - * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) + * @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium * @copyright Copyright (c) 2012, Clemens Tolboom */ class PoFileLoader extends FileLoader @@ -20,7 +20,7 @@ class PoFileLoader extends FileLoader /** * Parses portable object (PO) format. * - * From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files + * From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files * we should be able to parse files having: * * white-space diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index 04abe81af3647..f7bfd2902e5c6 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -21,9 +21,8 @@ * @author Tim Nagel * @author Bernhard Schussek * - * @see http://en.wikipedia.org/wiki/Bank_card_number - * @see http://www.regular-expressions.info/creditcard.html - * @see http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf + * @see https://en.wikipedia.org/wiki/Payment_card_number + * @see https://www.regular-expressions.info/creditcard.html */ class CardSchemeValidator extends ConstraintValidator { From fae418f7cb8ad9528544a5c78e73616adc720274 Mon Sep 17 00:00:00 2001 From: Konstantin Myakshin Date: Mon, 15 Jul 2019 23:29:33 +0300 Subject: [PATCH 104/167] [Validator] Add missing Russian and Ukrainian translations --- .../Resources/translations/validators.ru.xlf | 36 +++++++++++++++++++ .../Resources/translations/validators.uk.xlf | 36 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index b77e04e8471c8..361be20f796f8 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -330,6 +330,42 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Данный BIC не связан с IBAN {{ iban }}. + + This value should be valid JSON. + Значение должно быть корректным JSON. + + + This collection should contain only unique elements. + Эта коллекция должна содержать только уникальные элементы. + + + This value should be positive. + Значение должно быть положительным. + + + This value should be either positive or zero. + Значение должно быть положительным или равным нулю. + + + This value should be negative. + Значение должно быть отрицательным. + + + This value should be either negative or zero. + Значение должно быть отрицательным или равным нулю. + + + This value is not a valid timezone. + Значение не является корректным часовым поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Данный пароль был скомпрометирован в результате утечки данных и не должен быть использован. Пожалуйста, используйте другой пароль. + + + This value should be between {{ min }} and {{ max }}. + Значение должно быть между {{ min }} и {{ max }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf index 5ddc429854e54..cba61915544a3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf @@ -330,6 +330,42 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Банківський код (BIC) не пов’язаний із міжнародним номером банківського рахунку (IBAN) {{ iban }}. + + This value should be valid JSON. + Значення має бути корректним JSON. + + + This collection should contain only unique elements. + Ця колекція повинна мати тільки унікальни значення. + + + This value should be positive. + Значення має бути позитивним. + + + This value should be either positive or zero. + Значення має бути позитивним або дорівнювати нулю. + + + This value should be negative. + Значення має бути негативним. + + + This value should be either negative or zero. + Значення має бути негативним або дорівнювати нулю. + + + This value is not a valid timezone. + Значення не є дійсним часовим поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Цей пароль був скомпрометований в результаті витоку даних та не повинен використовуватися. Будь ласка, використовуйте інший пароль. + + + This value should be between {{ min }} and {{ max }}. + Значення має бути між {{ min }} та {{ max }}. + From 2f3b47a9e4513e301bdac2d1f793e2adad001d0f Mon Sep 17 00:00:00 2001 From: Konstantin Myakshin Date: Mon, 15 Jul 2019 22:23:03 +0300 Subject: [PATCH 105/167] [Mailer] Allow register mailer configuration in xml format --- .../Resources/config/schema/symfony-1.0.xsd | 5 +++++ .../DependencyInjection/Fixtures/php/mailer.php | 7 +++++++ .../DependencyInjection/Fixtures/xml/mailer.xml | 12 ++++++++++++ .../DependencyInjection/Fixtures/yml/mailer.yml | 3 +++ .../DependencyInjection/FrameworkExtensionTest.php | 9 ++++++++- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 04157511dc1a4..69deb492a2c84 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -33,6 +33,7 @@ + @@ -543,4 +544,8 @@ + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer.php new file mode 100644 index 0000000000000..74f6856c29249 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer.php @@ -0,0 +1,7 @@ +loadFromExtension('framework', [ + 'mailer' => [ + 'dsn' => 'smtp://example.com', + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml new file mode 100644 index 0000000000000..5faa09d36d1b0 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml new file mode 100644 index 0000000000000..0fca3e83e0546 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: 'smtp://example.com' diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 877e79c8899e3..76e4a086f4d7d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -55,7 +55,6 @@ use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass; use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader; use Symfony\Component\Validator\Util\LegacyTranslatorProxy; -use Symfony\Component\Validator\Validation; use Symfony\Component\Workflow; abstract class FrameworkExtensionTest extends TestCase @@ -1552,6 +1551,14 @@ public function testHttpClientFullDefaultOptions() ], $defaultOptions['peer_fingerprint']); } + public function testMailer(): void + { + $container = $this->createContainerFromFile('mailer'); + + $this->assertTrue($container->hasAlias('mailer')); + $this->assertTrue($container->hasDefinition('mailer.default_transport')); + } + protected function createContainer(array $data = []) { return new ContainerBuilder(new ParameterBag(array_merge([ From a0d2c429b1711c1dc9fce965266a967af449ae93 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 16 Jul 2019 08:12:19 +0200 Subject: [PATCH 106/167] added missing test --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 76e4a086f4d7d..b850d7c8c3398 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1557,6 +1557,7 @@ public function testMailer(): void $this->assertTrue($container->hasAlias('mailer')); $this->assertTrue($container->hasDefinition('mailer.default_transport')); + $this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0)); } protected function createContainer(array $data = []) From 4db953f40c2cb39fc16143682c5577d6f1674282 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 16 Jul 2019 14:34:18 +0200 Subject: [PATCH 107/167] [Config][ReflectionClassResource] Use ternary instead of null coaelscing operator --- .../Component/Config/Resource/ReflectionClassResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index 0ece672216390..f05042f8d32fa 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -140,7 +140,7 @@ private function generateSignature(\ReflectionClass $class) foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { yield $p->getDocComment().$p; - yield print_r($defaults[$p->name] ?? null, true); + yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true); } } From 9c88caad313a745ed1dcd213c0366de8d1526095 Mon Sep 17 00:00:00 2001 From: Mathieu Rochette Date: Tue, 16 Jul 2019 16:45:57 +0200 Subject: [PATCH 108/167] Container*::getServiceIds() should return an array of string see #32549 --- src/Symfony/Component/DependencyInjection/Container.php | 4 ++-- .../Component/DependencyInjection/ContainerBuilder.php | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index e385f0689896e..f2215acf1ca04 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -386,7 +386,7 @@ public function reset() /** * Gets all service ids. * - * @return array An array of all defined service ids + * @return string[] An array of all defined service ids */ public function getServiceIds() { @@ -405,7 +405,7 @@ public function getServiceIds() } $ids[] = 'service_container'; - return array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services))); + return array_map('strval', array_unique(array_merge($ids, array_keys($this->methodMap), array_keys($this->fileMap), array_keys($this->services)))); } /** diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c322b4357ad20..73145fd8dfaec 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -815,13 +815,11 @@ public function compile(/*$resolveEnvPlaceholders = false*/) } /** - * Gets all service ids. - * - * @return array An array of all defined service ids + * {@inheritdoc} */ public function getServiceIds() { - return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())); + return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()))); } /** From 59926c8b59331b212139a1fc88d18492785c250b Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 17 Jul 2019 02:09:02 +0200 Subject: [PATCH 109/167] [Messenger] pass transport name to factory --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 47eee56b171b6..c98e175a7a126 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1722,7 +1722,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder $transportDefinition = (new Definition(TransportInterface::class)) ->setFactory([new Reference('messenger.transport_factory'), 'createTransport']) - ->setArguments([$transport['dsn'], $transport['options'], new Reference($serializerId)]) + ->setArguments([$transport['dsn'], $transport['options'] + ['transport_name' => $name], new Reference($serializerId)]) ->addTag('messenger.receiver', ['alias' => $name]) ; $container->setDefinition($transportId = 'messenger.transport.'.$name, $transportDefinition); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b850d7c8c3398..f2d3c7964bcf8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -704,7 +704,7 @@ public function testMessengerTransports() $this->assertEquals([new Reference('messenger.transport_factory'), 'createTransport'], $transportFactory); $this->assertCount(3, $transportArguments); $this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $transportArguments[0]); - $this->assertEquals(['queue' => ['name' => 'Queue']], $transportArguments[1]); + $this->assertEquals(['queue' => ['name' => 'Queue'], 'transport_name' => 'customised'], $transportArguments[1]); $this->assertEquals(new Reference('messenger.transport.native_php_serializer'), $transportArguments[2]); $this->assertTrue($container->hasDefinition('messenger.transport.amqp.factory')); From 0f1bca406d34bd1dee094f493f7dca348da6a53a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 17 Jul 2019 11:55:16 +0200 Subject: [PATCH 110/167] [HttpClient] fix debug output added to stderr at shutdown --- src/Symfony/Component/HttpClient/CurlHttpClient.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 199a3b4ea17f7..c235ddcedd386 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -299,6 +299,12 @@ public function __destruct() if (\defined('CURLMOPT_PUSHFUNCTION')) { curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null); } + + while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active)); + + foreach ($this->multi->openHandles as $ch) { + curl_setopt($ch, CURLOPT_VERBOSE, false); + } } private static function handlePush($parent, $pushed, array $requestHeaders, CurlClientState $multi, int $maxPendingPushes, ?LoggerInterface $logger): int From 04e0f3c5756f4e33434e6cdf089886760c672054 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 17 Jul 2019 12:41:35 +0200 Subject: [PATCH 111/167] Bump minimum version of symfony/phpunit-bridge --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 143f73d3c2f35..919941f984d6b 100644 --- a/composer.json +++ b/composer.json @@ -98,7 +98,7 @@ "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "predis/predis": "~1.0", "egulias/email-validator": "~1.2,>=1.2.8|~2.0", - "symfony/phpunit-bridge": "~3.4|~4.0|~5.0", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8|~5.0", "symfony/security-acl": "~2.8|~3.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0" }, From 2d2e2742c82189711d5994ae16f0910818dba0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 17 Jul 2019 17:23:18 +0200 Subject: [PATCH 112/167] [Config] Do not use absolute path when computing the vendor freshness When one uses Docker with a different mounting point between CLI & FPM, the cache keeps regenerating because the ComposerResource class see a different path for each SAPI. For example `/home/app/app/vendor` vs `/var/www/app/vendor`. So if you hit FPM, then the CLI, then FPM, each time a new cache is generated. So the application is quite slow in dev env. And for people on MacOSX (with docker) is a big pain! And obvisouly, this never stabilizes ! This occurs a lot when you have a worker, that crash and reboot in the background, and you browse the web interface. Or when you have something that hit your API every X secondes, and you are working on a worker. --- src/Symfony/Component/Config/Resource/ComposerResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Resource/ComposerResource.php b/src/Symfony/Component/Config/Resource/ComposerResource.php index c826d1bb75127..9fb304bea8f06 100644 --- a/src/Symfony/Component/Config/Resource/ComposerResource.php +++ b/src/Symfony/Component/Config/Resource/ComposerResource.php @@ -48,7 +48,7 @@ public function isFresh($timestamp) { self::refresh(); - return self::$runtimeVendors === $this->vendors; + return array_values(self::$runtimeVendors) === array_values($this->vendors); } /** From 49bb7435f1939d8d1d1114b872cd22bc13a22e99 Mon Sep 17 00:00:00 2001 From: Piet Steinhart Date: Wed, 17 Jul 2019 22:40:10 +0200 Subject: [PATCH 113/167] [Messenger] fixed UnrecoverableExceptionInterface handling in Worker (fixes #32325) --- .../Component/Messenger/Tests/WorkerTest.php | 32 +++++++++++++++++++ src/Symfony/Component/Messenger/Worker.php | 14 ++++++++ 2 files changed, 46 insertions(+) diff --git a/src/Symfony/Component/Messenger/Tests/WorkerTest.php b/src/Symfony/Component/Messenger/Tests/WorkerTest.php index c82652fe1d29f..ac8c2a7ad8402 100644 --- a/src/Symfony/Component/Messenger/Tests/WorkerTest.php +++ b/src/Symfony/Component/Messenger/Tests/WorkerTest.php @@ -17,6 +17,7 @@ use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent; use Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent; use Symfony\Component\Messenger\Event\WorkerStoppedEvent; +use Symfony\Component\Messenger\Exception\HandlerFailedException; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\Retry\RetryStrategyInterface; @@ -120,6 +121,37 @@ public function testDispatchCausesRetry() $this->assertSame(1, $receiver->getAcknowledgeCount()); } + public function testUnrecoverableMessageHandlingExceptionPreventsRetries() + { + $envelope1 = new Envelope(new DummyMessage('Unwrapped Exception'), [new SentStamp('Some\Sender', 'transport1')]); + $envelope2 = new Envelope(new DummyMessage('Wrapped Exception'), [new SentStamp('Some\Sender', 'transport1')]); + + $receiver = new DummyReceiver([ + [$envelope1], + [$envelope2], + ]); + + $bus = $this->getMockBuilder(MessageBusInterface::class)->getMock(); + $bus->expects($this->at(0))->method('dispatch')->willThrowException(new UnrecoverableMessageHandlingException()); + $bus->expects($this->at(1))->method('dispatch')->willThrowException( + new HandlerFailedException($envelope2, [new UnrecoverableMessageHandlingException()]) + ); + + $retryStrategy = $this->getMockBuilder(RetryStrategyInterface::class)->getMock(); + $retryStrategy->expects($this->never())->method('isRetryable')->willReturn(true); + + $worker = new Worker(['transport1' => $receiver], $bus, ['transport1' => $retryStrategy]); + $worker->run([], function (?Envelope $envelope) use ($worker) { + // stop after the messages finish + if (null === $envelope) { + $worker->stop(); + } + }); + + // message was rejected + $this->assertSame(2, $receiver->getRejectCount()); + } + public function testDispatchCausesRejectWhenNoRetry() { $receiver = new DummyReceiver([ diff --git a/src/Symfony/Component/Messenger/Worker.php b/src/Symfony/Component/Messenger/Worker.php index a51cd3506fe50..d0c98b76ff05f 100644 --- a/src/Symfony/Component/Messenger/Worker.php +++ b/src/Symfony/Component/Messenger/Worker.php @@ -191,6 +191,20 @@ private function dispatchEvent($event) private function shouldRetry(\Throwable $e, Envelope $envelope, RetryStrategyInterface $retryStrategy): bool { + // if ALL nested Exceptions are an instance of UnrecoverableExceptionInterface we should not retry + if ($e instanceof HandlerFailedException) { + $shouldNotRetry = true; + foreach ($e->getNestedExceptions() as $nestedException) { + if (!$nestedException instanceof UnrecoverableExceptionInterface) { + $shouldNotRetry = false; + break; + } + } + if ($shouldNotRetry) { + return false; + } + } + if ($e instanceof UnrecoverableExceptionInterface) { return false; } From f6e0b01f7cd4961129d1235b94a7e4f50913f9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 16 Jul 2019 23:33:29 +0200 Subject: [PATCH 114/167] Use mocks before replacing the error handler We want the bridge to mute the deprecations triggered when building mocks. --- .../Component/Debug/Tests/ErrorHandlerTest.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index bb82c63328b19..bb7fe413abe63 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -70,8 +70,8 @@ public function testRegister() public function testErrorGetLast() { - $handler = ErrorHandler::register(); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger); $handler->screamAt(E_ALL); @@ -143,9 +143,8 @@ public function testConstruct() public function testDefaultLogger() { try { - $handler = ErrorHandler::register(); - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger, E_NOTICE); $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]); @@ -334,12 +333,11 @@ public function testHandleDeprecation() public function testHandleException() { try { + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); $exception = new \Exception('foo'); - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logArgCheck = function ($level, $message, $context) { $this->assertSame('Uncaught Exception: foo', $message); $this->assertArrayHasKey('exception', $context); @@ -483,6 +481,7 @@ public function testSettingLoggerWhenExceptionIsBuffered() public function testHandleFatalError() { try { + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); $error = [ @@ -492,8 +491,6 @@ public function testHandleFatalError() 'line' => 123, ]; - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logArgCheck = function ($level, $message, $context) { $this->assertEquals('Fatal Parse Error: foo', $message); $this->assertArrayHasKey('exception', $context); From c03fff5b3e3331d64da73b9aea24b06d361df275 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 Jul 2019 12:28:36 +0200 Subject: [PATCH 115/167] fix cs --- .../Validator/Resources/translations/validators.hu.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf index 18a50e86f8756..96ae6fe54ea6a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf @@ -364,7 +364,7 @@ This value should be between {{ min }} and {{ max }}. - Ennek az értéknek {{ min }} és {{ max }} között kell lennie. + Ennek az értéknek {{ min }} és {{ max }} között kell lennie. From f635827002357e7be897080cb9eeee40966a8524 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 17 Jul 2019 11:55:16 +0200 Subject: [PATCH 116/167] [HttpClient] fix debug output added to stderr at shutdown --- src/Symfony/Component/HttpClient/CurlHttpClient.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 199a3b4ea17f7..c235ddcedd386 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -299,6 +299,12 @@ public function __destruct() if (\defined('CURLMOPT_PUSHFUNCTION')) { curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null); } + + while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active)); + + foreach ($this->multi->openHandles as $ch) { + curl_setopt($ch, CURLOPT_VERBOSE, false); + } } private static function handlePush($parent, $pushed, array $requestHeaders, CurlClientState $multi, int $maxPendingPushes, ?LoggerInterface $logger): int From 813ad248e5029bf709e09d9800d0b6da23a829ce Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 Jul 2019 12:37:37 +0200 Subject: [PATCH 117/167] fix merge --- .../Component/Messenger/DependencyInjection/MessengerPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php index a7a0a3aec3e22..8f14fe58d99d6 100644 --- a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php +++ b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php @@ -211,7 +211,7 @@ private function guessHandledClasses(\ReflectionClass $handlerClass, string $ser } if ($type->isBuiltin()) { - throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type)); + throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type)); } return [$parameters[0]->getType()->getName()]; From a4ab13d567616fdfca6a2a875b0c6c3e3fa0a1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 5 Jul 2019 20:02:04 +0200 Subject: [PATCH 118/167] Mute deprecations triggered from phpunit --- .../PhpUnit/DeprecationErrorHandler.php | 3 + .../DeprecationErrorHandler/Deprecation.php | 28 +++++++-- .../DeprecationTest.php | 63 +++++++++++++++++++ 3 files changed, 88 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index f9457c937d531..e059fe2a9d995 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -128,6 +128,9 @@ public function handleError($type, $msg, $file, $line, $context = []) } $deprecation = new Deprecation($msg, debug_backtrace(), $file); + if ($deprecation->isMuted()) { + return; + } $group = 'other'; if ($deprecation->originatesFromAnObject()) { diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index ea84256663528..2d6aa29224cb5 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -48,9 +48,9 @@ class Deprecation private $originMethod; /** - * @var string one of the PATH_TYPE_* constants + * @var string */ - private $triggeringFilePathType; + private $triggeringFile; /** @var string[] absolute paths to vendor directories */ private static $vendors; @@ -76,7 +76,7 @@ public function __construct($message, array $trace, $file) // No-op } $line = $trace[$i]; - $this->triggeringFilePathType = $this->getPathType($file); + $this->triggeringFile = $file; if (isset($line['object']) || isset($line['class'])) { if (isset($line['class']) && 0 === strpos($line['class'], SymfonyTestsListenerFor::class)) { $parsedMsg = unserialize($this->message); @@ -88,7 +88,7 @@ public function __construct($message, array $trace, $file) // then we need to use the serialized information to determine // if the error has been triggered from vendor code. if (isset($parsedMsg['triggering_file'])) { - $this->triggeringFilePathType = $this->getPathType($parsedMsg['triggering_file']); + $this->triggeringFile = $parsedMsg['triggering_file']; } return; @@ -169,6 +169,21 @@ public function isLegacy($utilPrefix) || \in_array('legacy', $test::getGroups($class, $method), true); } + /** + * @return bool + */ + public function isMuted() + { + if ('Function ReflectionType::__toString() is deprecated' !== $this->message) { + return false; + } + if (isset($this->trace[1]['class'])) { + return 0 === strpos($this->trace[1]['class'], 'PHPUnit\\'); + } + + return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR); + } + /** * Tells whether both the calling package and the called package are vendor * packages. @@ -177,10 +192,11 @@ public function isLegacy($utilPrefix) */ public function getType() { - if (self::PATH_TYPE_SELF === $this->triggeringFilePathType) { + $triggeringFilePathType = $this->getPathType($this->triggeringFile); + if (self::PATH_TYPE_SELF === $triggeringFilePathType) { return self::TYPE_SELF; } - if (self::PATH_TYPE_UNDETERMINED === $this->triggeringFilePathType) { + if (self::PATH_TYPE_UNDETERMINED === $triggeringFilePathType) { return self::TYPE_UNDETERMINED; } $erroringFile = $erroringPackage = null; diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index 0c8708bb35f00..60b1efdfa2317 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler; use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation; class DeprecationTest extends TestCase @@ -55,6 +56,68 @@ public function testItRulesOutFilesOutsideVendorsAsIndirect() $this->assertNotSame(Deprecation::TYPE_INDIRECT, $deprecation->getType()); } + /** + * @dataProvider mutedProvider + */ + public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpunit($muted, $callingClass, $message) + { + $trace = $this->debugBacktrace(); + array_unshift($trace, ['class' => $callingClass]); + array_unshift($trace, ['class' => DeprecationErrorHandler::class]); + $deprecation = new Deprecation($message, $trace, 'should_not_matter.php'); + $this->assertSame($muted, $deprecation->isMuted()); + } + + public function mutedProvider() + { + yield 'not from phpunit, and not a whitelisted message' => [ + false, + \My\Source\Code::class, + 'Self deprecating humor is deprecated by itself' + ]; + yield 'from phpunit, but not a whitelisted message' => [ + false, + \PHPUnit\Random\Piece\Of\Code::class, + 'Self deprecating humor is deprecated by itself' + ]; + yield 'whitelisted message, but not from phpunit' => [ + false, + \My\Source\Code::class, + 'Function ReflectionType::__toString() is deprecated', + ]; + yield 'from phpunit and whitelisted message' => [ + true, + \PHPUnit\Random\Piece\Of\Code::class, + 'Function ReflectionType::__toString() is deprecated', + ]; + } + + public function testNotMutedIfNotCalledFromAClassButARandomFile() + { + $deprecation = new Deprecation( + 'Function ReflectionType::__toString() is deprecated', + [ + ['file' => 'should_not_matter.php'], + ['file' => 'should_not_matter_either.php'], + ], + 'my-procedural-controller.php' + ); + $this->assertFalse($deprecation->isMuted()); + } + + public function testItTakesMutesDeprecationFromPhpUnitFiles() + { + $deprecation = new Deprecation( + 'Function ReflectionType::__toString() is deprecated', + [ + ['file' => 'should_not_matter.php'], + ['file' => 'should_not_matter_either.php'], + ], + 'random_path' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'phpunit' . \DIRECTORY_SEPARATOR . 'whatever.php' + ); + $this->assertTrue($deprecation->isMuted()); + } + /** * This method is here to simulate the extra level from the piece of code * triggering an error to the error handler From 70b85731b80000db43e1a19ec9778873dba75034 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 18 Jul 2019 19:32:23 +0200 Subject: [PATCH 119/167] [Mailer] Fix phpdoc for variadic methods --- src/Symfony/Component/Mime/Email.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Mime/Email.php b/src/Symfony/Component/Mime/Email.php index 7812372d5372f..3fbebc461f1eb 100644 --- a/src/Symfony/Component/Mime/Email.php +++ b/src/Symfony/Component/Mime/Email.php @@ -103,7 +103,7 @@ public function getSender(): ?Address } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -113,7 +113,7 @@ public function addFrom(...$addresses) } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -131,7 +131,7 @@ public function getFrom(): array } /** - * @param Address|string $addresses + * @param Address|string ...$addresses * * @return $this */ @@ -141,7 +141,7 @@ public function addReplyTo(...$addresses) } /** - * @param Address|string $addresses + * @param Address|string ...$addresses * * @return $this */ @@ -159,7 +159,7 @@ public function getReplyTo(): array } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -169,7 +169,7 @@ public function addTo(...$addresses) } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -187,7 +187,7 @@ public function getTo(): array } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -197,7 +197,7 @@ public function addCc(...$addresses) } /** - * @param Address|string $addresses + * @param Address|string ...$addresses * * @return $this */ @@ -215,7 +215,7 @@ public function getCc(): array } /** - * @param Address|NamedAddress|string $addresses + * @param Address|NamedAddress|string ...$addresses * * @return $this */ @@ -225,7 +225,7 @@ public function addBcc(...$addresses) } /** - * @param Address|string $addresses + * @param Address|string ...$addresses * * @return $this */ From 9252e7592390589842e55f8f9ea588fb42cee49f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 18 Jul 2019 19:38:48 +0200 Subject: [PATCH 120/167] [Mime] rename Headers::getAll() to all() --- .../Mailchimp/Http/Api/MandrillTransport.php | 2 +- .../Mailer/Bridge/Mailchimp/composer.json | 2 +- .../Bridge/Mailgun/Http/Api/MailgunTransport.php | 4 ++-- .../Bridge/Mailgun/Http/MailgunTransport.php | 2 +- .../Mailer/Bridge/Mailgun/composer.json | 2 +- .../Postmark/Http/Api/PostmarkTransport.php | 2 +- .../Mailer/Bridge/Postmark/composer.json | 2 +- .../Sendgrid/Http/Api/SendgridTransport.php | 2 +- .../Mailer/Bridge/Sendgrid/composer.json | 2 +- .../Component/Mailer/DelayedSmtpEnvelope.php | 2 +- .../Mailer/EventListener/MessageListener.php | 2 +- src/Symfony/Component/Mailer/composer.json | 10 +++++----- src/Symfony/Component/Mime/Header/Headers.php | 6 +++--- .../Component/Mime/Tests/Header/HeadersTest.php | 16 ++++++++-------- src/Symfony/Component/Mime/Tests/MessageTest.php | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php index a177e664b62a2..9217eaa49f46b 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php @@ -82,7 +82,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array } $headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type']; - foreach ($email->getHeaders()->getAll() as $name => $header) { + foreach ($email->getHeaders()->all() as $name => $header) { if (\in_array($name, $headersToBypass, true)) { continue; } diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json b/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json index 761ec6989a0a8..5134ec8717595 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^7.1.3", - "symfony/mailer": "^4.3" + "symfony/mailer": "^4.3.3" }, "require-dev": { "symfony/http-client": "^4.3" diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php index f546537831e85..9da64c4e2be17 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/Api/MailgunTransport.php @@ -46,7 +46,7 @@ protected function doSendEmail(Email $email, SmtpEnvelope $envelope): void { $body = new FormDataPart($this->getPayload($email, $envelope)); $headers = []; - foreach ($body->getPreparedHeaders()->getAll() as $header) { + foreach ($body->getPreparedHeaders()->all() as $header) { $headers[] = $header->toString(); } @@ -97,7 +97,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array } $headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type']; - foreach ($headers->getAll() as $name => $header) { + foreach ($headers->all() as $name => $header) { if (\in_array($name, $headersToBypass, true)) { continue; } diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/MailgunTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/MailgunTransport.php index 913ed705d9ab0..1cc0f25dec940 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/MailgunTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Http/MailgunTransport.php @@ -48,7 +48,7 @@ protected function doSend(SentMessage $message): void 'message' => new DataPart($message->toString(), 'message.mime'), ]); $headers = []; - foreach ($body->getPreparedHeaders()->getAll() as $header) { + foreach ($body->getPreparedHeaders()->all() as $header) { $headers[] = $header->toString(); } $endpoint = str_replace(['%domain%', '%region_dot%'], [urlencode($this->domain), 'us' !== ($this->region ?: 'us') ? $this->region.'.' : ''], self::ENDPOINT); diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json b/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json index 6f00d507ebe60..6fc40d9091876 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^7.1.3", - "symfony/mailer": "^4.3" + "symfony/mailer": "^4.3.3" }, "require-dev": { "symfony/http-client": "^4.3" diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/Http/Api/PostmarkTransport.php b/src/Symfony/Component/Mailer/Bridge/Postmark/Http/Api/PostmarkTransport.php index 3ec9c640a655d..8a046c9f9553d 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/Http/Api/PostmarkTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/Http/Api/PostmarkTransport.php @@ -68,7 +68,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array ]; $headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender']; - foreach ($email->getHeaders()->getAll() as $name => $header) { + foreach ($email->getHeaders()->all() as $name => $header) { if (\in_array($name, $headersToBypass, true)) { continue; } diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json b/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json index 0493f1dfb0853..8534c36eb4c25 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^7.1.3", - "symfony/mailer": "^4.3" + "symfony/mailer": "^4.3.3" }, "require-dev": { "symfony/http-client": "^4.3" diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Http/Api/SendgridTransport.php b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Http/Api/SendgridTransport.php index 8369d4e2775a0..894fac158f6e1 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/Http/Api/SendgridTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/Http/Api/SendgridTransport.php @@ -82,7 +82,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array // these headers can't be overwritten according to Sendgrid docs // see https://developers.pepipost.com/migration-api/new-subpage/email-send $headersToBypass = ['x-sg-id', 'x-sg-eid', 'received', 'dkim-signature', 'content-transfer-encoding', 'from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'reply-to']; - foreach ($email->getHeaders()->getAll() as $name => $header) { + foreach ($email->getHeaders()->all() as $name => $header) { if (\in_array($name, $headersToBypass, true)) { continue; } diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json b/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json index 5630f5d3f40f8..1bfb16286d55b 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^7.1.3", - "symfony/mailer": "^4.3" + "symfony/mailer": "^4.3.3" }, "require-dev": { "symfony/http-client": "^4.3" diff --git a/src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php b/src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php index 479fc5be42161..b923626fcbb5a 100644 --- a/src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php +++ b/src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php @@ -73,7 +73,7 @@ private static function getRecipientsFromHeaders(Headers $headers): array { $recipients = []; foreach (['to', 'cc', 'bcc'] as $name) { - foreach ($headers->getAll($name) as $header) { + foreach ($headers->all($name) as $header) { foreach ($header->getAddresses() as $address) { $recipients[] = new Address($address->getAddress()); } diff --git a/src/Symfony/Component/Mailer/EventListener/MessageListener.php b/src/Symfony/Component/Mailer/EventListener/MessageListener.php index c63595ada02fe..94b6f2a9ee87f 100644 --- a/src/Symfony/Component/Mailer/EventListener/MessageListener.php +++ b/src/Symfony/Component/Mailer/EventListener/MessageListener.php @@ -53,7 +53,7 @@ private function setHeaders(Message $message): void } $headers = $message->getHeaders(); - foreach ($this->headers->getAll() as $name => $header) { + foreach ($this->headers->all() as $name => $header) { if (!$headers->has($name)) { $headers->add($header); } else { diff --git a/src/Symfony/Component/Mailer/composer.json b/src/Symfony/Component/Mailer/composer.json index 91bfb1031d937..e41350c88b6cf 100644 --- a/src/Symfony/Component/Mailer/composer.json +++ b/src/Symfony/Component/Mailer/composer.json @@ -20,16 +20,16 @@ "egulias/email-validator": "^2.0", "psr/log": "~1.0", "symfony/event-dispatcher": "^4.3", - "symfony/mime": "^4.3" + "symfony/mime": "^4.3.3" }, "require-dev": { "symfony/amazon-mailer": "^4.3", "symfony/google-mailer": "^4.3", "symfony/http-client-contracts": "^1.1", - "symfony/mailgun-mailer": "^4.3.2", - "symfony/mailchimp-mailer": "^4.3", - "symfony/postmark-mailer": "^4.3", - "symfony/sendgrid-mailer": "^4.3" + "symfony/mailgun-mailer": "^4.3.3", + "symfony/mailchimp-mailer": "^4.3.3", + "symfony/postmark-mailer": "^4.3.3", + "symfony/sendgrid-mailer": "^4.3.3" }, "autoload": { "psr-4": { "Symfony\\Component\\Mailer\\": "" }, diff --git a/src/Symfony/Component/Mime/Header/Headers.php b/src/Symfony/Component/Mime/Header/Headers.php index c0e45e0d0a852..57f02b25a3ef0 100644 --- a/src/Symfony/Component/Mime/Header/Headers.php +++ b/src/Symfony/Component/Mime/Header/Headers.php @@ -51,7 +51,7 @@ public function __clone() public function setMaxLineLength(int $lineLength) { $this->lineLength = $lineLength; - foreach ($this->getAll() as $header) { + foreach ($this->all() as $header) { $header->setMaxLineLength($lineLength); } } @@ -177,7 +177,7 @@ public function get(string $name): ?HeaderInterface return array_shift($values); } - public function getAll(string $name = null): iterable + public function all(string $name = null): iterable { if (null === $name) { foreach ($this->headers as $name => $collection) { @@ -220,7 +220,7 @@ public function toString(): string public function toArray(): array { $arr = []; - foreach ($this->getAll() as $header) { + foreach ($this->all() as $header) { if ('' !== $header->getBodyAsString()) { $arr[] = $header->toString(); } diff --git a/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php b/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php index 2f4a1dd6358a8..3568c9a6e45d6 100644 --- a/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php +++ b/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php @@ -141,7 +141,7 @@ public function testGetReturnsNullIfHeaderNotSet() $this->assertNull($headers->get('Message-ID')); } - public function testGetAllReturnsAllHeadersMatchingName() + public function testAllReturnsAllHeadersMatchingName() { $header0 = new UnstructuredHeader('X-Test', 'some@id'); $header1 = new UnstructuredHeader('X-Test', 'other@id'); @@ -150,10 +150,10 @@ public function testGetAllReturnsAllHeadersMatchingName() $headers->addTextHeader('X-Test', 'some@id'); $headers->addTextHeader('X-Test', 'other@id'); $headers->addTextHeader('X-Test', 'more@id'); - $this->assertEquals([$header0, $header1, $header2], iterator_to_array($headers->getAll('X-Test'))); + $this->assertEquals([$header0, $header1, $header2], iterator_to_array($headers->all('X-Test'))); } - public function testGetAllReturnsAllHeadersIfNoArguments() + public function testAllReturnsAllHeadersIfNoArguments() { $header0 = new IdentificationHeader('Message-ID', 'some@id'); $header1 = new UnstructuredHeader('Subject', 'thing'); @@ -162,13 +162,13 @@ public function testGetAllReturnsAllHeadersIfNoArguments() $headers->addIdHeader('Message-ID', 'some@id'); $headers->addTextHeader('Subject', 'thing'); $headers->addMailboxListHeader('To', [new Address('person@example.org')]); - $this->assertEquals(['message-id' => $header0, 'subject' => $header1, 'to' => $header2], iterator_to_array($headers->getAll())); + $this->assertEquals(['message-id' => $header0, 'subject' => $header1, 'to' => $header2], iterator_to_array($headers->all())); } - public function testGetAllReturnsEmptyArrayIfNoneSet() + public function testAllReturnsEmptyArrayIfNoneSet() { $headers = new Headers(); - $this->assertEquals([], iterator_to_array($headers->getAll('Received'))); + $this->assertEquals([], iterator_to_array($headers->all('Received'))); } public function testRemoveRemovesAllHeadersWithName() @@ -199,12 +199,12 @@ public function testGetIsNotCaseSensitive() $this->assertEquals($header, $headers->get('message-id')); } - public function testGetAllIsNotCaseSensitive() + public function testAllIsNotCaseSensitive() { $header = new IdentificationHeader('Message-ID', 'some@id'); $headers = new Headers(); $headers->addIdHeader('Message-ID', 'some@id'); - $this->assertEquals([$header], iterator_to_array($headers->getAll('message-id'))); + $this->assertEquals([$header], iterator_to_array($headers->all('message-id'))); } public function testRemoveIsNotCaseSensitive() diff --git a/src/Symfony/Component/Mime/Tests/MessageTest.php b/src/Symfony/Component/Mime/Tests/MessageTest.php index dbeb0a55443c0..cc806b919e3f9 100644 --- a/src/Symfony/Component/Mime/Tests/MessageTest.php +++ b/src/Symfony/Component/Mime/Tests/MessageTest.php @@ -68,7 +68,7 @@ public function testGetPreparedHeaders() $message = new Message(); $message->getHeaders()->addMailboxListHeader('From', ['fabien@symfony.com']); $h = $message->getPreparedHeaders(); - $this->assertCount(4, iterator_to_array($h->getAll())); + $this->assertCount(4, iterator_to_array($h->all())); $this->assertEquals(new MailboxListHeader('From', [new Address('fabien@symfony.com')]), $h->get('From')); $this->assertEquals(new UnstructuredHeader('MIME-Version', '1.0'), $h->get('mime-version')); $this->assertTrue($h->has('Message-Id')); From d1c6580192ab72a4aec3aab5507189911f4d9b29 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Thu, 18 Jul 2019 18:37:55 +0200 Subject: [PATCH 121/167] Properly handle optional tag attributes for !tagged_iterator When using the array syntax --- .../DependencyInjection/Loader/YamlFileLoader.php | 2 +- .../Fixtures/yaml/tagged_iterator_optional.yml | 4 ++++ .../Tests/Loader/YamlFileLoaderTest.php | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/tagged_iterator_optional.yml diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 703620c8a67e3..2da8347a4bba0 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -736,7 +736,7 @@ private function resolveServices($value, $file, $isParameter = false) throw new InvalidArgumentException(sprintf('"!%s" tag contains unsupported key "%s"; supported ones are "tag", "index_by" and "default_index_method".', $value->getTag(), implode('"", "', $diff))); } - $argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'], $argument['default_index_method'] ?? null, $forLocator); + $argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'] ?? null, $argument['default_index_method'] ?? null, $forLocator); if ($forLocator) { $argument = new ServiceLocatorArgument($argument); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/tagged_iterator_optional.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/tagged_iterator_optional.yml new file mode 100644 index 0000000000000..6c6b65226dd24 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/tagged_iterator_optional.yml @@ -0,0 +1,4 @@ +services: + iterator_service: + class: FooClass + arguments: [!tagged {tag: test.tag}] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 0207abadec711..c0291c76c76dd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -852,4 +852,18 @@ public function testOverriddenDefaultsBindings() $this->assertSame('overridden', $container->get('bar')->quz); } + + /** + * When creating a tagged iterator using the array syntax, all optional parameters should be properly handled. + */ + public function testDefaultValueOfTagged() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('tagged_iterator_optional.yml'); + + $iteratorArgument = $container->getDefinition('iterator_service')->getArgument(0); + $this->assertInstanceOf(TaggedIteratorArgument::class, $iteratorArgument); + $this->assertNull($iteratorArgument->getIndexAttribute()); + } } From 77fa2830910943e98334aa3641758927082ebe8f Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Thu, 18 Jul 2019 18:35:50 -0400 Subject: [PATCH 122/167] Fix Debug component tests --- .../FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 112dfbb7f7520..9a56b3b4ec8fc 100644 --- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -71,6 +71,7 @@ public function provideClassNotFoundData() { $autoloader = new ComposerClassLoader(); $autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception')); + $autoloader->add('Symfony_Component_Debug_Tests_Fixtures', realpath(__DIR__.'/../../Tests/Fixtures')); $debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']); @@ -101,6 +102,7 @@ public function provideClassNotFoundData() 'message' => 'Class \'UndefinedFunctionException\' not found', ], "/^Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ @@ -110,6 +112,7 @@ public function provideClassNotFoundData() 'message' => 'Class \'PEARClass\' not found', ], "/^Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ @@ -119,6 +122,7 @@ public function provideClassNotFoundData() 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', ], "/^Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\\\Bar\".\nDid you forget a \"use\" statement for .*\"Symfony\\\\Component\\\\Debug\\\\Exception\\\\UndefinedFunctionException\"\?$/", + [$debugClassLoader, 'loadClass'], ], [ [ From 969f2c4a81d18c3861ec0f6a0c381f962a30f7fd Mon Sep 17 00:00:00 2001 From: kernig Date: Wed, 10 Jul 2019 17:26:36 +0200 Subject: [PATCH 123/167] [Validator] Added support for validation of giga values --- src/Symfony/Component/Validator/Constraints/File.php | 4 +++- .../Component/Validator/Tests/Constraints/FileTest.php | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php index 5221857101af2..c70db0a74c4c1 100644 --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php @@ -102,8 +102,10 @@ private function normalizeBinaryFormat($maxSize) $factors = [ 'k' => 1000, 'ki' => 1 << 10, - 'm' => 1000000, + 'm' => 1000 * 1000, 'mi' => 1 << 20, + 'g' => 1000 * 1000 * 1000, + 'gi' => 1 << 30, ]; if (ctype_digit((string) $maxSize)) { $this->maxSize = (int) $maxSize; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php index d3117ed44a245..e0b6ec8f41f5d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileTest.php @@ -97,6 +97,10 @@ public function provideValidSizes() ['1MI', 1048576, true], ['3m', 3000000, false], ['3M', 3000000, false], + ['1gi', 1073741824, true], + ['1GI', 1073741824, true], + ['4g', 4000000000, false], + ['4G', 4000000000, false], ]; } @@ -107,8 +111,6 @@ public function provideInvalidSizes() ['foo'], ['1Ko'], ['1kio'], - ['1G'], - ['1Gi'], ]; } From a616e18b07b0424d21a5d86f1ecabc2865d15c83 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jul 2019 10:03:57 +0200 Subject: [PATCH 124/167] fix tests --- .../Tests/DependencyInjection/DebugExtensionTest.php | 1 + .../Bundle/FrameworkBundle/Command/ContainerDebugCommand.php | 1 + .../Tests/DependencyInjection/CompleteConfigurationTest.php | 1 + .../Tests/DependencyInjection/SecurityExtensionTest.php | 1 + .../TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php | 2 ++ 5 files changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php b/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php index cd6084c5e3bce..4a520ba56f46b 100644 --- a/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php +++ b/src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php @@ -52,6 +52,7 @@ private function compileContainer(ContainerBuilder $container) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index eb4f8e4f6dc47..2143e885c7caa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -194,6 +194,7 @@ protected function getContainerBuilder() $buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel)); $container = $buildContainer(); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } else { (new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump')); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 951b61dd9f3ac..c31fe9de20f61 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -617,6 +617,7 @@ protected function getContainer($file) $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); return $container; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php index 8372e34c0eb9a..59f2ff037a385 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php @@ -321,6 +321,7 @@ protected function getRawContainer() $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); return $container; } diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index a079dbd11bc7c..000cad7f930d2 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -266,6 +266,7 @@ public function testRuntimeLoader() $container->register('foo', '%foo%')->addTag('twig.runtime'); $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); $loader = $container->getDefinition('twig.runtime_loader'); @@ -327,6 +328,7 @@ private function compileContainer(ContainerBuilder $container) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); } From c53e25332adbb05671e4c3de4fe17f24409671d3 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 19 Jul 2019 10:43:44 +0200 Subject: [PATCH 125/167] [Debug][ExceptionHandler] Add tests for custom handlers --- .../Debug/Tests/ExceptionHandlerTest.php | 66 ++++++++++++++----- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index e166136cbbed4..8a196649503c3 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -76,7 +76,7 @@ public function testHeaders() ob_start(); $handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST'])); - $response = ob_get_clean(); + ob_get_clean(); $expectedHeaders = [ ['HTTP/1.0 405', true, null], @@ -99,35 +99,65 @@ public function testNestedExceptions() public function testHandle() { - $exception = new \Exception('foo'); + $handler = new ExceptionHandler(true); + ob_start(); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); - $handler - ->expects($this->exactly(2)) - ->method('sendPhpResponse'); + $handler->handle(new \Exception('foo')); - $handler->handle($exception); + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'foo'); + } - $handler->setHandler(function ($e) use ($exception) { - $this->assertSame($exception, $e); + public function testHandleWithACustomHandlerThatOutputsSomething() + { + $handler = new ExceptionHandler(true); + ob_start(); + $handler->setHandler(function () { + echo 'ccc'; }); - $handler->handle($exception); + $handler->handle(new \Exception()); + ob_end_flush(); // Necessary because of this PHP bug : https://bugs.php.net/bug.php?id=76563 + $this->assertSame('ccc', ob_get_clean()); } - public function testHandleOutOfMemoryException() + public function testHandleWithACustomHandlerThatOutputsNothing() + { + $handler = new ExceptionHandler(true); + $handler->setHandler(function () {}); + + $handler->handle(new \Exception('ccc')); + + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc'); + } + + public function testHandleWithACustomHandlerThatFails() { - $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); + $handler = new ExceptionHandler(true); + $handler->setHandler(function () { + throw new \RuntimeException(); + }); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); - $handler - ->expects($this->once()) - ->method('sendPhpResponse'); + $handler->handle(new \Exception('ccc')); - $handler->setHandler(function ($e) { + $this->assertThatTheExceptionWasOutput(ob_get_clean(), \Exception::class, 'Exception', 'ccc'); + } + + public function testHandleOutOfMemoryException() + { + $handler = new ExceptionHandler(true); + ob_start(); + $handler->setHandler(function () { $this->fail('OutOfMemoryException should bypass the handler'); }); - $handler->handle($exception); + $handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__)); + + $this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryException::class, 'OutOfMemoryException', 'foo'); + } + + private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage) + { + $this->assertContains(sprintf('%s', $expectedClass, $expectedTitle), $content); + $this->assertContains(sprintf('

%s

', $expectedMessage), $content); } } From f7e24c2c80b35a1264a31f0388dd1e593cc7a1d6 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 19 Jul 2019 13:42:31 +0200 Subject: [PATCH 126/167] Remove dead tests fixtures --- .../Compiler/AddConsoleCommandPassTest.php | 5 --- .../Tests/SecurityUserValueResolverTest.php | 8 ---- .../Debug/Tests/MockExceptionHandler.php | 24 ------------ .../OtherDir/Component1/Dir3/Service3.php | 8 ---- .../Prototype/Sub/NoLoadAbstractBar.php | 7 ---- .../Prototype/Sub/NoLoadBarInterface.php | 7 ---- .../Fixtures/Prototype/Sub/NoLoadBarTrait.php | 7 ---- .../Fixtures/includes/autowiring_classes.php | 14 ------- .../HttpFoundation/Tests/ResponseTest.php | 11 ------ .../ExtensionLoadedExtension.php | 22 ----------- .../ExtensionLoadedBundle.php | 18 --------- .../Command/BarCommand.php | 17 --------- .../Normalizer/GetSetMethodNormalizerTest.php | 37 ------------------- .../Normalizer/PropertyNormalizerTest.php | 12 ------ .../Tests/Fixtures/ConstraintAValidator.php | 37 ------------------- .../Tests/Fixtures/FakeClassMetadata.php | 26 ------------- .../Fixtures/InvalidConstraintValidator.php | 16 -------- 17 files changed, 276 deletions(-) delete mode 100644 src/Symfony/Component/Debug/Tests/MockExceptionHandler.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadAbstractBar.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadBarInterface.php delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Sub/NoLoadBarTrait.php delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php delete mode 100644 src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php delete mode 100644 src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php delete mode 100644 src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php index 17cbf62d0b5b0..3681ca2047c1b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php @@ -16,7 +16,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\HttpKernel\Bundle\Bundle; /** * @group legacy @@ -123,7 +122,3 @@ public function testProcessPrivateServicesWithSameCommand() class MyCommand extends Command { } - -class ExtensionPresentBundle extends Bundle -{ -} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php index 90f31f0b31902..539f585b2658f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php @@ -91,11 +91,3 @@ public function testIntegrationNoUser() $this->assertSame([null], $argumentResolver->getArguments(Request::create('/'), function (UserInterface $user = null) {})); } } - -abstract class DummyUser implements UserInterface -{ -} - -abstract class DummySubUser extends DummyUser -{ -} diff --git a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php b/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php deleted file mode 100644 index 2d6ce564d23a4..0000000000000 --- a/src/Symfony/Component/Debug/Tests/MockExceptionHandler.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Symfony\Component\Debug\ExceptionHandler; - -class MockExceptionHandler extends ExceptionHandler -{ - public $e; - - public function handle(\Exception $e) - { - $this->e = $e; - } -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php deleted file mode 100644 index ee6498c9d50c5..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/OtherDir/Component1/Dir3/Service3.php +++ /dev/null @@ -1,8 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; - -class ExtensionLoadedExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - } -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php deleted file mode 100644 index 3af81cb07396d..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionLoadedBundle extends Bundle -{ -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php deleted file mode 100644 index 977976b75f88b..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php +++ /dev/null @@ -1,17 +0,0 @@ -kevinDunglas = $kevinDunglas; - } - - public function getKevinDunglas() - { - return $this->kevinDunglas; - } - - public function setFooBar($fooBar) - { - $this->fooBar = $fooBar; - } - - public function getFooBar() - { - return $this->fooBar; - } - - public function setBar_foo($bar_foo) - { - $this->bar_foo = $bar_foo; - } - - public function getBar_foo() - { - return $this->bar_foo; - } -} - class ObjectConstructorArgsWithPrivateMutatorDummy { private $foo; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index f8d1eb8db8d7f..cfa21b6758a06 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -497,18 +497,6 @@ public function getBar() } } -class PropertyCamelizedDummy -{ - private $kevinDunglas; - public $fooBar; - public $bar_foo; - - public function __construct($kevinDunglas = null) - { - $this->kevinDunglas = $kevinDunglas; - } -} - class StaticPropertyDummy { private static $property = 'value'; diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php deleted file mode 100644 index 8b0d30f571421..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Context\ExecutionContextInterface; - -class ConstraintAValidator extends ConstraintValidator -{ - public static $passedContext; - - public function initialize(ExecutionContextInterface $context) - { - parent::initialize($context); - - self::$passedContext = $context; - } - - public function validate($value, Constraint $constraint) - { - if ('VALID' != $value) { - $this->context->addViolation('message', ['param' => 'value']); - - return; - } - } -} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php b/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php deleted file mode 100644 index 39f54777795cd..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -class FakeClassMetadata extends ClassMetadata -{ - public function addCustomPropertyMetadata($propertyName, $metadata) - { - if (!isset($this->members[$propertyName])) { - $this->members[$propertyName] = []; - } - - $this->members[$propertyName][] = $metadata; - } -} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php b/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php deleted file mode 100644 index bd9a5cf6c32dc..0000000000000 --- a/src/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -class InvalidConstraintValidator -{ -} From 48408e3c5b482eac2b7ad109362c830b843b45d6 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Fri, 19 Jul 2019 14:27:46 +0200 Subject: [PATCH 127/167] [Messenger] fix transport_name option not passing validation the doctrine transport connection validates the options and complains about this option, so we remove it before. the purpose is for custom transport factories anyway --- .../Messenger/Transport/AmqpExt/AmqpTransportFactory.php | 2 ++ .../Messenger/Transport/Doctrine/DoctrineTransportFactory.php | 1 + .../Messenger/Transport/RedisExt/RedisTransportFactory.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransportFactory.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransportFactory.php index 35cb4eb1c4e98..8f209a9db4bb0 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransportFactory.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransportFactory.php @@ -24,6 +24,8 @@ class AmqpTransportFactory implements TransportFactoryInterface { public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface { + unset($options['transport_name']); + return new AmqpTransport(Connection::fromDsn($dsn, $options), $serializer); } diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php b/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php index 3f9aa7981ab1b..959a4ec7a2c3b 100644 --- a/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php +++ b/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php @@ -33,6 +33,7 @@ public function __construct(RegistryInterface $registry) public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface { + unset($options['transport_name']); $configuration = Connection::buildConfiguration($dsn, $options); try { diff --git a/src/Symfony/Component/Messenger/Transport/RedisExt/RedisTransportFactory.php b/src/Symfony/Component/Messenger/Transport/RedisExt/RedisTransportFactory.php index acb2d1f59160c..45e4b8b144973 100644 --- a/src/Symfony/Component/Messenger/Transport/RedisExt/RedisTransportFactory.php +++ b/src/Symfony/Component/Messenger/Transport/RedisExt/RedisTransportFactory.php @@ -25,6 +25,8 @@ class RedisTransportFactory implements TransportFactoryInterface { public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface { + unset($options['transport_name']); + return new RedisTransport(Connection::fromDsn($dsn, $options), $serializer); } From 3a354321c8fbc60bdb0c09bfe423b22fadbb137c Mon Sep 17 00:00:00 2001 From: Konstantin Myakshin Date: Fri, 19 Jul 2019 01:33:46 +0300 Subject: [PATCH 128/167] [Mime] Add missing changelog entry for BC-break --- src/Symfony/Component/Mime/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/Symfony/Component/Mime/CHANGELOG.md diff --git a/src/Symfony/Component/Mime/CHANGELOG.md b/src/Symfony/Component/Mime/CHANGELOG.md new file mode 100644 index 0000000000000..796cfdd155626 --- /dev/null +++ b/src/Symfony/Component/Mime/CHANGELOG.md @@ -0,0 +1,12 @@ +CHANGELOG +========= + +4.3.3 +----- + + * [BC BREAK] Renamed method `Headers::getAll()` to `Headers::all()`. + +4.3.0 +----- + + * Introduced the component as experimental From a1fb54d900ad6ae743c4d878aefc7f1e8b4f83ab Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 19 Jul 2019 18:29:19 +0200 Subject: [PATCH 129/167] Remove more dead tests fixtures --- .../Compiler/FormPassTest.php | 9 -------- .../DependencyInjection/FormPassTest.php | 9 -------- .../Tests/PropertyAccessorCollectionTest.php | 22 ------------------- 3 files changed, 40 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php index 95423c2601b97..b5e3c9f241cfb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @@ -16,7 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Form\AbstractType; /** * @group legacy @@ -214,11 +213,3 @@ public function privateTaggedServicesProvider() ]; } } - -class FormPassTest_Type1 extends AbstractType -{ -} - -class FormPassTest_Type2 extends AbstractType -{ -} diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php index a23607412cc8d..1e756ac5cfe22 100644 --- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php +++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php @@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Command\DebugCommand; use Symfony\Component\Form\DependencyInjection\FormPass; use Symfony\Component\Form\FormRegistry; @@ -272,11 +271,3 @@ private function createContainerBuilder() return $container; } } - -class FormPassTest_Type1 extends AbstractType -{ -} - -class FormPassTest_Type2 extends AbstractType -{ -} diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index b91d1e62ebb95..113144f2bfe74 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -43,28 +43,6 @@ public function getAxes() } } -class PropertyAccessorCollectionTest_CarOnlyAdder -{ - public function addAxis($axis) - { - } - - public function getAxes() - { - } -} - -class PropertyAccessorCollectionTest_CarOnlyRemover -{ - public function removeAxis($axis) - { - } - - public function getAxes() - { - } -} - class PropertyAccessorCollectionTest_CarNoAdderAndRemover { public function getAxes() From 162819fef366d9d466171ee7b5fc1850c29534f1 Mon Sep 17 00:00:00 2001 From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com> Date: Sun, 21 Jul 2019 16:03:23 +0430 Subject: [PATCH 130/167] Avoid getting right to left style --- .../WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 8953316de06f2..4012625e85d15 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -54,6 +54,7 @@ text-align: left; text-transform: none; z-index: 99999; + direction: ltr; /* neutralize the aliasing defined by external CSS styles */ -webkit-font-smoothing: subpixel-antialiased; From 016a214bc5e136b205ffec90f7ea02672e32ba01 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Sun, 21 Jul 2019 19:35:01 +0200 Subject: [PATCH 131/167] Remove dead tests fixtures --- .../Controller/DefaultController.php | 21 ---------- .../Fabpot/FooBundle/FabpotFooBundle.php | 30 ------------- .../Compiler/AddSecurityVotersPassTest.php | 7 ---- .../ExtensionAbsentBundle.php | 18 -------- .../Command/FooCommand.php | 22 ---------- .../DependencyInjection/MessengerPassTest.php | 8 ---- .../Tests/Fixtures/Php71DummyChild.php | 42 ------------------- .../Controller/UserValueResolverTest.php | 8 ---- 8 files changed, 156 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/Controller/DefaultController.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/FabpotFooBundle.php delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php delete mode 100644 src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php delete mode 100644 src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php71DummyChild.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/Controller/DefaultController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/Controller/DefaultController.php deleted file mode 100644 index c4bee6c031c89..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/Controller/DefaultController.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace TestBundle\Fabpot\FooBundle\Controller; - -/** - * DefaultController. - * - * @author Fabien Potencier - */ -class DefaultController -{ -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/FabpotFooBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/FabpotFooBundle.php deleted file mode 100644 index 17894ba34146b..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Fabpot/FooBundle/FabpotFooBundle.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace TestBundle\Fabpot\FooBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -/** - * Bundle. - * - * @author Fabien Potencier - */ -class FabpotFooBundle extends Bundle -{ - /** - * {@inheritdoc} - */ - public function getParent() - { - return 'SensioFooBundle'; - } -} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php index 93d412155385f..2b8809fe2a202 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php @@ -148,10 +148,3 @@ public function testVoterMissingInterface() $compilerPass->process($container); } } - -class VoterWithoutInterface -{ - public function vote() - { - } -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php deleted file mode 100644 index c8bfd36e662f5..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionAbsentBundle extends Bundle -{ -} diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php deleted file mode 100644 index c6570aa046c55..0000000000000 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command; - -use Symfony\Component\Console\Command\Command; - -class FooCommand extends Command -{ - protected function configure() - { - $this->setName('foo'); - } -} diff --git a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php index b484bc3abe98d..171c263128f1e 100644 --- a/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php +++ b/src/Symfony/Component/Messenger/Tests/DependencyInjection/MessengerPassTest.php @@ -605,14 +605,6 @@ public function stop(): void } } -class InvalidReceiver -{ -} - -class InvalidSender -{ -} - class UndefinedMessageHandler { public function __invoke(UndefinedMessage $message) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php71DummyChild.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php71DummyChild.php deleted file mode 100644 index be26a53220dcb..0000000000000 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php71DummyChild.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\PropertyInfo\Tests\Fixtures; - -class Php71DummyParent -{ - public $string; - - public function __construct(string $string) - { - $this->string = $string; - } -} - -class Php71DummyChild extends Php71DummyParent -{ - public function __construct(string $string) - { - parent::__construct($string); - } -} - -class Php71DummyChild2 extends Php71DummyParent -{ -} - -class Php71DummyChild3 extends Php71DummyParent -{ - public function __construct() - { - parent::__construct('hello'); - } -} diff --git a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php index 25108e482d287..5376583a15255 100644 --- a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php @@ -91,11 +91,3 @@ public function testIntegrationNoUser() $this->assertSame([null], $argumentResolver->getArguments(Request::create('/'), function (UserInterface $user = null) {})); } } - -abstract class DummyUser implements UserInterface -{ -} - -abstract class DummySubUser extends DummyUser -{ -} From 5a14b7e039ade7b1cff2a8a7ca7c56b2eabf106e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 22 Jul 2019 19:05:35 +0200 Subject: [PATCH 132/167] [Security/Http] Don't mark AbstractAuthenticationListener as internal --- .../Security/Http/Firewall/AbstractAuthenticationListener.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 58e188cc4c567..6b358990733b3 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -48,8 +48,6 @@ * * @author Fabien Potencier * @author Johannes M. Schmitt - * - * @internal since Symfony 4.3 */ abstract class AbstractAuthenticationListener implements ListenerInterface { From 19eb90d8cfeacb94730333a9d0b6caac49b49962 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 22 Jul 2019 21:22:05 +0200 Subject: [PATCH 133/167] Ignore missing translation dependency in FrameworkBundle When using symfony/framework-bundle with symfony/validator installed but without symfony/translation, the call to setTranslator will error out because of the missing translator service. Thus, the call to setTranslator needs to ignore a missing translator dependency to support this scenario. --- .../Bundle/FrameworkBundle/Resources/config/validator.xml | 2 +- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index 8b92053b362e5..8a4265eea1d2b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -23,7 +23,7 @@ - + %validator.translation_domain% diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index c114f38177bec..9ffb13232f14a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -674,7 +674,7 @@ public function testValidation() $this->assertSame('setConstraintValidatorFactory', $calls[0][0]); $this->assertEquals([new Reference('validator.validator_factory')], $calls[0][1]); $this->assertSame('setTranslator', $calls[1][0]); - $this->assertEquals([new Reference('translator')], $calls[1][1]); + $this->assertEquals([new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)], $calls[1][1]); $this->assertSame('setTranslationDomain', $calls[2][0]); $this->assertSame(['%validator.translation_domain%'], $calls[2][1]); $this->assertSame('addXmlMappings', $calls[3][0]); From e99a6b85b844bd8daf08837c0dfc7588f508d709 Mon Sep 17 00:00:00 2001 From: Dorel Mardari Date: Sun, 28 Apr 2019 12:19:02 +0200 Subject: [PATCH 134/167] [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) --- .../Component/VarDumper/Cloner/VarCloner.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 9e50f23501154..ab44a8d76bfe4 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -42,7 +42,7 @@ protected function doClone($var) $currentDepth = 0; // Current tree depth $currentDepthFinalIndex = 0; // Final $queue index for current tree depth $minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached - $cookie = (object) []; // Unique object used to detect hard references + $cookie = (object) []; // Unique object used to detect hard references $a = null; // Array cast for nested structures $stub = null; // Stub capturing the main properties of an original item value // or null if the original value is used directly @@ -86,8 +86,15 @@ protected function doClone($var) } foreach ($vals as $k => $v) { // $v is the original value or a stub object in case of hard references - $refs[$k] = $cookie; - if ($zvalIsRef = $vals[$k] === $cookie) { + + if (\PHP_VERSION_ID >= 70400) { + $zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k); + } else { + $refs[$k] = $cookie; + $zvalIsRef = $vals[$k] === $cookie; + } + + if ($zvalIsRef) { $vals[$k] = &$stub; // Break hard references to make $queue completely unset($stub); // independent from the original structure if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) { From 40f24ef676cf568694549f957b92f7acfaace60a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 22 Jul 2019 09:38:31 +0200 Subject: [PATCH 135/167] [VarDumper] finish PHP 7.4 support and add tests --- .../Component/VarDumper/Caster/Caster.php | 4 +- .../Component/VarDumper/Cloner/Stub.php | 12 +++- .../VarDumper/Tests/Cloner/VarClonerTest.php | 68 +++++++++++++++++++ .../VarDumper/Tests/Fixtures/Php74.php | 14 ++++ 4 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index ae8b40fa0eacd..c1f38eb4a81e4 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -68,8 +68,8 @@ public static function castObject($obj, $class, $hasDebugInfo = false) foreach ($a as $k => $v) { if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) { if (!isset($publicProperties[$class])) { - foreach (get_class_vars($class) as $prop => $v) { - $publicProperties[$class][$prop] = true; + foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { + $publicProperties[$class][$prop->name] = true; } } if (!isset($publicProperties[$class][$k])) { diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 27dd3ef32c4df..19f111f47845e 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -49,11 +49,17 @@ public function __sleep() $properties = []; if (!isset(self::$defaultProperties[$c = \get_class($this)])) { - self::$defaultProperties[$c] = get_class_vars($c); + $defaultProperties = get_class_vars($c); - foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) { - unset(self::$defaultProperties[$c][$k]); + foreach ((new \ReflectionClass($c))->getProperties(\ReflectionProperty::IS_PUBLIC) as $v) { + if ($v->isStatic()) { + unset($defaultProperties[$v->name]); + } elseif (!isset($defaultProperties[$v->name])) { + $defaultProperties[$v->name] = null; + } } + + self::$defaultProperties[$c] = $defaultProperties; } foreach (self::$defaultProperties[$c] as $k => $v) { diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php index 3b180af49810d..f6784be498623 100644 --- a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Tests\Fixtures\Php74; /** * @author Nicolas Grekas @@ -431,6 +432,73 @@ public function testCaster() [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 ) +EOTXT; + $this->assertStringMatchesFormat($expected, print_r($clone, true)); + } + + /** + * @requires PHP 7.4 + */ + public function testPhp74() + { + $data = new Php74(); + + $cloner = new VarCloner(); + $clone = $cloner->cloneVar($data); + + $expected = <<<'EOTXT' +Symfony\Component\VarDumper\Cloner\Data Object +( + [data:Symfony\Component\VarDumper\Cloner\Data:private] => Array + ( + [0] => Array + ( + [0] => Symfony\Component\VarDumper\Cloner\Stub Object + ( + [type] => 4 + [class] => Symfony\Component\VarDumper\Tests\Fixtures\Php74 + [value] => + [cut] => 0 + [handle] => %i + [refCount] => 0 + [position] => 1 + [attr] => Array + ( + ) + + ) + + ) + + [1] => Array + ( + [p1] => 123 + [p2] => Symfony\Component\VarDumper\Cloner\Stub Object + ( + [type] => 4 + [class] => stdClass + [value] => + [cut] => 0 + [handle] => %i + [refCount] => 0 + [position] => 0 + [attr] => Array + ( + ) + + ) + + ) + + ) + + [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 + [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 + [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 + [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 + [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 +) + EOTXT; $this->assertStringMatchesFormat($expected, print_r($clone, true)); } diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php new file mode 100644 index 0000000000000..724fbeb7bdb6e --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/Php74.php @@ -0,0 +1,14 @@ +p2 = new \stdClass(); + } +} From be53c593dca3f69760d80cb0bf3d01994a65e27b Mon Sep 17 00:00:00 2001 From: Arman Hosseini <44655055+Arman-Hosseini@users.noreply.github.com> Date: Fri, 19 Jul 2019 23:09:57 +0430 Subject: [PATCH 136/167] [HttpFoundation] Fix URLs --- .../Session/Storage/Handler/MongoDbSessionHandler.php | 2 +- .../Session/Storage/Handler/NativeFileSessionHandler.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 3b5ccaa835952..ddedacffbce4e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -17,7 +17,7 @@ * @author Markus Bachmann * * @see https://packagist.org/packages/mongodb/mongodb - * @see http://php.net/manual/en/set.mongodb.php + * @see https://php.net/mongodb */ class MongoDbSessionHandler extends AbstractSessionHandler { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php index 4e9704bd5858f..04bcbbfe320b3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -23,7 +23,7 @@ class NativeFileSessionHandler extends NativeSessionHandler * Default null will leave setting as defined by PHP. * '/path', 'N;/path', or 'N;octal-mode;/path * - * @see http://php.net/session.configuration.php#ini.session.save-path for further details. + * @see https://php.net/manual/session.configuration.php#ini.session.save-path for further details. * * @throws \InvalidArgumentException On invalid $savePath * @throws \RuntimeException When failing to create the save directory From 172792308699cf05af2ecb732b237279e3a2c9d0 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 22 Jul 2019 13:03:51 +0200 Subject: [PATCH 137/167] Clarify deprecations for framework.templating --- UPGRADE-4.3.md | 2 +- UPGRADE-5.0.md | 2 +- src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 2 +- .../FrameworkBundle/DependencyInjection/Configuration.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index b85e09dadc320..74357470f1990 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -77,7 +77,7 @@ Form FrameworkBundle --------------- - * Deprecated the `framework.templating` option, use Twig instead. + * Deprecated the `framework.templating` option, configure the Twig bundle instead. * Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will be mandatory in 5.0. * Deprecated the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead. diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 6e7bb0a73641d..1cccc89664e8b 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -169,7 +169,7 @@ Form FrameworkBundle --------------- - * Removed the `framework.templating` option, use Twig instead. + * Removed the `framework.templating` option, configure the Twig bundle instead. * The project dir argument of the constructor of `AssetsInstallCommand` is required. * Removed support for `bundle:controller:action` syntax to reference controllers. Use `serviceOrFqcn::method` instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller. diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index d8c07db3fc138..56be7f877781b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -4,7 +4,7 @@ CHANGELOG 4.3.0 ----- - * Deprecated the `framework.templating` option, use Twig instead. + * Deprecated the `framework.templating` option, configure the Twig bundle instead. * Added `WebTestAssertionsTrait` (included by default in `WebTestCase`) * Renamed `Client` to `KernelBrowser` * Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 7465e2d9ee0c4..488d56aac09c6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -608,7 +608,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode) ->arrayNode('templating') ->info('templating configuration') ->canBeEnabled() - ->setDeprecated('The "%path%.%node%" configuration is deprecated since Symfony 4.3. Use the "twig" service directly instead.') + ->setDeprecated('The "%path%.%node%" configuration is deprecated since Symfony 4.3. Configure the "twig" section provided by the Twig Bundle instead.') ->beforeNormalization() ->ifTrue(function ($v) { return false === $v || \is_array($v) && false === $v['enabled']; }) ->then(function () { return ['enabled' => false, 'engines' => false]; }) From 9bad90578ae21b7f7b7be914df9250a75f913556 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 Jul 2019 10:15:01 +0200 Subject: [PATCH 138/167] revert private properties handling --- src/Symfony/Component/VarDumper/Cloner/Stub.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 19f111f47845e..27dd3ef32c4df 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -49,17 +49,11 @@ public function __sleep() $properties = []; if (!isset(self::$defaultProperties[$c = \get_class($this)])) { - $defaultProperties = get_class_vars($c); + self::$defaultProperties[$c] = get_class_vars($c); - foreach ((new \ReflectionClass($c))->getProperties(\ReflectionProperty::IS_PUBLIC) as $v) { - if ($v->isStatic()) { - unset($defaultProperties[$v->name]); - } elseif (!isset($defaultProperties[$v->name])) { - $defaultProperties[$v->name] = null; - } + foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) { + unset(self::$defaultProperties[$c][$k]); } - - self::$defaultProperties[$c] = $defaultProperties; } foreach (self::$defaultProperties[$c] as $k => $v) { From 775d970927ef26adf36bc1e570b95687f205c534 Mon Sep 17 00:00:00 2001 From: Jan van Thoor Date: Fri, 19 Jul 2019 15:02:52 +0200 Subject: [PATCH 139/167] [FrameworkBundle] [SecurityBundle] Rename internal WebTestCase to avoid confusion --- src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php | 4 ++-- .../Functional/{WebTestCase.php => AbstractWebTestCase.php} | 2 +- .../Tests/Functional/AnnotatedControllerTest.php | 2 +- .../FrameworkBundle/Tests/Functional/AutowiringTypesTest.php | 2 +- .../Tests/Functional/CachePoolClearCommandTest.php | 2 +- .../FrameworkBundle/Tests/Functional/CachePoolsTest.php | 2 +- .../Tests/Functional/ConfigDebugCommandTest.php | 2 +- .../Tests/Functional/ConfigDumpReferenceCommandTest.php | 2 +- .../Tests/Functional/ContainerDebugCommandTest.php | 2 +- .../FrameworkBundle/Tests/Functional/ContainerDumpTest.php | 2 +- .../Tests/Functional/DebugAutowiringCommandTest.php | 2 +- .../Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php | 2 +- .../Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php | 2 +- .../FrameworkBundle/Tests/Functional/PropertyInfoTest.php | 2 +- .../FrameworkBundle/Tests/Functional/SerializerTest.php | 2 +- .../Bundle/FrameworkBundle/Tests/Functional/SessionTest.php | 2 +- .../FrameworkBundle/Tests/Functional/SubRequestsTest.php | 2 +- .../Functional/{WebTestCase.php => AbstractWebTestCase.php} | 2 +- .../Tests/Functional/AuthenticationCommencingTest.php | 2 +- .../SecurityBundle/Tests/Functional/AutowiringTypesTest.php | 2 +- .../SecurityBundle/Tests/Functional/CsrfFormLoginTest.php | 2 +- .../Tests/Functional/FirewallEntryPointTest.php | 2 +- .../Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php | 2 +- .../Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php | 2 +- .../Tests/Functional/LocalizedRoutesAsPathTest.php | 2 +- .../Bundle/SecurityBundle/Tests/Functional/LogoutTest.php | 2 +- .../Tests/Functional/SecurityRoutingIntegrationTest.php | 2 +- .../Bundle/SecurityBundle/Tests/Functional/SecurityTest.php | 2 +- .../SecurityBundle/Tests/Functional/SetAclCommandTest.php | 2 +- .../Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php | 2 +- .../Tests/Functional/UserPasswordEncoderCommandTest.php | 2 +- 31 files changed, 32 insertions(+), 32 deletions(-) rename src/Symfony/Bundle/FrameworkBundle/Tests/Functional/{WebTestCase.php => AbstractWebTestCase.php} (97%) rename src/Symfony/Bundle/SecurityBundle/Tests/Functional/{WebTestCase.php => AbstractWebTestCase.php} (97%) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php index ba253d1d1f511..3ff7daac5e608 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/ClientTest.php @@ -12,10 +12,10 @@ namespace Symfony\Bundle\FrameworkBundle\Tests; use Symfony\Bundle\FrameworkBundle\Client; -use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase; +use Symfony\Bundle\FrameworkBundle\Tests\Functional\AbstractWebTestCase; use Symfony\Component\HttpFoundation\Response; -class ClientTest extends WebTestCase +class ClientTest extends AbstractWebTestCase { public function testRebootKernelBetweenRequests() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php similarity index 97% rename from src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php rename to src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php index 00eda6570906d..03c6bdcbd7e11 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php @@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; -class WebTestCase extends BaseWebTestCase +abstract class AbstractWebTestCase extends BaseWebTestCase { public static function assertRedirect($response, $location) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php index 51a3e7ee54247..c9ede7a9cf646 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class AnnotatedControllerTest extends WebTestCase +class AnnotatedControllerTest extends AbstractWebTestCase { /** * @dataProvider getRoutes diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php index 1db447ac64d68..95fb5f938f0e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php @@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface; -class AutowiringTypesTest extends WebTestCase +class AutowiringTypesTest extends AbstractWebTestCase { public function testAnnotationReaderAutowiring() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php index e3fd2dc4ab346..e30a0e1eeafb1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php @@ -18,7 +18,7 @@ /** * @group functional */ -class CachePoolClearCommandTest extends WebTestCase +class CachePoolClearCommandTest extends AbstractWebTestCase { protected function setUp() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index 2a6d43a9f806e..ebf6561a6156d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Exception\InvalidArgumentException; -class CachePoolsTest extends WebTestCase +class CachePoolsTest extends AbstractWebTestCase { public function testCachePools() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php index 2c0a75481b390..c10750eaa9352 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php @@ -19,7 +19,7 @@ /** * @group functional */ -class ConfigDebugCommandTest extends WebTestCase +class ConfigDebugCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php index a4cfd6cfa9b7d..b8ac6645f6fac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php @@ -19,7 +19,7 @@ /** * @group functional */ -class ConfigDumpReferenceCommandTest extends WebTestCase +class ConfigDumpReferenceCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index bfec01aefc876..21f33df0c8a22 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class ContainerDebugCommandTest extends WebTestCase +class ContainerDebugCommandTest extends AbstractWebTestCase { public function testDumpContainerIfNotExists() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php index 7c3128dc5c07d..ad2a3662c3cdd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDumpTest.php @@ -14,7 +14,7 @@ /** * Checks that the container compiles correctly when all the bundle features are enabled. */ -class ContainerDumpTest extends WebTestCase +class ContainerDumpTest extends AbstractWebTestCase { public function testContainerCompilationInDebug() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index 7e41d3298d9c2..8e55eb5d84599 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class DebugAutowiringCommandTest extends WebTestCase +class DebugAutowiringCommandTest extends AbstractWebTestCase { public function testBasicFunctionality() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php index db550a23129ba..3e7472af999a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/FragmentTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class FragmentTest extends WebTestCase +class FragmentTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php index 2768b59a1c3f5..ec3c47e76205c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class ProfilerTest extends WebTestCase +class ProfilerTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php index 832b45b818f76..23a9cf18d0384 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -13,7 +13,7 @@ use Symfony\Component\PropertyInfo\Type; -class PropertyInfoTest extends WebTestCase +class PropertyInfoTest extends AbstractWebTestCase { public function testPhpDocPriority() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php index c2c53ef7b0dc6..c1159ff5669d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php @@ -14,7 +14,7 @@ /** * @author Kévin Dunglas */ -class SerializerTest extends WebTestCase +class SerializerTest extends AbstractWebTestCase { public function testDeserializeArrayOfObject() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php index bf1b76cdc743c..0fa8a09b4b229 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class SessionTest extends WebTestCase +class SessionTest extends AbstractWebTestCase { /** * Tests session attributes persist. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php index 9d040581db50f..d32b6b7b121c5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -class SubRequestsTest extends WebTestCase +class SubRequestsTest extends AbstractWebTestCase { public function testStateAfterSubRequest() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php similarity index 97% rename from src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php rename to src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php index 9bcbc0532481d..72a67a9a48763 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php @@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; -class WebTestCase extends BaseWebTestCase +class AbstractWebTestCase extends BaseWebTestCase { public static function assertRedirect($response, $location) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php index 2a31f2a27a5f2..dcfd6f29e8fea 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class AuthenticationCommencingTest extends WebTestCase +class AuthenticationCommencingTest extends AbstractWebTestCase { public function testAuthenticationIsCommencingIfAccessDeniedExceptionIsWrapped() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php index 95b86985cb6e7..1e4b14a61b9fb 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; -class AutowiringTypesTest extends WebTestCase +class AutowiringTypesTest extends AbstractWebTestCase { public function testAccessDecisionManagerAutowiring() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php index 98b52a5f05058..a701c8e4ea1b0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class CsrfFormLoginTest extends WebTestCase +class CsrfFormLoginTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php index 8afedc42e44d3..77011409cfaa4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php @@ -13,7 +13,7 @@ use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub; -class FirewallEntryPointTest extends WebTestCase +class FirewallEntryPointTest extends AbstractWebTestCase { public function testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php index ec1722188af25..af932a3ce42b3 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class FormLoginTest extends WebTestCase +class FormLoginTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php index c7e9e2aab71b1..2859693a17c28 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php @@ -16,7 +16,7 @@ /** * @author Kévin Dunglas */ -class JsonLoginTest extends WebTestCase +class JsonLoginTest extends AbstractWebTestCase { public function testDefaultJsonLoginSuccess() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php index c874ada34a4e3..2a45fc00de38f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class LocalizedRoutesAsPathTest extends WebTestCase +class LocalizedRoutesAsPathTest extends AbstractWebTestCase { /** * @dataProvider getLocales diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php index 31ff6d1bbc7da..7167b062da7ca 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class LogoutTest extends WebTestCase +class LogoutTest extends AbstractWebTestCase { public function testSessionLessRememberMeLogout() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php index 0d2d6da0cfc51..590c871569c3a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class SecurityRoutingIntegrationTest extends WebTestCase +class SecurityRoutingIntegrationTest extends AbstractWebTestCase { /** * @dataProvider getConfigs diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php index ff687d0792716..eb83e75d8cc64 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\User\User; -class SecurityTest extends WebTestCase +class SecurityTest extends AbstractWebTestCase { public function testServiceIsFunctional() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php index 2035868e16ca4..5346e9b4c0be7 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php @@ -35,7 +35,7 @@ * @requires extension pdo_sqlite * @group legacy */ -class SetAclCommandTest extends WebTestCase +class SetAclCommandTest extends AbstractWebTestCase { const OBJECT_CLASS = 'Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AclBundle\Entity\Car'; const SECURITY_CLASS = 'Symfony\Component\Security\Core\User\User'; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php index ddbfd629c8fb7..31f99da2a08f2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Http\Firewall\SwitchUserListener; -class SwitchUserTest extends WebTestCase +class SwitchUserTest extends AbstractWebTestCase { /** * @dataProvider getTestParameters diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php index c8f8013f3f8a0..3533f554baa1e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -25,7 +25,7 @@ * * @author Sarah Khalil */ -class UserPasswordEncoderCommandTest extends WebTestCase +class UserPasswordEncoderCommandTest extends AbstractWebTestCase { /** @var CommandTester */ private $passwordEncoderCommandTester; From 12bf0b07f82a76d2f107cf06ba6e10f6f3efe68f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 Jul 2019 13:15:07 +0200 Subject: [PATCH 140/167] ignore not existing translator service --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index a41555fde4b15..fca90e76cf953 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1122,7 +1122,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder if (interface_exists(TranslatorInterface::class) && class_exists(LegacyTranslatorProxy::class)) { $calls = $validatorBuilder->getMethodCalls(); - $calls[1] = ['setTranslator', [new Definition(LegacyTranslatorProxy::class, [new Reference('translator')])]]; + $calls[1] = ['setTranslator', [new Definition(LegacyTranslatorProxy::class, [new Reference('translator', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)])]]; $validatorBuilder->setMethodCalls($calls); } From 01aaece8d8a8ea02c5c161ee5ac131d41a8d3fb4 Mon Sep 17 00:00:00 2001 From: Jan van Thoor Date: Fri, 19 Jul 2019 15:53:13 +0200 Subject: [PATCH 141/167] [FrameworkBundle] [SecurityBundle] Rename internal WebTestCase to avoid confusion --- .../FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php | 2 +- .../Tests/Functional/TestServiceContainerTest.php | 2 +- .../SecurityBundle/Tests/Functional/AbstractWebTestCase.php | 2 +- .../SecurityBundle/Tests/Functional/JsonLoginLdapTest.php | 2 +- .../SecurityBundle/Tests/Functional/MissingUserProviderTest.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php index 73f84f842f83f..a13a4e9fc99a9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class RouterDebugCommandTest extends WebTestCase +class RouterDebugCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TestServiceContainerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TestServiceContainerTest.php index baa12ab2d1675..bf4f9f8779f44 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TestServiceContainerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TestServiceContainerTest.php @@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\UnusedPrivateService; use Symfony\Component\DependencyInjection\ContainerInterface; -class TestServiceContainerTest extends WebTestCase +class TestServiceContainerTest extends AbstractWebTestCase { public function testThatPrivateServicesAreUnavailableIfTestConfigIsDisabled() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php index 72a67a9a48763..678c937f7d422 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php @@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; -class AbstractWebTestCase extends BaseWebTestCase +abstract class AbstractWebTestCase extends BaseWebTestCase { public static function assertRedirect($response, $location) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginLdapTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginLdapTest.php index 6b7dca4b422f2..583e153695fed 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginLdapTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginLdapTest.php @@ -13,7 +13,7 @@ use Symfony\Component\HttpKernel\Kernel; -class JsonLoginLdapTest extends WebTestCase +class JsonLoginLdapTest extends AbstractWebTestCase { public function testKernelBoot() { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php index 378ff26b381e4..d645f97f5b2d2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/MissingUserProviderTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; -class MissingUserProviderTest extends WebTestCase +class MissingUserProviderTest extends AbstractWebTestCase { /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException From e6bf65025461515f70f64835524f739863da6b3b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jul 2019 13:55:45 +0200 Subject: [PATCH 142/167] fix merge --- .../Tests/Functional/CachePoolListCommandTest.php | 2 +- .../Tests/Functional/TranslationDebugCommandTest.php | 2 +- src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php index 15e7994e46002..e9b8ed5e34ee8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php @@ -18,7 +18,7 @@ /** * @group functional */ -class CachePoolListCommandTest extends WebTestCase +class CachePoolListCommandTest extends AbstractWebTestCase { protected function setUp() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php index 1da49ce79c8f6..de4c293c09280 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php @@ -17,7 +17,7 @@ /** * @group functional */ -class TranslationDebugCommandTest extends WebTestCase +class TranslationDebugCommandTest extends AbstractWebTestCase { private $application; diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php index 152bd338614a0..91286990929d2 100644 --- a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php @@ -50,7 +50,7 @@ public function testMaxIntBoundary() [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 + [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 21 [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 ) From 0cd17d2e905496abbcf1987cca5605bfed0f12dd Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jul 2019 14:04:16 +0200 Subject: [PATCH 143/167] fix typo --- .../Component/VarDumper/Tests/Cloner/VarClonerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php index 91286990929d2..9c84f898bbe0e 100644 --- a/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php @@ -50,7 +50,7 @@ public function testMaxIntBoundary() [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0 - [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 21 + [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20 [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1 [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1 ) @@ -413,7 +413,7 @@ public function testCaster() [attr] => Array ( [file] => %a%eVarClonerTest.php - [line] => 20 + [line] => 21 ) ) From 7d0793a94430ae83e67dae8fdf310bde61d2ed73 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 Jul 2019 14:07:40 +0200 Subject: [PATCH 144/167] relax some date parser patterns --- .../Intl/DateFormatter/DateFormat/DayTransformer.php | 2 +- .../DateFormatter/DateFormat/MonthTransformer.php | 2 +- .../Intl/DateFormatter/DateFormat/YearTransformer.php | 2 +- .../DateFormatter/AbstractIntlDateFormatterTest.php | 2 ++ .../Tests/DateFormatter/IntlDateFormatterTest.php | 11 +++++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php index c07855df1c8de..8e805baff8608 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/DayTransformer.php @@ -33,7 +33,7 @@ public function format(\DateTime $dateTime, $length) */ public function getReverseMatchingRegExp($length) { - return 1 === $length ? '\d{1,2}' : '\d{'.$length.'}'; + return 1 === $length ? '\d{1,2}' : '\d{1,'.$length.'}'; } /** diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php index 40ab1d67d7290..04be7858c241f 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php @@ -104,7 +104,7 @@ public function getReverseMatchingRegExp($length) $regExp = '[JFMASOND]'; break; default: - $regExp = '\d{'.$length.'}'; + $regExp = '\d{1,'.$length.'}'; break; } diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/YearTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/YearTransformer.php index 043e6f321c2f9..a892c664af59d 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/YearTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/YearTransformer.php @@ -37,7 +37,7 @@ public function format(\DateTime $dateTime, $length) */ public function getReverseMatchingRegExp($length) { - return 2 === $length ? '\d{2}' : '\d{4}'; + return 2 === $length ? '\d{2}' : '\d{1,4}'; } /** diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index a1ade6a42b55e..e472000974a6f 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -618,6 +618,7 @@ public function parseMonthProvider() { return [ ['y-M-d', '1970-1-1', 0], + ['y-MM-d', '1970-1-1', 0], ['y-MMM-d', '1970-Jan-1', 0], ['y-MMMM-d', '1970-January-1', 0], ]; @@ -636,6 +637,7 @@ public function parseDayProvider() { return [ ['y-M-d', '1970-1-1', 0], + ['y-M-dd', '1970-1-1', 0], ['y-M-dd', '1970-1-01', 0], ['y-M-ddd', '1970-1-001', 0], ]; diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 03c69d27c4930..29f8918be8b7f 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -183,6 +183,17 @@ public function parseQuarterProvider() return $this->notImplemented(parent::parseQuarterProvider()); } + public function testParseThreeDigitsYears() + { + if (PHP_INT_SIZE < 8) { + $this->markTestSkipped('Parsing three digits years requires a 64bit PHP.'); + } + + $formatter = $this->getDefaultDateFormatter('yyyy-M-d'); + $this->assertSame(-32157648000, $formatter->parse('950-12-19')); + $this->assertIsIntlSuccess($formatter, 'U_ZERO_ERROR', IntlGlobals::U_ZERO_ERROR); + } + protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) { return new IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern); From 8b1d6cd1f03b62efc7c1256a517d964ce7f81fa2 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 23 Jul 2019 16:43:56 +0200 Subject: [PATCH 145/167] [Routing] Fix CHANGELOG --- src/Symfony/Component/Routing/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Routing/CHANGELOG.md b/src/Symfony/Component/Routing/CHANGELOG.md index 05ae44b5f110c..5f133efd6ef9c 100644 --- a/src/Symfony/Component/Routing/CHANGELOG.md +++ b/src/Symfony/Component/Routing/CHANGELOG.md @@ -12,7 +12,7 @@ CHANGELOG Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible with the new serialization methods in PHP 7.4. * exposed `utf8` Route option, defaults "locale" and "format" in configuration loaders and configurators - * added support for invokable route loader services + * added support for invokable service route loaders 4.2.0 ----- From 653f46c7257d62e458d895f6c2cce30504b42772 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 23 Jul 2019 16:59:17 +0200 Subject: [PATCH 146/167] [4.3] Remove dead test fixtures --- .../Tests/Normalizer/AbstractObjectNormalizerTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index a3586152b4865..af60cb99dcefe 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -380,7 +380,3 @@ public function setSerializer(SerializerInterface $serializer) $this->serializer = $serializer; } } - -abstract class ObjectSerializerDenormalizer implements SerializerInterface, DenormalizerInterface -{ -} From 84b3359adcf741286b981196314b9164d99db9eb Mon Sep 17 00:00:00 2001 From: George Bateman Date: Tue, 23 Jul 2019 19:56:59 +0100 Subject: [PATCH 147/167] Typo in web profiler --- .../WebProfilerBundle/Resources/views/Collector/form.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 720da85750526..c7b99d2e4263c 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -646,7 +646,7 @@ {% else %}
-

No options where passed when constructing this form.

+

No options were passed when constructing this form.

{% endif %} From 7f4362bd464ff65d7f6d542726c541534e20059b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jul 2019 20:48:28 +0200 Subject: [PATCH 148/167] [HttpClient] rewind stream when using Psr18Client --- src/Symfony/Component/HttpClient/Psr18Client.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpClient/Psr18Client.php b/src/Symfony/Component/HttpClient/Psr18Client.php index a438b7ce94ee4..9ec7a0849028b 100644 --- a/src/Symfony/Component/HttpClient/Psr18Client.php +++ b/src/Symfony/Component/HttpClient/Psr18Client.php @@ -65,9 +65,15 @@ public function __construct(HttpClientInterface $client = null, ResponseFactoryI public function sendRequest(RequestInterface $request): ResponseInterface { try { + $body = $request->getBody(); + + if ($body->isSeekable()) { + $body->seek(0); + } + $response = $this->client->request($request->getMethod(), (string) $request->getUri(), [ 'headers' => $request->getHeaders(), - 'body' => (string) $request->getBody(), + 'body' => $body->getContents(), 'http_version' => '1.0' === $request->getProtocolVersion() ? '1.0' : null, ]); @@ -79,7 +85,13 @@ public function sendRequest(RequestInterface $request): ResponseInterface } } - return $psrResponse->withBody($this->streamFactory->createStream($response->getContent(false))); + $body = $this->streamFactory->createStream($response->getContent(false)); + + if ($body->isSeekable()) { + $body->seek(0); + } + + return $psrResponse->withBody($body); } catch (TransportExceptionInterface $e) { if ($e instanceof \InvalidArgumentException) { throw new Psr18RequestException($e, $request); From a310bac624bcc6e32a651e9b677ba1b75947fb6c Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Tue, 23 Jul 2019 20:59:18 +0200 Subject: [PATCH 149/167] [PropertyAccess] Fix PropertyAccessorCollectionTest --- .../Tests/PropertyAccessorCollectionTest.php | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index 113144f2bfe74..f23239193e1ea 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -43,6 +43,28 @@ public function getAxes() } } +class PropertyAccessorCollectionTest_CarOnlyAdder +{ + public function addAxis($axis) + { + } + + public function getAxes() + { + } +} + +class PropertyAccessorCollectionTest_CarOnlyRemover +{ + public function removeAxis($axis) + { + } + + public function getAxes() + { + } +} + class PropertyAccessorCollectionTest_CarNoAdderAndRemover { public function getAxes() @@ -143,25 +165,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound() public function testIsWritableReturnsTrueIfAdderAndRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_Car')->getMock(); + $car = new PropertyAccessorCollectionTest_Car(); $this->assertTrue($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyAdderExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarOnlyAdder')->getMock(); + $car = new PropertyAccessorCollectionTest_CarOnlyAdder(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfOnlyRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarOnlyRemover')->getMock(); + $car = new PropertyAccessorCollectionTest_CarOnlyRemover(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists() { - $car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock(); + $car = new PropertyAccessorCollectionTest_CarNoAdderAndRemover(); $this->assertFalse($this->propertyAccessor->isWritable($car, 'axes')); } @@ -171,7 +193,7 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists() */ public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable() { - $car = $this->getMockBuilder(__CLASS__.'_Car')->getMock(); + $car = new PropertyAccessorCollectionTest_Car(); $this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable'); } From 015fca74050da493cfb7a95e48ddc42d7b177e2a Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Wed, 24 Jul 2019 09:56:23 +0200 Subject: [PATCH 150/167] [Messenger] Flatten collection of stamps collected by the traceable middleware --- .../Component/Messenger/Tests/TraceableMessageBusTest.php | 2 +- src/Symfony/Component/Messenger/TraceableMessageBus.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php b/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php index 23e47d28d0d21..06bf641e9e0ed 100644 --- a/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php +++ b/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php @@ -56,7 +56,7 @@ public function testItTracesDispatchWithEnvelope() $this->assertCount(1, $tracedMessages = $traceableBus->getDispatchedMessages()); $this->assertArraySubset([ 'message' => $message, - 'stamps' => [[$stamp]], + 'stamps' => [$stamp], 'caller' => [ 'name' => 'TraceableMessageBusTest.php', 'file' => __FILE__, diff --git a/src/Symfony/Component/Messenger/TraceableMessageBus.php b/src/Symfony/Component/Messenger/TraceableMessageBus.php index 1d910d4540a1c..77eefddb5e0f5 100644 --- a/src/Symfony/Component/Messenger/TraceableMessageBus.php +++ b/src/Symfony/Component/Messenger/TraceableMessageBus.php @@ -33,7 +33,7 @@ public function dispatch($message): Envelope { $envelope = $message instanceof Envelope ? $message : new Envelope($message); $context = [ - 'stamps' => array_values($envelope->all()), + 'stamps' => array_merge([], ...array_values($envelope->all())), 'message' => $envelope->getMessage(), 'caller' => $this->getCaller(), 'callTime' => microtime(true), From c5c67d913db90ced8954098c9e9d312695dbe284 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 Jul 2019 09:56:35 +0200 Subject: [PATCH 151/167] [HttpClient] fix canceling responses in a streaming loop --- .../HttpClient/Response/MockResponse.php | 18 +++++++++++++++--- .../HttpClient/Response/ResponseTrait.php | 2 +- .../HttpClient/Test/HttpClientTestCase.php | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpClient/Response/MockResponse.php b/src/Symfony/Component/HttpClient/Response/MockResponse.php index 47fc084d376f3..90bb0df339672 100644 --- a/src/Symfony/Component/HttpClient/Response/MockResponse.php +++ b/src/Symfony/Component/HttpClient/Response/MockResponse.php @@ -78,6 +78,15 @@ public function getInfo(string $type = null) return null !== $type ? $this->info[$type] ?? null : $this->info; } + /** + * {@inheritdoc} + */ + public function cancel(): void + { + $this->info['error'] = 'Response has been canceled.'; + $this->body = null; + } + /** * {@inheritdoc} */ @@ -150,8 +159,11 @@ protected static function perform(ClientState $multi, array &$responses): void foreach ($responses as $response) { $id = $response->id; - if (!$response->body) { - // Last chunk + if (null === $response->body) { + // Canceled response + $response->body = []; + } elseif ([] === $response->body) { + // Error chunk $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; } elseif (null === $chunk = array_shift($response->body)) { @@ -242,7 +254,7 @@ private static function readResponse(self $response, array $options, ResponseInt // populate info related to headers $info = $mock->getInfo() ?: []; - $response->info['http_code'] = ($info['http_code'] ?? 0) ?: $mock->getStatusCode(false) ?: 200; + $response->info['http_code'] = ($info['http_code'] ?? 0) ?: $mock->getStatusCode() ?: 200; $response->addResponseHeaders($info['response_headers'] ?? [], $response->info, $response->headers); $dlSize = isset($response->headers['content-encoding']) ? 0 : (int) ($response->headers['content-length'][0] ?? 0); diff --git a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php index cd444439926a7..bf7ba3a746db2 100644 --- a/src/Symfony/Component/HttpClient/Response/ResponseTrait.php +++ b/src/Symfony/Component/HttpClient/Response/ResponseTrait.php @@ -327,7 +327,7 @@ public static function stream(iterable $responses, float $timeout = null): \Gene unset($multi->handlesActivity[$j]); - if ($chunk instanceof FirstChunk && null === $response->initializer) { + if ($chunk instanceof FirstChunk && null === $response->initializer && null === $response->info['error']) { // Ensure the HTTP status code is always checked $response->getHeaders(true); } elseif ($chunk instanceof ErrorChunk && !$chunk->didThrow()) { diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php index c0acd55ceaf49..075f73a2c1a4b 100644 --- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php +++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php @@ -505,6 +505,21 @@ public function testCancel() $response->getHeaders(); } + public function testCancelInStream() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/404'); + + foreach ($client->stream($response) as $chunk) { + $response->cancel(); + } + + $this->expectException(TransportExceptionInterface::class); + + foreach ($client->stream($response) as $chunk) { + } + } + public function testOnProgressCancel() { $client = $this->getHttpClient(__FUNCTION__); From 07590aeb9553538c7d14cfea2b2d089d5f30d130 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 4 Jul 2019 22:22:47 +0200 Subject: [PATCH 152/167] fix inline handling when dumping tagged values --- src/Symfony/Component/Yaml/Dumper.php | 17 +++- .../Component/Yaml/Tests/DumperTest.php | 89 +++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index d2a2ebcf88c21..0012df4a358fc 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Yaml; +use Symfony\Component\Yaml\Tag\TaggedValue; + /** * Dumper dumps PHP variables to YAML strings. * @@ -91,7 +93,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) $dumpObjectAsInlineMap = empty((array) $input); } - if ($inline <= 0 || (!\is_array($input) && $dumpObjectAsInlineMap) || empty($input)) { + if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) { $output .= $prefix.Inline::dump($input, $flags); } else { $dumpAsMap = Inline::isHash($input); @@ -110,6 +112,19 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0) continue; } + if ($value instanceof TaggedValue) { + $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); + + if ($inline - 1 <= 0) { + $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; + } else { + $output .= "\n"; + $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); + } + + continue; + } + $dumpObjectAsInlineMap = true; if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index e7a763ab96922..1a9cac6f73600 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Tag\TaggedValue; use Symfony\Component\Yaml\Yaml; class DumperTest extends TestCase @@ -434,6 +435,94 @@ public function testDumpingStdClassInstancesRespectsInlineLevel() inner2: c inner3: { deep1: d, deep2: e } +YAML; + $this->assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueSequenceRespectsInlineLevel() + { + $data = [ + new TaggedValue('user', [ + 'username' => 'jane', + ]), + new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 2); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueSequenceWithInlinedTagValues() + { + $data = [ + new TaggedValue('user', [ + 'username' => 'jane', + ]), + new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 1); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueMapRespectsInlineLevel() + { + $data = [ + 'user1' => new TaggedValue('user', [ + 'username' => 'jane', + ]), + 'user2' => new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 2); + + $expected = <<assertSame($expected, $yaml); + } + + public function testDumpingTaggedValueMapWithInlinedTagValues() + { + $data = [ + 'user1' => new TaggedValue('user', [ + 'username' => 'jane', + ]), + 'user2' => new TaggedValue('user', [ + 'username' => 'john', + ]), + ]; + + $yaml = $this->dumper->dump($data, 1); + + $expected = <<assertSame($expected, $yaml); } From df7afa00ee520199352e4b6a5f57918b343975c4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 Jul 2019 15:33:23 +0200 Subject: [PATCH 153/167] [Security/Core] align defaults for sodium with PHP 7.4 --- .../Component/Security/Core/Encoder/NativePasswordEncoder.php | 2 +- .../Component/Security/Core/Encoder/SodiumPasswordEncoder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index 94d9f5ca51e6e..1e09992afed4e 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -30,7 +30,7 @@ final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSalti public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null) { $cost = $cost ?? 13; - $opsLimit = $opsLimit ?? max(6, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE : 6); + $opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); $memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024); if (3 > $opsLimit) { diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 4f3f048bbf414..934a3fdfca528 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -34,7 +34,7 @@ public function __construct(int $opsLimit = null, int $memLimit = null) throw new LogicException('Libsodium is not available. You should either install the sodium extension, upgrade to PHP 7.2+ or use a different encoder.'); } - $this->opsLimit = $opsLimit ?? max(6, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE : 6); + $this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); $this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014); if (3 > $this->opsLimit) { From 9104ef1d749945c40bbe9dd84e9dbd145cfec0eb Mon Sep 17 00:00:00 2001 From: IceMaD Date: Thu, 11 Jul 2019 21:44:16 +0200 Subject: [PATCH 154/167] Fix multiSelect ChoiceQuestion when answers have spaces --- .../Console/Question/ChoiceQuestion.php | 10 ++- .../Tests/Question/ChoiceQuestionTest.php | 64 +++++++++++++++++++ 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index 5cb5056903e43..3dca160049338 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -134,17 +134,15 @@ private function getDefaultValidator() $isAssoc = $this->isAssoc($choices); return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { - // Collapse all spaces. - $selectedChoices = str_replace(' ', '', $selected); - if ($multiselect) { // Check for a separated comma values - if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { + if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selected, $matches)) { throw new InvalidArgumentException(sprintf($errorMessage, $selected)); } - $selectedChoices = explode(',', $selectedChoices); + + $selectedChoices = array_map('trim', explode(',', $selected)); } else { - $selectedChoices = [$selected]; + $selectedChoices = [trim($selected)]; } $multiselectChoices = []; diff --git a/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php new file mode 100644 index 0000000000000..5ec7a9cacb4de --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Question; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Question\ChoiceQuestion; + +class ChoiceQuestionTest extends TestCase +{ + /** + * @dataProvider selectUseCases + */ + public function testSelectUseCases($multiSelect, $answers, $expected, $message) + { + $question = new ChoiceQuestion('A question', [ + 'First response', + 'Second response', + 'Third response', + 'Fourth response', + ]); + + $question->setMultiselect($multiSelect); + + foreach ($answers as $answer) { + $validator = $question->getValidator(); + $actual = $validator($answer); + + $this->assertEquals($actual, $expected, $message); + } + } + + public function selectUseCases() + { + return [ + [ + false, + ['First response', 'First response ', ' First response', ' First response '], + 'First response', + 'When passed single answer on singleSelect, the defaultValidator must return this answer as a string', + ], + [ + true, + ['First response', 'First response ', ' First response', ' First response '], + ['First response'], + 'When passed single answer on MultiSelect, the defaultValidator must return this answer as an array', + ], + [ + true, + ['First response,Second response', ' First response , Second response '], + ['First response', 'Second response'], + 'When passed multiple answers on MultiSelect, the defaultValidator must return these answers as an array', + ], + ]; + } +} From 16fc81fbe55e850af8c162ab75dbb803faef5f37 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2019 18:24:16 +0200 Subject: [PATCH 155/167] fix test --- .../Component/Messenger/Tests/TraceableMessageBusTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php b/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php index 1b03e0036b658..b87fffa82f339 100644 --- a/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php +++ b/src/Symfony/Component/Messenger/Tests/TraceableMessageBusTest.php @@ -37,7 +37,7 @@ public function testItTracesDispatch() unset($actualTracedMessage['callTime']); // don't check, too variable $this->assertEquals([ 'message' => $message, - 'stamps' => [[$stamp]], + 'stamps' => [$stamp], 'caller' => [ 'name' => 'TraceableMessageBusTest.php', 'file' => __FILE__, From affede122b2ae57e88208b57aa7dd7c8ae1716ee Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2019 18:52:34 +0200 Subject: [PATCH 156/167] make tests forward compatible with DI 4.4 --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 9ffb13232f14a..ef074bd163a1c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1170,6 +1170,7 @@ protected function createContainerFromFile($file, $data = [], $resetCompilerPass if ($resetCompilerPasses) { $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); } $container->getCompilerPassConfig()->setBeforeRemovingPasses([new AddConstraintValidatorsPass(), new TranslatorPass('translator.default', 'translation.reader')]); $container->getCompilerPassConfig()->setAfterRemovingPasses([new AddAnnotationsCachedReaderPass()]); @@ -1191,6 +1192,7 @@ protected function createContainerFromClosure($closure, $data = []) $container->getCompilerPassConfig()->setOptimizationPasses([]); $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); $container->compile(); return $container; From 9c263ffca818de4b204dabb5babff189a2b055a8 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 24 Jul 2019 18:10:47 +0200 Subject: [PATCH 157/167] [Messenger] Fix redis last error not cleared between calls --- .../Transport/RedisExt/ConnectionTest.php | 31 ++++++++++++- .../Transport/RedisExt/Connection.php | 43 +++++++++++++------ 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php index 0d80e920c3571..066b4c17887a7 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Messenger\Transport\RedisExt\Connection; /** - * @requires extension redis + * @requires extension redis >= 4.3.0 */ class ConnectionTest extends TestCase { @@ -119,7 +119,7 @@ public function testUnexpectedRedisError() $redis->expects($this->once())->method('xreadgroup')->willReturn(false); $redis->expects($this->once())->method('getLastError')->willReturn('Redis error happens'); - $connection = Connection::fromDsn('redis://localhost/queue', [], $redis); + $connection = Connection::fromDsn('redis://localhost/queue', ['auto_setup' => false], $redis); $connection->get(); } @@ -152,4 +152,31 @@ public function testGetNonBlocking() $connection->reject($message['id']); $redis->del('messenger-getnonblocking'); } + + public function testLastErrorGetsCleared() + { + $redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock(); + + $redis->expects($this->once())->method('xadd')->willReturn(0); + $redis->expects($this->once())->method('xack')->willReturn(0); + + $redis->method('getLastError')->willReturnOnConsecutiveCalls('xadd error', 'xack error'); + $redis->expects($this->exactly(2))->method('clearLastError'); + + $connection = Connection::fromDsn('redis://localhost/messenger-clearlasterror', ['auto_setup' => false], $redis); + + try { + $connection->add('message', []); + } catch (TransportException $e) { + } + + $this->assertSame('xadd error', $e->getMessage()); + + try { + $connection->ack('1'); + } catch (TransportException $e) { + } + + $this->assertSame('xack error', $e->getMessage()); + } } diff --git a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php index 8524c1fe03b65..59ec9f029d6a4 100644 --- a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php @@ -114,12 +114,15 @@ public function get(): ?array 1 ); } catch (\RedisException $e) { + throw new TransportException($e->getMessage(), 0, $e); } - if ($e || false === $messages) { - throw new TransportException( - ($e ? $e->getMessage() : $this->connection->getLastError()) ?? 'Could not read messages from the redis stream.' - ); + if (false === $messages) { + if ($error = $this->connection->getLastError() ?: null) { + $this->connection->clearLastError(); + } + + throw new TransportException($error ?? 'Could not read messages from the redis stream.'); } if ($this->couldHavePendingMessages && empty($messages[$this->stream])) { @@ -144,28 +147,34 @@ public function get(): ?array public function ack(string $id): void { - $e = null; try { $acknowledged = $this->connection->xack($this->stream, $this->group, [$id]); } catch (\RedisException $e) { + throw new TransportException($e->getMessage(), 0, $e); } - if ($e || !$acknowledged) { - throw new TransportException(($e ? $e->getMessage() : $this->connection->getLastError()) ?? sprintf('Could not acknowledge redis message "%s".', $id), 0, $e); + if (!$acknowledged) { + if ($error = $this->connection->getLastError() ?: null) { + $this->connection->clearLastError(); + } + throw new TransportException($error ?? sprintf('Could not acknowledge redis message "%s".', $id)); } } public function reject(string $id): void { - $e = null; try { $deleted = $this->connection->xack($this->stream, $this->group, [$id]); $deleted = $this->connection->xdel($this->stream, [$id]) && $deleted; } catch (\RedisException $e) { + throw new TransportException($e->getMessage(), 0, $e); } - if ($e || !$deleted) { - throw new TransportException(($e ? $e->getMessage() : $this->connection->getLastError()) ?? sprintf('Could not delete message "%s" from the redis stream.', $id), 0, $e); + if (!$deleted) { + if ($error = $this->connection->getLastError() ?: null) { + $this->connection->clearLastError(); + } + throw new TransportException($error ?? sprintf('Could not delete message "%s" from the redis stream.', $id)); } } @@ -175,16 +184,19 @@ public function add(string $body, array $headers): void $this->setup(); } - $e = null; try { $added = $this->connection->xadd($this->stream, '*', ['message' => json_encode( ['body' => $body, 'headers' => $headers] )]); } catch (\RedisException $e) { + throw new TransportException($e->getMessage(), 0, $e); } - if ($e || !$added) { - throw new TransportException(($e ? $e->getMessage() : $this->connection->getLastError()) ?? 'Could not add a message to the redis stream.', 0, $e); + if (!$added) { + if ($error = $this->connection->getLastError() ?: null) { + $this->connection->clearLastError(); + } + throw new TransportException($error ?? 'Could not add a message to the redis stream.'); } } @@ -196,6 +208,11 @@ public function setup(): void throw new TransportException($e->getMessage(), 0, $e); } + // group might already exist, ignore + if ($this->connection->getLastError()) { + $this->connection->clearLastError(); + } + $this->autoSetup = false; } } From 83e7b45b6d5605d37cde44fcad0984a83c0e7298 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2019 20:15:30 +0200 Subject: [PATCH 158/167] fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3a022159513e8..12d031f64be20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -231,7 +231,7 @@ install: composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master - | - # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one + # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev From c0eed67aa87c2d25f62b5637365d3c6e0b79d4fe Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2019 21:38:05 +0200 Subject: [PATCH 159/167] relax some assertions to make tests forward compatible --- .../Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php | 6 ++++-- .../Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 7a806d76cd7fa..83cbbd1426c79 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -848,7 +848,8 @@ public function testPreferredChoices() ]); $this->assertEquals([3 => new ChoiceView($entity3, '3', 'Baz'), 2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['preferred_choices']); - $this->assertEquals([1 => new ChoiceView($entity1, '1', 'Foo')], $field->createView()->vars['choices']); + $this->assertArrayHasKey(1, $field->createView()->vars['choices']); + $this->assertEquals(new ChoiceView($entity1, '1', 'Foo'), $field->createView()->vars['choices'][1]); } public function testOverrideChoicesWithPreferredChoices() @@ -868,7 +869,8 @@ public function testOverrideChoicesWithPreferredChoices() ]); $this->assertEquals([3 => new ChoiceView($entity3, '3', 'Baz')], $field->createView()->vars['preferred_choices']); - $this->assertEquals([2 => new ChoiceView($entity2, '2', 'Bar')], $field->createView()->vars['choices']); + $this->assertArrayHasKey(2, $field->createView()->vars['choices']); + $this->assertEquals(new ChoiceView($entity2, '2', 'Bar'), $field->createView()->vars['choices'][2]); } public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier() diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php index 183cd820c3d02..5763345afd8bd 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php @@ -404,7 +404,6 @@ public function testSingleChoiceWithPreferred() /following-sibling::option[@disabled="disabled"][not(@selected)][.="-- sep --"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=3] ' ); } @@ -427,7 +426,6 @@ public function testSingleChoiceWithPreferredAndNoSeparator() ./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=2] ' ); } @@ -451,7 +449,6 @@ public function testSingleChoiceWithPreferredAndBlankSeparator() /following-sibling::option[@disabled="disabled"][not(@selected)][.=""] /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"] ] - [count(./option)=3] ' ); } @@ -468,7 +465,6 @@ public function testChoiceWithOnlyPreferred() $this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']], '/select [@class="my&class form-control"] - [count(./option)=2] ' ); } From bf608aaf3c2b08b2ffd39f14f86365b26c15727c Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 25 Jul 2019 06:34:00 +0300 Subject: [PATCH 160/167] Fix pluralizing "season" --- src/Symfony/Component/Inflector/Inflector.php | 3 +++ src/Symfony/Component/Inflector/Tests/InflectorTest.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/Symfony/Component/Inflector/Inflector.php b/src/Symfony/Component/Inflector/Inflector.php index 15198293cf535..58399b6322c54 100644 --- a/src/Symfony/Component/Inflector/Inflector.php +++ b/src/Symfony/Component/Inflector/Inflector.php @@ -228,6 +228,9 @@ final class Inflector // bacteria (bacterium), criteria (criterion), phenomena (phenomenon) ['noi', 3, true, true, 'ions'], + // seasons (season), treasons (treason), poisons (poison), lessons (lesson) + ['nos', 3, true, true, 'sons'], + // bacteria (bacterium), criteria (criterion), phenomena (phenomenon) ['no', 2, true, true, 'a'], diff --git a/src/Symfony/Component/Inflector/Tests/InflectorTest.php b/src/Symfony/Component/Inflector/Tests/InflectorTest.php index 1178edf35b5bc..38df846ba667f 100644 --- a/src/Symfony/Component/Inflector/Tests/InflectorTest.php +++ b/src/Symfony/Component/Inflector/Tests/InflectorTest.php @@ -93,6 +93,7 @@ public function singularizeProvider() ['kisses', 'kiss'], ['knives', 'knife'], ['lamps', 'lamp'], + ['lessons', 'lesson'], ['leaves', ['leaf', 'leave', 'leaff']], ['lice', 'louse'], ['lives', 'life'], @@ -115,6 +116,7 @@ public function singularizeProvider() ['photos', 'photo'], ['pianos', 'piano'], ['plateaux', 'plateau'], + ['poisons', 'poison'], ['poppies', 'poppy'], ['prices', ['prex', 'prix', 'price']], ['quizzes', 'quiz'], @@ -124,6 +126,7 @@ public function singularizeProvider() ['sandwiches', ['sandwich', 'sandwiche']], ['scarves', ['scarf', 'scarve', 'scarff']], ['schemas', 'schema'], //schemata + ['seasons', 'season'], ['selfies', 'selfie'], ['series', 'series'], ['services', 'service'], @@ -139,6 +142,7 @@ public function singularizeProvider() ['teeth', 'tooth'], ['theses', ['thes', 'these', 'thesis']], ['thieves', ['thief', 'thieve', 'thieff']], + ['treasons', 'treason'], ['trees', ['tre', 'tree']], ['waltzes', ['waltz', 'waltze']], ['wives', 'wife'], @@ -226,6 +230,7 @@ public function pluralizeProvider() ['knife', 'knives'], ['lamp', 'lamps'], ['leaf', ['leafs', 'leaves']], + ['lesson', 'lessons'], ['life', 'lives'], ['louse', 'lice'], ['man', 'men'], @@ -245,6 +250,7 @@ public function pluralizeProvider() ['photo', 'photos'], ['piano', 'pianos'], ['plateau', ['plateaus', 'plateaux']], + ['poison', 'poisons'], ['poppy', 'poppies'], ['price', 'prices'], ['quiz', 'quizzes'], @@ -254,6 +260,7 @@ public function pluralizeProvider() ['sandwich', 'sandwiches'], ['scarf', ['scarfs', 'scarves']], ['schema', 'schemas'], //schemata + ['season', 'seasons'], ['selfie', 'selfies'], ['series', 'series'], ['service', 'services'], @@ -268,6 +275,7 @@ public function pluralizeProvider() ['tag', 'tags'], ['thief', ['thiefs', 'thieves']], ['tooth', 'teeth'], + ['treason', 'treasons'], ['tree', 'trees'], ['waltz', 'waltzes'], ['wife', 'wives'], From 3c3bda54236d4a9c463fd74f11d153efddd74b55 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 Jul 2019 16:20:30 +0200 Subject: [PATCH 161/167] [DI] fix perf issue with lazy autowire error messages --- .../Compiler/AutowirePass.php | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 3ae264f5c8bc5..ced4d827dc34d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -37,6 +37,7 @@ class AutowirePass extends AbstractRecursivePass private $getPreviousValue; private $decoratedMethodIndex; private $decoratedMethodArgumentIndex; + private $typesClone; public function __construct(bool $throwOnAutowireException = true) { @@ -49,16 +50,16 @@ public function __construct(bool $throwOnAutowireException = true) public function process(ContainerBuilder $container) { try { + $this->typesClone = clone $this; parent::process($container); } finally { - $this->types = null; - $this->ambiguousServiceTypes = null; $this->decoratedClass = null; $this->decoratedId = null; $this->methodCalls = null; $this->getPreviousValue = null; $this->decoratedMethodIndex = null; $this->decoratedMethodArgumentIndex = null; + $this->typesClone = null; } } @@ -375,20 +376,22 @@ private function set(string $type, string $id) private function createTypeNotFoundMessageCallback(TypedReference $reference, $label) { - $container = new ContainerBuilder($this->container->getParameterBag()); - $container->setAliases($this->container->getAliases()); - $container->setDefinitions($this->container->getDefinitions()); - $container->setResourceTracking(false); + if (null === $this->typesClone->container) { + $this->typesClone->container = new ContainerBuilder($this->container->getParameterBag()); + $this->typesClone->container->setAliases($this->container->getAliases()); + $this->typesClone->container->setDefinitions($this->container->getDefinitions()); + $this->typesClone->container->setResourceTracking(false); + } $currentId = $this->currentId; - return function () use ($container, $reference, $label, $currentId) { - return $this->createTypeNotFoundMessage($container, $reference, $label, $currentId); - }; + return (function () use ($reference, $label, $currentId) { + return $this->createTypeNotFoundMessage($reference, $label, $currentId); + })->bindTo($this->typesClone); } - private function createTypeNotFoundMessage(ContainerBuilder $container, TypedReference $reference, $label, string $currentId) + private function createTypeNotFoundMessage(TypedReference $reference, $label, string $currentId) { - if (!$r = $container->getReflectionClass($type = $reference->getType(), false)) { + if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) { // either $type does not exist or a parent class does not exist try { $resource = new ClassExistenceResource($type, false); @@ -401,8 +404,8 @@ private function createTypeNotFoundMessage(ContainerBuilder $container, TypedRef $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); } else { - $alternatives = $this->createTypeAlternatives($container, $reference); - $message = $container->has($type) ? 'this service is abstract' : 'no such service exists'; + $alternatives = $this->createTypeAlternatives($this->container, $reference); + $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); if ($r->isInterface() && !$alternatives) { From 5dc8bc0520d888d378c5b981eae14d438e0937a1 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 26 Jul 2019 13:29:23 +0200 Subject: [PATCH 162/167] [VarDumper] cs fix --- src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 37d50a884df0d..b2f6ee7012b67 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -438,7 +438,7 @@ function xpathHasClass(className) { return this.current(); } this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0; - + return this.current(); }, previous: function () { @@ -446,7 +446,7 @@ function xpathHasClass(className) { return this.current(); } this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1); - + return this.current(); }, isEmpty: function () { @@ -522,11 +522,11 @@ function showCurrent(state) "sf-dump-protected", "sf-dump-private", ].map(xpathHasClass).join(' or '); - + var xpathResult = doc.evaluate('.//span[' + classMatches + '][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); while (node = xpathResult.iterateNext()) state.nodes.push(node); - + showCurrent(state); }, 400); }); From c1349d143412d93219635f58113b9608b8dd8168 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 26 Jul 2019 14:52:11 +0200 Subject: [PATCH 163/167] clarify error handler restoring process --- .../HttpKernel/CacheWarmer/CacheWarmerAggregate.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php index dd527708bee0f..f28fbd60cc952 100644 --- a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php +++ b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php @@ -50,10 +50,9 @@ public function enableOnlyOptionalWarmers() */ public function warmUp($cacheDir) { - if ($this->debug) { + if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) { $collectedLogs = []; - $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); - $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { + $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; } @@ -96,7 +95,7 @@ public function warmUp($cacheDir) $warmer->warmUp($cacheDir); } } finally { - if ($this->debug && true !== $previousHandler) { + if ($collectDeprecations) { restore_error_handler(); if (file_exists($this->deprecationLogsFilepath)) { From f7e8a96ffccc39d5b6820dd0ccc62b478858b6ad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 27 Jul 2019 07:24:50 +0200 Subject: [PATCH 164/167] add missing changelog entry --- src/Symfony/Bundle/SecurityBundle/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md index 812c22eab65eb..230a252bc0c20 100644 --- a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md @@ -21,6 +21,7 @@ CHANGELOG 4.1.0 ----- + * The `switch_user.stateless` firewall option is deprecated, use the `stateless` option instead. * The `logout_on_user_change` firewall option is deprecated. * deprecated `SecurityUserValueResolver`, use `Symfony\Component\Security\Http\Controller\UserValueResolver` instead. From 8157db45229ae3e9326b854018a6e8ff6dec45fd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 27 Jul 2019 08:08:43 +0200 Subject: [PATCH 165/167] add parameter type declarations to private methods --- src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php | 5 +---- .../Doctrine/DataCollector/DoctrineDataCollector.php | 4 ++-- .../RegisterEventListenersAndSubscribersPass.php | 7 ++----- src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 4496d3ac9a3d9..8ecf2135d9245 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -129,10 +129,7 @@ public function removeEventListener($events, $listener) } } - /** - * @param string $eventName - */ - private function initializeListeners($eventName) + private function initializeListeners(string $eventName) { foreach ($this->listeners[$eventName] as $hash => $listener) { if (\is_string($listener)) { diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php index ee4c644f0ea8a..a25a670e80ef9 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php @@ -120,7 +120,7 @@ public function getName() return 'db'; } - private function sanitizeQueries($connectionName, $queries) + private function sanitizeQueries(string $connectionName, array $queries) { foreach ($queries as $i => $query) { $queries[$i] = $this->sanitizeQuery($connectionName, $query); @@ -129,7 +129,7 @@ private function sanitizeQueries($connectionName, $queries) return $queries; } - private function sanitizeQuery($connectionName, $query) + private function sanitizeQuery(string $connectionName, $query) { $query['explainable'] = true; if (null === $query['params']) { diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index deaa64e7c9084..6016c8ce0905f 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -109,7 +109,7 @@ private function addTaggedListeners(ContainerBuilder $container) } } - private function getEventManagerDef(ContainerBuilder $container, $name) + private function getEventManagerDef(ContainerBuilder $container, string $name) { if (!isset($this->eventManagers[$name])) { $this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name)); @@ -128,12 +128,9 @@ private function getEventManagerDef(ContainerBuilder $container, $name) * @see https://bugs.php.net/bug.php?id=53710 * @see https://bugs.php.net/bug.php?id=60926 * - * @param string $tagName - * @param ContainerBuilder $container - * * @return array */ - private function findAndSortTags($tagName, ContainerBuilder $container) + private function findAndSortTags(string $tagName, ContainerBuilder $container) { $sortedTags = []; diff --git a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php index e7df3702ebf1f..db9db4f286f0a 100644 --- a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php +++ b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php @@ -50,7 +50,7 @@ public function setRepository(EntityManagerInterface $entityManager, $entityName /** * @return ObjectRepository */ - private function createRepository(EntityManagerInterface $entityManager, $entityName) + private function createRepository(EntityManagerInterface $entityManager, string $entityName) { /* @var $metadata ClassMetadata */ $metadata = $entityManager->getClassMetadata($entityName); @@ -59,7 +59,7 @@ private function createRepository(EntityManagerInterface $entityManager, $entity return new $repositoryClassName($entityManager, $metadata); } - private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName) + private function getRepositoryHash(EntityManagerInterface $entityManager, string $entityName) { return $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager); } From cdcf3b8704adc1a5f80786e89cfa77820cc724e9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 28 Jul 2019 09:10:02 +0200 Subject: [PATCH 166/167] updated CHANGELOG for 4.3.3 --- CHANGELOG-4.3.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/CHANGELOG-4.3.md b/CHANGELOG-4.3.md index 965e52e7db2a5..15c76d1c33d3f 100644 --- a/CHANGELOG-4.3.md +++ b/CHANGELOG-4.3.md @@ -7,6 +7,64 @@ in 4.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.3.0...v4.3.1 +* 4.3.3 (2019-07-28) + + * bug #32726 [Messenger] Fix redis last error not cleared between calls (chalasr) + * bug #32760 [HttpKernel] clarify error handler restoring process (xabbuh) + * bug #32730 [Inflector] Fix pluralizing words ending with "son" (norkunas) + * bug #32715 [DI] fix perf issue with lazy autowire error messages (nicolas-grekas) + * bug #32503 Fix multiSelect ChoiceQuestion when answers have spaces (IceMaD) + * bug #32688 [Yaml] fix inline handling when dumping tagged values (xabbuh) + * bug #32710 [Security/Core] align defaults for sodium with PHP 7.4 (nicolas-grekas) + * bug #32644 [WebProfileBundle] Avoid getting right to left style (Arman-Hosseini) + * bug #32689 [HttpClient] rewind stream when using Psr18Client (nicolas-grekas) + * bug #32700 [Messenger] Flatten collection of stamps collected by the traceable middleware (ogizanagi) + * bug #32699 [HttpClient] fix canceling responses in a streaming loop (nicolas-grekas) + * bug #32679 [Intl] relax some date parser patterns (xabbuh) + * bug #31303 [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) (dorumd, nicolas-grekas) + * bug #32485 [Validator] Added support for validation of giga values (kernig) + * bug #32567 [Messenger] pass transport name to factory (Tobion) + * bug #32568 [Messenger] Fix UnrecoverableExceptionInterface handling (LanaiGrunt) + * bug #32604 Properly handle optional tag attributes for !tagged_iterator (apfelbox) + * bug #32571 [HttpClient] fix debug output added to stderr at shutdown (nicolas-grekas) + * bug #32443 [PHPUnitBridge] Mute deprecations triggered from phpunit (greg0ire) + * bug #32572 Bump minimum version of symfony/phpunit-bridge (fancyweb) + * bug #32438 [Serializer] XmlEncoder: don't cast padded strings (ogizanagi) + * bug #32579 [Config] Do not use absolute path when computing the vendor freshness (lyrixx) + * bug #32563 Container*::getServiceIds() should return strings (mathroc) + * bug #32553 [Mailer] Allow register mailer configuration in xml format (Koc) + * bug #32442 Adding missing event_dispatcher wiring for messenger.middleware.send_message (weaverryan) + * bug #32466 [Config] Fix for signatures of typed properties (tvandervorm) + * bug #32501 [FrameworkBundle] Fix descriptor of routes described as callable array (ribeiropaulor) + * bug #32500 [Debug][DebugClassLoader] Include found files instead of requiring them (fancyweb) + * bug #32464 [WebProfilerBundle] Fix Twig 1.x compatibility (yceruto) + * bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42) + * bug #32096 Don't assume port 0 for X-Forwarded-Port (alexbowers, xabbuh) + * bug #31820 [SecurityBundle] Fix profiler dump for non-invokable security listeners (chalasr) + * bug #32392 [Messenger] Doctrine Transport: Support setting auto_setup from DSN (bendavies) + * bug #31267 [Translator] Load plurals from mo files properly (Stadly) + * bug #31266 [Translator] Load plurals from po files properly (Stadly) + * bug #32383 [Serializer] AbstractObjectNormalizer ignores the property types of discriminated classes (sandergo90) + * bug #32413 [Messenger] fix publishing headers set on AmqpStamp (Tobion) + * bug #32421 [EventDispatcher] Add tag kernel.rest on 'debug.event_dispatcher' service (lyrixx) + * bug #32398 [Messenger] Removes deprecated call to ReflectionType::__toString() on MessengerPass (brunowowk) + * bug #32379 [SecurityBundle] conditionally register services (xabbuh) + * bug #32380 [Messenger] fix broken key normalization (Tobion) + * bug #32363 [FrameworkBundle] reset cache pools between requests (nicolas-grekas) + * bug #32365 [DI] fix processing of regular parameter bags by MergeExtensionConfigurationPass (nicolas-grekas) + * bug #32187 [PHPUnit] Fixed composer error on Windows (misterx) + * bug #32299 [Lock] Stores must implement `putOffExpiration` (jderusse) + * bug #32302 [Mime] Remove @internal annotations for the serialize methods (francoispluchino) + * bug #32334 [Messenger] Fix authentication for redis transport (alexander-schranz) + * bug #32309 Fixing validation for messenger transports retry_strategy service key (weaverryan) + * bug #32331 [Workflow] only decorate when an event dispatcher was passed (xabbuh) + * bug #32236 [Cache] work aroung PHP memory leak (nicolas-grekas) + * bug #32206 Catch JsonException and rethrow in JsonEncode (phil-davis) + * bug #32211 [Mailer] Fix error message when connecting to a stream raises an error before connect() (fabpot) + * bug #32210 [Mailer] Fix timeout type hint (fabpot) + * bug #32199 [EventDispatcher] improve error messages in the event dispatcher (xabbuh) + * bug #32200 [Security/Core] work around sodium_compat issue (nicolas-grekas) + * 4.3.2 (2019-06-26) * bug #31954 [PhpunitBridge] Read environment variable from superglobals (greg0ire) From 3bb74242c48ff7aad017743225f3a23e3fa64ced Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 28 Jul 2019 09:10:23 +0200 Subject: [PATCH 167/167] updated VERSION for 4.3.3 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 58e765d385a5c..65476f80e39f6 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.3-DEV'; + const VERSION = '4.3.3'; const VERSION_ID = 40303; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; const RELEASE_VERSION = 3; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020';