From 9b4cc57f28600c8495a1213431f0b8882e8a25b8 Mon Sep 17 00:00:00 2001 From: "j.apsitis" Date: Mon, 26 Feb 2024 08:22:46 +0200 Subject: [PATCH 01/59] [Messenger] Passing to `WorkerMessageRetriedEvent` envelope with actual stamps after sent Signed-off-by: j.apsitis --- .../SendFailedMessageForRetryListener.php | 2 +- .../SendFailedMessageForRetryListenerTest.php | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php b/src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php index e87aaeff8a4fe..ca4791d8d6a3a 100644 --- a/src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php +++ b/src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php @@ -77,7 +77,7 @@ public function onMessageFailed(WorkerMessageFailedEvent $event) $retryEnvelope = $this->withLimitedHistory($envelope, new DelayStamp($delay), new RedeliveryStamp($retryCount)); // re-send the message for retry - $this->getSenderForTransport($event->getReceiverName())->send($retryEnvelope); + $retryEnvelope = $this->getSenderForTransport($event->getReceiverName())->send($retryEnvelope); if (null !== $this->eventDispatcher) { $this->eventDispatcher->dispatch(new WorkerMessageRetriedEvent($retryEnvelope, $event->getReceiverName())); diff --git a/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php b/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php index a5fe10e85578b..0519a19fb6619 100644 --- a/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php +++ b/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php @@ -13,13 +13,16 @@ use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent; +use Symfony\Component\Messenger\Event\WorkerMessageRetriedEvent; use Symfony\Component\Messenger\EventListener\SendFailedMessageForRetryListener; use Symfony\Component\Messenger\Exception\RecoverableMessageHandlingException; use Symfony\Component\Messenger\Retry\RetryStrategyInterface; use Symfony\Component\Messenger\Stamp\DelayStamp; use Symfony\Component\Messenger\Stamp\RedeliveryStamp; +use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp; use Symfony\Component\Messenger\Transport\Sender\SenderInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -190,4 +193,47 @@ public function testEnvelopeKeepOnlyTheLast10Stamps() $listener->onMessageFailed($event); } + + public function testRetriedEnvelopePassesToRetriedEvent() + { + $exception = new \Exception('no!'); + $envelope = new Envelope(new \stdClass()); + + $sender = $this->createMock(SenderInterface::class); + $sender->expects($this->once())->method('send')->willReturnCallback(static function (Envelope $envelope) { + return $envelope->with(new TransportMessageIdStamp(123)); + }); + + $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $eventDispatcher->expects($this->once())->method('dispatch')->willReturnCallback( + function (WorkerMessageRetriedEvent $retriedEvent) { + $envelope = $retriedEvent->getEnvelope(); + + $transportIdStamp = $envelope->last(TransportMessageIdStamp::class); + $this->assertNotNull($transportIdStamp); + + return $retriedEvent; + }); + + $senderLocator = new Container(); + $senderLocator->set('my_receiver', $sender); + + $retryStrategy = $this->createMock(RetryStrategyInterface::class); + $retryStrategy->expects($this->once())->method('isRetryable')->willReturn(true); + $retryStrategy->expects($this->once())->method('getWaitingTime')->willReturn(1000); + + $retryStrategyLocator = new Container(); + $retryStrategyLocator->set('my_receiver', $retryStrategy); + + $listener = new SendFailedMessageForRetryListener( + $senderLocator, + $retryStrategyLocator, + null, + $eventDispatcher + ); + + $event = new WorkerMessageFailedEvent($envelope, 'my_receiver', $exception); + + $listener->onMessageFailed($event); + } } From ad6d2fc33629eba1dcd24d5ac90c91a7b2879667 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Jun 2024 13:42:34 +0200 Subject: [PATCH 02/59] Update CHANGELOG for 5.4.41 --- CHANGELOG-5.4.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG-5.4.md b/CHANGELOG-5.4.md index 3e2bcd6d8360d..c160dd4fef756 100644 --- a/CHANGELOG-5.4.md +++ b/CHANGELOG-5.4.md @@ -7,6 +7,31 @@ in 5.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/v5.4.0...v5.4.1 +* 5.4.41 (2024-06-28) + + * bug #57497 [String] Fixed u()->snake(), b()->snake() and s()->snake() methods (arczinosek) + * bug #57574 [Filesystem] Fix Filesystem::remove() on Windows (nicolas-grekas) + * bug #57572 [DoctrineBridge] Fix compat with DI >= 6.4 (nicolas-grekas) + * bug #57538 [String] Add `alias` case to `EnglishInflector` (alexandre-daubois) + * feature #57557 Ibexa is sponsoring Symfony 5.4, thanks to them! \o/ (nicolas-grekas) + * bug #57569 [HttpClient][Mailer] Revert "Let curl handle transfer encoding", use HTTP/1.1 for Mailgun (nicolas-grekas) + * bug #57453 [HttpClient] Fix parsing SSE (fancyweb) + * bug #57467 [SecurityBundle] Add `provider` XML attribute to the authenticators it’s missing from (MatTheCat) + * bug #57384 [Notifier] Fix thread key in GoogleChat bridge (romain-jacquart) + * bug #57372 [HttpKernel][Security] Fix accessing session for stateless request (VincentLanglet) + * bug #57112 [Messenger] Handle `AMQPConnectionException` when publishing a message (jwage) + * bug #57341 [Serializer] properly handle invalid data for false/true types (xabbuh) + * bug #57187 [Serializer] Fix `ObjectNormalizer` with property path (HypeMC) + * bug #57355 [ErrorHandler] Fix rendered exception code highlighting on PHP 8.3 (tscni) + * bug #57273 [FrameworkBundle] Fix setting default context for certain normalizers (HypeMC) + * bug #52699 [Serializer] [PropertyAccessor] Ignore non-collection interface generics (mtarld) + * bug #54634 [String] Fix #54611 pluralization of -on ending words + singularization of -a ending foreign words (Geordie, DesLynx) + * bug #57213 [Validator] [UniqueValidator] Use correct variable as parameter in (custom) error message (seho-nl, Sebastien Hoek) + * bug #54920 [Messenger] Comply with Amazon SQS requirements for message body (VincentLanglet) + * bug #57110 [PhpUnitBridge] Fix error handler triggered outside of tests (HypeMC) + * bug #57297 [FrameworkBundle] not registered definitions must not be modified (xabbuh) + * bug #57234 [String] Fix Inflector for 'hardware' (podhy) + * 5.4.40 (2024-06-02) * bug #57275 Fix autoload configs to avoid warnings when building optimized autoloaders (Seldaek) From 023a565bdfbc586753c724813425868316eed593 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Jun 2024 13:42:39 +0200 Subject: [PATCH 03/59] Update CONTRIBUTORS for 5.4.41 --- CONTRIBUTORS.md | 60 ++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 92dac23ccbd1c..8542f255df6a1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -33,9 +33,9 @@ The Symfony Connect username in parenthesis allows to get more information - Hugo Hamon (hhamon) - Tobias Nyholm (tobias) - Jérôme Tamarelle (gromnan) + - HypeMC (hypemc) - Samuel ROZE (sroze) - Antoine Lamirault (alamirault) - - HypeMC (hypemc) - Pascal Borreli (pborreli) - Romain Neutron - Joseph Bielawski (stloyd) @@ -54,8 +54,8 @@ The Symfony Connect username in parenthesis allows to get more information - Gabriel Ostrolucký (gadelat) - Matthias Pigulla (mpdude) - Jonathan Wage (jwage) - - Valentin Udaltsov (vudaltsov) - Vincent Langlet (deviling) + - Valentin Udaltsov (vudaltsov) - Alexandre Salomé (alexandresalome) - Grégoire Paris (greg0ire) - William DURAND @@ -72,11 +72,11 @@ The Symfony Connect username in parenthesis allows to get more information - Pierre du Plessis (pierredup) - David Maicher (dmaicher) - Bulat Shakirzyanov (avalanche123) + - Mathias Arlaud (mtarld) - Iltar van der Berg - Miha Vrhovnik (mvrhov) - Tomasz Kowalczyk (thunderer) - Gary PEGEOT (gary-p) - - Mathias Arlaud (mtarld) - Saša Stamenković (umpirsky) - Allison Guilhem (a_guilhem) - Mathieu Piot (mpiot) @@ -90,9 +90,9 @@ The Symfony Connect username in parenthesis allows to get more information - Bilal Amarni (bamarni) - Eriksen Costa - Florin Patan (florinpatan) + - Dariusz Ruminski - Vladimir Reznichenko (kalessil) - Peter Rehm (rpet) - - Dariusz Ruminski - Henrik Bjørnskov (henrikbjorn) - David Buchmann (dbu) - Ruud Kamphuis (ruudk) @@ -107,16 +107,16 @@ The Symfony Connect username in parenthesis allows to get more information - Douglas Greenshields (shieldo) - Frank A. Fiebig (fafiebig) - Baldini + - Tomas Norkūnas (norkunas) - Alex Pott - Fran Moreno (franmomu) - Charles Sarrazin (csarrazi) - - Tomas Norkūnas (norkunas) - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Ener-Getick - Hubert Lenoir (hubert_lenoir) - - Graham Campbell (graham) + - Ener-Getick - Antoine Makdessi (amakdessi) + - Graham Campbell (graham) - Tugdual Saunier (tucksaun) - Lee McDermott - Brandon Turner @@ -171,17 +171,17 @@ The Symfony Connect username in parenthesis allows to get more information - Gordon Franke (gimler) - Malte Schlüter (maltemaltesich) - jeremyFreeAgent (jeremyfreeagent) + - Michael Babker (mbabker) + - Maximilian Beckers (maxbeckers) + - Valtteri R (valtzu) - Joshua Thijssen - Vasilij Dusko - Daniel Wehner (dawehner) - Maxime Helias (maxhelias) - Robert Schönthal (digitalkaoz) - Smaine Milianni (ismail1432) - - Michael Babker (mbabker) - François-Xavier de Guillebon (de-gui_f) - - Maximilian Beckers (maxbeckers) - noniagriconomie - - Valtteri R (valtzu) - Eric GELOEN (gelo) - Gabriel Caruso - Stefano Sala (stefano.sala) @@ -405,6 +405,7 @@ The Symfony Connect username in parenthesis allows to get more information - Danny Berger (dpb587) - Alif Rachmawadi - Anton Chernikov (anton_ch1989) + - Stiven Llupa (sllupa) - Pierre-Yves Lebecq (pylebecq) - Benjamin Leveque (benji07) - Jordan Samouh (jordansamouh) @@ -438,6 +439,7 @@ The Symfony Connect username in parenthesis allows to get more information - Dane Powell - Sebastien Morel (plopix) - Christopher Davis (chrisguitarguy) + - Jonathan H. Wage - Loïc Frémont (loic425) - Matthieu Auger (matthieuauger) - Sergey Belyshkin (sbelyshkin) @@ -468,11 +470,11 @@ The Symfony Connect username in parenthesis allows to get more information - Wouter Van Hecke - Baptiste Lafontaine (magnetik) - Iker Ibarguren (ikerib) + - Michael Hirschler (mvhirsch) - Michael Holm (hollo) - Blanchon Vincent (blanchonvincent) - Christian Schmidt - Ben Hakim - - Stiven Llupa (sllupa) - Marco Petersen (ocrampete16) - Bohan Yang (brentybh) - Vilius Grigaliūnas @@ -520,7 +522,6 @@ The Symfony Connect username in parenthesis allows to get more information - Thierry T (lepiaf) - Lorenz Schori - Lukáš Holeczy (holicz) - - Jonathan H. Wage - Jeremy Livingston (jeremylivingston) - ivan - SUMIDA, Ippei (ippey_s) @@ -541,7 +542,6 @@ The Symfony Connect username in parenthesis allows to get more information - Francesco Levorato - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) - - Michael Hirschler (mvhirsch) - Gyula Sallai (salla) - Hendrik Luup (hluup) - Inal DJAFAR (inalgnu) @@ -582,6 +582,7 @@ The Symfony Connect username in parenthesis allows to get more information - Sanpi (sanpi) - Eduardo Gulias (egulias) - giulio de donato (liuggio) + - Ivan Mezinov - ShinDarth - Stéphane PY (steph_py) - Cătălin Dan (dancatalin) @@ -649,6 +650,7 @@ The Symfony Connect username in parenthesis allows to get more information - quentin neyrat (qneyrat) - Chris Tanaskoski (devristo) - Steffen Roßkamp + - Andrey Lebedev (alebedev) - Alexandru Furculita (afurculita) - Michel Salib (michelsalib) - Ben Roberts (benr77) @@ -750,7 +752,6 @@ The Symfony Connect username in parenthesis allows to get more information - Roberto Espinoza (respinoza) - Pierre Rineau - Soufian EZ ZANTAR (soezz) - - Ivan Mezinov - Marek Zajac - Adam Harvey - ilyes kooli (skafandri) @@ -764,6 +765,7 @@ The Symfony Connect username in parenthesis allows to get more information - Patrick Reimers (preimers) - Brayden Williams (redstar504) - insekticid + - Kieran Brahney - Jérémy M (th3mouk) - Trent Steel (trsteel88) - boombatower @@ -785,6 +787,7 @@ The Symfony Connect username in parenthesis allows to get more information - Matthew Grasmick - Miroslav Šustek (sustmi) - Pablo Díez (pablodip) + - Kev - Kevin McBride - Sergio Santoro - Philipp Rieber (bicpi) @@ -909,7 +912,6 @@ The Symfony Connect username in parenthesis allows to get more information - Ramunas Pabreza (doobas) - Yuriy Vilks (igrizzli) - Terje Bråten - - Andrey Lebedev (alebedev) - Sebastian Krebs - Piotr Stankowski - Pierre-Emmanuel Tanguy (petanguy) @@ -1011,6 +1013,7 @@ The Symfony Connect username in parenthesis allows to get more information - Aurimas Niekis (gcds) - Vincent Chalamon - Matthieu Calie (matth--) + - Sem Schidler (xvilo) - Benjamin Schoch (bschoch) - Martins Sipenko - Guilherme Augusto Henschel @@ -1057,6 +1060,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ivan Grigoriev (greedyivan) - Johann Saunier (prophet777) - Kevin SCHNEKENBURGER + - Geordie - Fabien Salles (blacked) - Andreas Erhard (andaris) - alexpozzi @@ -1135,11 +1139,11 @@ The Symfony Connect username in parenthesis allows to get more information - Aleksandr Volochnev (exelenz) - Robin van der Vleuten (robinvdvleuten) - Grinbergs Reinis (shima5) - - Kieran Brahney - Klaus Silveira (klaussilveira) - Michael Piecko (michael.piecko) - Toni Peric (tperic) - yclian + - Nicolas DOUSSON - radar3301 - Aleksey Prilipko - Jelle Raaijmakers (gmta) @@ -1148,7 +1152,6 @@ The Symfony Connect username in parenthesis allows to get more information - Wybren Koelmans (wybren_koelmans) - Roberto Nygaard - victor-prdh - - Kev - Davide Borsatto (davide.borsatto) - Florian Hermann (fhermann) - zenas1210 @@ -1182,6 +1185,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mathias Brodala (mbrodala) - Robert Fischer (sandoba) - Tarjei Huse (tarjei) + - Travis Carden (traviscarden) - mfettig - Besnik Br - Issam Raouf (iraouf) @@ -1243,6 +1247,7 @@ The Symfony Connect username in parenthesis allows to get more information - Volodymyr Panivko - kick-the-bucket - fedor.f + - roman joly (eltharin) - Yosmany Garcia (yosmanyga) - Jeremiasz Major - Jibé Barth (jibbarth) @@ -1262,6 +1267,7 @@ The Symfony Connect username in parenthesis allows to get more information - possum - Denis Zunke (donalberto) - Adrien Roches (neirda24) + - Thomas Trautner (thomastr) - _sir_kane (waly) - Olivier Maisonneuve - Gálik Pál @@ -1292,6 +1298,7 @@ The Symfony Connect username in parenthesis allows to get more information - Zhuravlev Alexander (scif) - Stefano Degenkamp (steef) - James Michael DuPont + - Tinjo Schöni - Carlos Buenosvinos (carlosbuenosvinos) - Christian Gripp (core23) - Jake (jakesoft) @@ -1350,6 +1357,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ana Raro - Ana Raro - Tony Malzhacker + - Cosmin Sandu - Andreas Lutro (anlutro) - DUPUCH (bdupuch) - Cyril Quintin (cyqui) @@ -1399,6 +1407,7 @@ The Symfony Connect username in parenthesis allows to get more information - Matthieu Mota (matthieumota) - Maxime Pinot (maximepinot) - Jean-Baptiste GOMOND (mjbgo) + - Jakub Podhorsky (podhy) - abdul malik ikhsan (samsonasik) - Henry Snoek (snoek09) - Morgan Auchede @@ -1430,6 +1439,7 @@ The Symfony Connect username in parenthesis allows to get more information - Johnson Page (jwpage) - Kuba Werłos (kuba) - Ruben Gonzalez (rubenruateltek) + - Mokhtar Tlili (sf-djuba) - Michael Roterman (wtfzdotnet) - Philipp Keck - Pavol Tuka @@ -1470,6 +1480,7 @@ The Symfony Connect username in parenthesis allows to get more information - Nicolas de Marqué (nicola) - Thiago Cordeiro (thiagocordeiro) - Matthieu Bontemps + - Ian Irlen - Rootie - Sébastien Santoro (dereckson) - Daniel Alejandro Castro Arellano (lexcast) @@ -1671,6 +1682,7 @@ The Symfony Connect username in parenthesis allows to get more information - Bruno Rodrigues de Araujo (brunosinister) - Máximo Cuadros (mcuadros) - Jacek Wilczyński (jacekwilczynski) + - Christoph Kappestein - Camille Baronnet - EXT - THERAGE Kevin - tamirvs @@ -1832,11 +1844,11 @@ The Symfony Connect username in parenthesis allows to get more information - Peter Smeets (darkspartan) - Julien Bianchi (jubianchi) - Michael Dawart (mdawart) - - Sem Schidler (xvilo) - Robert Meijers - Tijs Verkoyen - James Sansbury - Marcin Chwedziak + - Dan Kadera - hjkl - Dan Wilga - Thijs Reijgersberg @@ -2271,7 +2283,6 @@ The Symfony Connect username in parenthesis allows to get more information - DidierLmn - Pedro Silva - Chihiro Adachi (chihiro-adachi) - - Thomas Trautner (thomastr) - Jeroen de Graaf - Ulrik McArdle - BiaDd @@ -2292,6 +2303,7 @@ The Symfony Connect username in parenthesis allows to get more information - Fabian Haase - roog - parinz1234 + - seho-nl - Romain Geissler - Martin Auswöger - Adrien Moiruad @@ -2396,6 +2408,7 @@ The Symfony Connect username in parenthesis allows to get more information - Raphael Hardt - Ivan Nemets - Qingshan Luo + - Michael Olšavský - Ergie Gonzaga - Matthew J Mucklo - AnrDaemon @@ -2501,6 +2514,7 @@ The Symfony Connect username in parenthesis allows to get more information - Nicolas Badey (nico-b) - Olivier Scherler (oscherler) - Flo Gleixner (redflo) + - Romain Jacquart (romainjacquart) - Shane Preece (shane) - Stephan Wentz (temp) - Johannes Goslar @@ -2680,7 +2694,6 @@ The Symfony Connect username in parenthesis allows to get more information - Flinsch - Maciej Schmidt - botbotbot - - Cosmin Sandu - tatankat - Cláudio Cesar - Timon van der Vorm @@ -2846,7 +2859,6 @@ The Symfony Connect username in parenthesis allows to get more information - Boudry Julien - amcastror - Bram Van der Sype (brammm) - - roman joly (eltharin) - Guile (guile) - Mark Beech (jaybizzle) - Julien Moulin (lizjulien) @@ -2907,6 +2919,7 @@ The Symfony Connect username in parenthesis allows to get more information - J Bruni - Alexey Prilipko - vlakoff + - Anthony Tenneriello - thib92 - Yiorgos Kalligeros - Rudolf Ratusiński @@ -2923,6 +2936,7 @@ The Symfony Connect username in parenthesis allows to get more information - Frédéric G. Marand (fgm) - Freek Van der Herten (freekmurze) - Luca Genuzio (genuzio) + - Ben Gamra Housseine (hbgamra) - Andrew Marcinkevičius (ifdattic) - Ioana Hazsda (ioana-hazsda) - Jan Marek (janmarek) @@ -3175,13 +3189,11 @@ The Symfony Connect username in parenthesis allows to get more information - Olivier Laviale (olvlvl) - Pierre Gasté (pierre_g) - Pablo Monterde Perez (plebs) - - Jakub Podhorsky (podhy) - Pierre-Olivier Vares (povares) - Jimmy Leger (redpanda) - Ronny López (ronnylt) - Julius (sakalys) - Sébastien JEAN (sebastien76) - - Mokhtar Tlili (sf-djuba) - Dmitry (staratel) - Marcin Szepczynski (szepczynski) - Tito Miguel Costa (titomiguelcosta) @@ -3193,7 +3205,6 @@ The Symfony Connect username in parenthesis allows to get more information - Yorkie Chadwick (yorkie76) - Zakaria AMMOURA (zakariaamm) - Maxime Aknin (3m1x4m) - - Geordie - Pavel Barton - Exploit.cz - GuillaumeVerdon @@ -3203,7 +3214,6 @@ The Symfony Connect username in parenthesis allows to get more information - Youpie - Jason Stephens - srsbiz - - Tinjo Schöni - Taylan Kasap - Michael Orlitzky - Nicolas A. Bérard-Nault From f206376f48d11a8e94134a2edd3509adde92c515 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Jun 2024 13:42:41 +0200 Subject: [PATCH 04/59] Update VERSION for 5.4.41 --- 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 0c4a13666d829..9a612d805283f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.41-DEV'; + public const VERSION = '5.4.41'; public const VERSION_ID = 50441; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 41; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From d38d44fc29ae96419f5318efe3767878765adc1c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Jun 2024 13:47:30 +0200 Subject: [PATCH 05/59] Bump Symfony version to 5.4.42 --- 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 9a612d805283f..92d007a395f40 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.41'; - public const VERSION_ID = 50441; + public const VERSION = '5.4.42-DEV'; + public const VERSION_ID = 50442; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 41; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 42; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From 995c3c7f9f4d1faa6c2ba425a40f1e93c6d03b91 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Jun 2024 13:52:40 +0200 Subject: [PATCH 06/59] Bump Symfony version to 6.4.10 --- 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 d20596d9c3298..85d35d47ffd05 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.4.9'; - public const VERSION_ID = 60409; + public const VERSION = '6.4.10-DEV'; + public const VERSION_ID = 60410; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 9; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 10; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2026'; public const END_OF_LIFE = '11/2027'; From 19debc1109a249bd0ad3eb8b1f57b067dc51b1ad Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 28 Jun 2024 17:37:05 +0200 Subject: [PATCH 07/59] Fix MockArraySessionStorage to generate more conform ids --- .../Session/Storage/MockArraySessionStorage.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 77bb38f157c12..c6a28b1a4cfdc 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -226,14 +226,11 @@ public function getMetadataBag() /** * Generates a session ID. * - * This doesn't need to be particularly cryptographically secure since this is just - * a mock. - * * @return string */ protected function generateId() { - return hash('sha256', uniqid('ss_mock_', true)); + return bin2hex(random_bytes(16)); } protected function loadSession() From 76897814d67677224c90fff475ea9abdb266245d Mon Sep 17 00:00:00 2001 From: Nei Santos Date: Fri, 28 Jun 2024 17:30:16 -0300 Subject: [PATCH 08/59] Fixes #54550 some pt_BR translations --- .../Security/Core/Resources/translations/security.pt_BR.xlf | 4 ++-- .../Validator/Resources/translations/validators.pt_BR.xlf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.pt_BR.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.pt_BR.xlf index 675b600e83783..e3d7631db1474 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.pt_BR.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.pt_BR.xlf @@ -64,7 +64,7 @@ Too many failed login attempts, please try again later. - Muitas tentativas de login malsucedidas, tente novamente mais tarde. + Muitas tentativas de login malsucedidas, por favor, tente novamente mais tarde. Invalid or expired login link. @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Muitas tentativas de login sem sucesso, por favor tente novamente em %minutes% minutos. + Muitas tentativas de login sem sucesso, por favor, tente novamente em %minutes% minutos. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf index e5fe095eace75..d1e653dbac4ce 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf @@ -440,7 +440,7 @@ This URL is missing a top-level domain. - Esta URL está faltando um domínio de topo. + Esta URL está faltando o domínio de nível superior. From d9b669be7b52b6d831319c149bd7070107400a39 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 28 Jun 2024 22:17:57 +0200 Subject: [PATCH 09/59] fix AssetMapper usage without assets enabled --- .../DependencyInjection/FrameworkExtension.php | 4 ++++ .../Fixtures/php/asset_mapper_without_assets.php | 10 ++++++++++ .../Fixtures/xml/asset_mapper_without_assets.xml | 14 ++++++++++++++ .../Fixtures/yml/asset_mapper_without_assets.yml | 8 ++++++++ .../FrameworkExtensionTestCase.php | 10 ++++++++++ 5 files changed, 46 insertions(+) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 84dbeabe98bdd..83518061fed36 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1334,6 +1334,10 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde { $loader->load('asset_mapper.php'); + if (!$assetEnabled) { + $container->removeDefinition('asset_mapper.asset_package'); + } + if (!$httpClientEnabled) { $container->register('asset_mapper.http_client', HttpClientInterface::class) ->addTag('container.error') diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php new file mode 100644 index 0000000000000..8a74333b19324 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php @@ -0,0 +1,10 @@ +loadFromExtension('framework', [ + 'annotations' => false, + 'asset_mapper' => null, + 'assets' => false, + 'handle_all_throwables' => true, + 'http_method_override' => false, + 'php_errors' => ['log' => true], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml new file mode 100644 index 0000000000000..3976b1064222d --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml new file mode 100644 index 0000000000000..51f302b668843 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml @@ -0,0 +1,8 @@ +framework: + annotations: false + asset_mapper: ~ + assets: false + handle_all_throwables: true + http_method_override: false + php_errors: + log: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php index 55de5cc247652..705ec5f3144e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php @@ -2386,6 +2386,16 @@ public function testWebhookWithoutSerializer() ); } + public function testAssetMapperWithoutAssets() + { + $container = $this->createContainerFromFile('asset_mapper_without_assets'); + + $this->assertTrue($container->has('asset_mapper')); + $this->assertFalse($container->has('asset_mapper.asset_package')); + $this->assertFalse($container->has('assets.packages')); + $this->assertFalse($container->has('assets._default_package')); + } + protected function createContainer(array $data = []) { return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([ From ef6b821079a9ac520f6aa0fca44a09cf8b5f060c Mon Sep 17 00:00:00 2001 From: V1nicius00 Date: Fri, 28 Jun 2024 22:07:12 -0300 Subject: [PATCH 10/59] [Security][Validator] Added missing Portuguese(pt) translations --- .../Resources/translations/security.pt.xlf | 18 ++++----- .../Resources/translations/validators.pt.xlf | 40 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf index 5ae30c96f8ca9..f9fda8d7b048e 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.pt.xlf @@ -4,7 +4,7 @@ An authentication exception occurred. - Ocorreu uma excepção durante a autenticação. + Ocorreu uma exceção durante a autenticação. Authentication credentials could not be found. @@ -12,7 +12,7 @@ Authentication request could not be processed due to a system problem. - O pedido de autenticação não foi concluído devido a um problema no sistema. + A autenticação não foi concluída devido a um problema no sistema. Invalid credentials. @@ -24,7 +24,7 @@ Not privileged to request the resource. - Não possui privilégios para aceder a este recurso. + Sem privilégios para solicitar este recurso. Invalid CSRF token. @@ -36,7 +36,7 @@ No session available, it either timed out or cookies are not enabled. - Não existe sessão disponível, esta expirou ou os cookies estão desativados. + Nenhuma sessão disponível, esta expirou ou os cookies estão desativados. No token could be found. @@ -44,7 +44,7 @@ Username could not be found. - Nome de utilizador não encontrado. + Nome de usuário não encontrado. Account has expired. @@ -60,11 +60,11 @@ Account is locked. - A conta está trancada. + A conta está bloqueada. Too many failed login attempts, please try again later. - Várias tentativas de login falhadas, por favor tente mais tarde. + Muitas tentativas de login sem sucesso, por favor, tente mais tarde. Invalid or expired login link. @@ -72,11 +72,11 @@ Too many failed login attempts, please try again in %minutes% minute. - Demasiadas tentativas de login, tente novamente num minuto. + Muitas tentativas de login sem sucesso, por favor, tente novamente novamente em 1 minuto. Too many failed login attempts, please try again in %minutes% minutes. - Muitas tentativas de login sem sucesso, por favor tente novamente em %minutes% minutos. + Muitas tentativas de login sem sucesso, por favor, tente novamente em %minutes% minutos. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf index ed28ee31ea639..54c2f46b64f75 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf @@ -88,7 +88,7 @@ This value should not be blank. - Este valor não deveria ser branco/vazio. + Este valor não deveria ser vazio. This value should not be null. @@ -108,7 +108,7 @@ This value is not a valid URL. - Este valor não é um URL válido. + Este valor não é uma URL válida. The two values should be equal. @@ -120,11 +120,11 @@ The file is too large. - O ficheiro é muito grande. + O arquivo é muito grande. The file could not be uploaded. - Não foi possível carregar o ficheiro. + Não foi possível enviar o arquivo. This value should be a valid number. @@ -132,7 +132,7 @@ This file is not a valid image. - Este ficheiro não é uma imagem. + Este arquivo não é uma imagem. This value is not a valid IP address. @@ -144,11 +144,11 @@ This value is not a valid locale. - Este valor não é um 'locale' válido. + Este valor não é uma localidade válida. This value is not a valid country. - Este valor não é um País válido. + Este valor não é um país válido. This value is already used. @@ -156,7 +156,7 @@ The size of the image could not be detected. - O tamanho da imagem não foi detetado. + O tamanho da imagem não foi detectado. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. @@ -164,7 +164,7 @@ The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - A largura da imagem ({{ width }}px) é muito pequena. A largura miníma da imagem é de: {{ min_width }}px. + A largura da imagem ({{ width }}px) é muito pequena. A largura mínima da imagem é de: {{ min_width }}px. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. @@ -172,7 +172,7 @@ The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - A altura da imagem ({{ height }}px) é muito pequena. A altura miníma da imagem é de: {{ min_height }}px. + A altura da imagem ({{ height }}px) é muito pequena. A altura mínima da imagem é de: {{ min_height }}px. This value should be the user's current password. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Este valor deve possuir exatamente {{ limit }} caracteres. + Este valor deve possuir exatamente {{ limit }} caractere.|Este valor deve possuir exatamente {{ limit }} caracteres. The file was only partially uploaded. @@ -308,7 +308,7 @@ This value does not match the expected {{ charset }} charset. - O valor não corresponde ao conjunto de caracteres {{ charset }} esperado. + Este valor não corresponde ao conjunto de caracteres {{ charset }} esperado. This value is not a valid Business Identifier Code (BIC). @@ -340,7 +340,7 @@ This value should be positive. - Este valor deve ser estritamente positivo. + Este valor deve ser positivo. This value should be either positive or zero. @@ -348,7 +348,7 @@ This value should be negative. - Este valor deve ser estritamente negativo. + Este valor deve ser negativo. This value should be either negative or zero. @@ -360,11 +360,11 @@ This password has been leaked in a data breach, it must not be used. Please use another password. - Esta senha foi divulgada durante uma fuga de dados, não deve ser usada de novamente. Por favor usar uma senha outra. + Esta senha foi divulgada durante um vazamento de dados, não deve ser usada de novamente. Por favor usar uma senha outra. This value should be between {{ min }} and {{ max }}. - Este valor deve situar-se entre {{ min }} e {{ max }}. + Este valor deve estar entre {{ min }} e {{ max }}. This value is not a valid hostname. @@ -376,7 +376,7 @@ This value should satisfy at least one of the following constraints: - Este valor deve satisfazer pelo menos uma das seguintes restrições : + Este valor deve satisfazer pelo menos uma das seguintes restrições: Each element of this collection should satisfy its own set of constraints. @@ -428,11 +428,11 @@ The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. - A extensão do ficheiro é inválida ({{ extension }}). As extensões permitidas são {{ extensions }}. + A extensão do arquivo é inválida ({{ extension }}). As extensões permitidas são {{ extensions }}. The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. - A codificação de carateres detetada é inválida ({{ detected }}). As codificações permitidas são {{ encodings }}. + A codificação de carateres detectada é inválida ({{ detected }}). As codificações permitidas são {{ encodings }}. This value is not a valid MAC address. @@ -440,7 +440,7 @@ This URL is missing a top-level domain. - Esta URL está faltando um domínio de topo. + Esta URL está faltando o domínio de nível superior. From 0e6cd07718e512f07506d5a1b9fa7841be3efb92 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 29 Jun 2024 07:04:59 +0200 Subject: [PATCH 11/59] normalize underscores in snake() --- src/Symfony/Component/String/AbstractUnicodeString.php | 2 +- src/Symfony/Component/String/ByteString.php | 2 +- src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/String/AbstractUnicodeString.php b/src/Symfony/Component/String/AbstractUnicodeString.php index 0f840f19d717d..13ff7163eaeed 100644 --- a/src/Symfony/Component/String/AbstractUnicodeString.php +++ b/src/Symfony/Component/String/AbstractUnicodeString.php @@ -367,7 +367,7 @@ public function reverse(): parent public function snake(): parent { $str = clone $this; - $str->string = str_replace(' ', '_', mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1 \2', $str->string), 'UTF-8')); + $str->string = preg_replace('/[ _]+/', '_', mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1 \2', $str->string), 'UTF-8')); return $str; } diff --git a/src/Symfony/Component/String/ByteString.php b/src/Symfony/Component/String/ByteString.php index 86887d7901a74..e4ad7a680f51b 100644 --- a/src/Symfony/Component/String/ByteString.php +++ b/src/Symfony/Component/String/ByteString.php @@ -367,7 +367,7 @@ public function slice(int $start = 0, ?int $length = null): parent public function snake(): parent { $str = clone $this; - $str->string = str_replace(' ', '_', strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1 \2', $str->string))); + $str->string = preg_replace('/[ _]+/', '_', strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1 \2', $str->string))); return $str; } diff --git a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php index 132d558dbade4..42e8fda6f026d 100644 --- a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php +++ b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php @@ -1079,6 +1079,9 @@ public static function provideSnake() ['symfony', 'SYMFONY'], ['symfony_is_great', 'SYMFONY IS GREAT'], ['symfony_is_great', 'SYMFONY_IS_GREAT'], + ['symfony_is_great', 'symfony is great'], + ['symfony_is_great', 'SYMFONY IS GREAT'], + ['symfony_is_great', 'SYMFONY _ IS _ GREAT'], ]; } From 6ca2390533908c84329c66ad5cbe34ae0de1a1b7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 29 Jun 2024 08:53:48 +0200 Subject: [PATCH 12/59] Compare paths after realpath() has been applied to both --- src/Symfony/Component/HttpKernel/Kernel.php | 1 + src/Symfony/Component/HttpKernel/Tests/KernelTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 85d35d47ffd05..4f06ff8944ba9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -539,6 +539,7 @@ protected function initializeContainer() touch($oldContainerDir.'.legacy'); } + $buildDir = $this->container->getParameter('kernel.build_dir'); $cacheDir = $this->container->getParameter('kernel.cache_dir'); $preload = $this instanceof WarmableInterface ? (array) $this->warmUp($cacheDir, $buildDir) : []; diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index fc5cffb6a7a48..94c498a0f2808 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -563,7 +563,7 @@ public function testWarmup() $kernel->boot(); $this->assertTrue($kernel->warmedUp); - $this->assertSame($kernel->getBuildDir(), $kernel->warmedUpBuildDir); + $this->assertSame(realpath($kernel->getBuildDir()), $kernel->warmedUpBuildDir); } public function testServicesResetter() From 6397c383f48441a778ec660e558dc005f4e189aa Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 1 Jul 2024 14:16:24 +0200 Subject: [PATCH 13/59] [String] Revert "Fixed u()->snake(), b()->snake() and s()->snake() methods" --- src/Symfony/Component/String/AbstractUnicodeString.php | 6 +++--- src/Symfony/Component/String/ByteString.php | 4 ++-- .../Component/String/Tests/AbstractAsciiTestCase.php | 10 ++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/String/AbstractUnicodeString.php b/src/Symfony/Component/String/AbstractUnicodeString.php index 13ff7163eaeed..21aa22e186a64 100644 --- a/src/Symfony/Component/String/AbstractUnicodeString.php +++ b/src/Symfony/Component/String/AbstractUnicodeString.php @@ -162,7 +162,7 @@ public function ascii(array $rules = []): self public function camel(): parent { $str = clone $this; - $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) use (&$i) { + $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?!\p{Lu})/u', static function ($m) use (&$i) { return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string))); @@ -366,8 +366,8 @@ public function reverse(): parent public function snake(): parent { - $str = clone $this; - $str->string = preg_replace('/[ _]+/', '_', mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1 \2', $str->string), 'UTF-8')); + $str = $this->camel(); + $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8'); return $str; } diff --git a/src/Symfony/Component/String/ByteString.php b/src/Symfony/Component/String/ByteString.php index e4ad7a680f51b..05170da801c0e 100644 --- a/src/Symfony/Component/String/ByteString.php +++ b/src/Symfony/Component/String/ByteString.php @@ -366,8 +366,8 @@ public function slice(int $start = 0, ?int $length = null): parent public function snake(): parent { - $str = clone $this; - $str->string = preg_replace('/[ _]+/', '_', strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1 \2', $str->string))); + $str = $this->camel(); + $str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string)); return $str; } diff --git a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php index 42e8fda6f026d..0f80dcf74e1df 100644 --- a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php +++ b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php @@ -1046,6 +1046,7 @@ public static function provideCamel() ['symfonyIsGreat', 'symfony_is_great'], ['symfony5IsGreat', 'symfony_5_is_great'], ['symfonyIsGreat', 'Symfony is great'], + ['SYMFONYISGREAT', 'SYMFONY_IS_GREAT'], ['symfonyIsAGreatFramework', 'Symfony is a great framework'], ['symfonyIsGREAT', '*Symfony* is GREAT!!'], ['SYMFONY', 'SYMFONY'], @@ -1077,11 +1078,12 @@ public static function provideSnake() ['symfony_is_great', 'symfonyIsGREAT'], ['symfony_is_really_great', 'symfonyIsREALLYGreat'], ['symfony', 'SYMFONY'], - ['symfony_is_great', 'SYMFONY IS GREAT'], - ['symfony_is_great', 'SYMFONY_IS_GREAT'], + ['symfonyisgreat', 'SYMFONY IS GREAT'], + ['symfonyisgreat', 'SYMFONY_IS_GREAT'], ['symfony_is_great', 'symfony is great'], - ['symfony_is_great', 'SYMFONY IS GREAT'], - ['symfony_is_great', 'SYMFONY _ IS _ GREAT'], + ['symfonyisgreat', 'SYMFONY IS GREAT'], + ['symfonyisgreat', 'SYMFONY _ IS _ GREAT'], + ['symfony_isgreat', 'Symfony IS GREAT!'], ]; } From 0bf9e72900827aa4e14d2a9c787fff216356bad6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 1 Jul 2024 22:41:03 +0200 Subject: [PATCH 14/59] force HTTP 1.1 for Mailgun API requests --- .../Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php index e95f212bb75de..e10cb79593a52 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php @@ -61,6 +61,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e $endpoint = sprintf('%s/v3/%s/messages', $this->getEndpoint(), urlencode($this->domain)); $response = $this->client->request('POST', 'https://'.$endpoint, [ + 'http_version' => '1.1', 'auth_basic' => 'api:'.$this->key, 'headers' => $headers, 'body' => $body->bodyToIterable(), From c0915ea02b1cc121cf285e885575081a15e151c4 Mon Sep 17 00:00:00 2001 From: Daniel Tiringer Date: Wed, 3 Jul 2024 20:27:44 +0200 Subject: [PATCH 15/59] [Security] Verify Hungarian translation --- .../Security/Core/Resources/translations/security.hu.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.hu.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.hu.xlf index bdee5f6813fbf..06096dc4a2879 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.hu.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.hu.xlf @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Túl sok sikertelen bejelentkezési kísérlet, kérjük, próbálja újra %minutes% perc múlva. + Túl sok sikertelen bejelentkezési kísérlet, kérjük, próbálja újra %minutes% perc múlva. From de7d8849eb1332d5d7ce29b3eab142baeb985920 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Thu, 4 Jul 2024 11:24:54 +0200 Subject: [PATCH 16/59] =?UTF-8?q?[Router]=C2=A0Discard=20in-memory=20cache?= =?UTF-8?q?=20of=20routes=20when=20writing=20the=20file-based=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Symfony/Component/Routing/Router.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index 48ec1018056f6..e3d38c4919501 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -294,6 +294,7 @@ function (ConfigCacheInterface $cache) { } $cache->write($dumper->dump(), $this->getRouteCollection()->getResources()); + unset(self::$cache[$cache->getPath()]); } ); @@ -325,6 +326,7 @@ function (ConfigCacheInterface $cache) { $dumper = $this->getGeneratorDumperInstance(); $cache->write($dumper->dump(), $this->getRouteCollection()->getResources()); + unset(self::$cache[$cache->getPath()]); } ); From f098683ce61f2c2baaa43262339a7b6bbc003f59 Mon Sep 17 00:00:00 2001 From: Mathias Arlaud Date: Mon, 1 Jul 2024 14:52:42 +0200 Subject: [PATCH 17/59] [PropertyInfo] Handle collection in PhpStan same as PhpDoc --- .../Tests/Extractor/PhpDocExtractorTest.php | 2 ++ .../Tests/Extractor/PhpStanExtractorTest.php | 2 ++ .../Extractor/ReflectionExtractorTest.php | 3 +++ .../PropertyInfo/Tests/Fixtures/Dummy.php | 5 +++++ .../Tests/Fixtures/DummyCollection.php | 20 +++++++++++++++++++ .../PropertyInfo/Util/PhpStanTypeHelper.php | 2 +- 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyCollection.php diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php index 57869e40819bb..9719f0bf24bf6 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy; +use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyCollection; use Symfony\Component\PropertyInfo\Tests\Fixtures\ParentDummy; use Symfony\Component\PropertyInfo\Tests\Fixtures\PseudoTypeDummy; use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\DummyUsedInTrait; @@ -160,6 +161,7 @@ public static function typesProvider() null, ], ['self', [new Type(Type::BUILTIN_TYPE_OBJECT, false, Dummy::class)], null, null], + ['collectionAsObject', [new Type(Type::BUILTIN_TYPE_OBJECT, false, DummyCollection::class, true, [new Type(Type::BUILTIN_TYPE_INT)], [new Type(Type::BUILTIN_TYPE_STRING)])], null, null], ]; } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php index 8786785774878..d3c3f4d366cf7 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php @@ -17,6 +17,7 @@ use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummyWithoutDocBlock; use Symfony\Component\PropertyInfo\Tests\Fixtures\DefaultValue; use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy; +use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyCollection; use Symfony\Component\PropertyInfo\Tests\Fixtures\ParentDummy; use Symfony\Component\PropertyInfo\Tests\Fixtures\RootDummy\RootDummyItem; use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\AnotherNamespace\DummyInAnotherNamespace; @@ -130,6 +131,7 @@ public static function typesProvider() ['self', [new Type(Type::BUILTIN_TYPE_OBJECT, false, Dummy::class)]], ['rootDummyItems', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, RootDummyItem::class))]], ['rootDummyItem', [new Type(Type::BUILTIN_TYPE_OBJECT, false, RootDummyItem::class)]], + ['collectionAsObject', [new Type(Type::BUILTIN_TYPE_OBJECT, false, DummyCollection::class, true, [new Type(Type::BUILTIN_TYPE_INT)], [new Type(Type::BUILTIN_TYPE_STRING)])]], ]; } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 06e8bc53f87b5..59823cc1c1085 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -53,6 +53,7 @@ public function testGetProperties() 'bal', 'parent', 'collection', + 'collectionAsObject', 'nestedCollection', 'mixedCollection', 'B', @@ -118,6 +119,7 @@ public function testGetPropertiesWithCustomPrefixes() 'bal', 'parent', 'collection', + 'collectionAsObject', 'nestedCollection', 'mixedCollection', 'B', @@ -172,6 +174,7 @@ public function testGetPropertiesWithNoPrefixes() 'bal', 'parent', 'collection', + 'collectionAsObject', 'nestedCollection', 'mixedCollection', 'B', diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index cf0c791784695..ee07eb703aac2 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -46,6 +46,11 @@ class Dummy extends ParentDummy */ public $collection; + /** + * @var DummyCollection + */ + public $collectionAsObject; + /** * @var string[][] */ diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyCollection.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyCollection.php new file mode 100644 index 0000000000000..e8799d8f6be07 --- /dev/null +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyCollection.php @@ -0,0 +1,20 @@ + + * + * 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; + +final class DummyCollection implements \IteratorAggregate +{ + public function getIterator(): \Traversable + { + return []; + } +} diff --git a/src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php b/src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php index 6171530abadc7..dff891aa571db 100644 --- a/src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php +++ b/src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php @@ -121,7 +121,7 @@ private function extractTypes(TypeNode $node, NameScope $nameScope): array return [$mainType]; } - $collection = $mainType->isCollection() || \in_array($mainType->getClassName(), [\Traversable::class, \Iterator::class, \IteratorAggregate::class, \ArrayAccess::class, \Generator::class], true); + $collection = $mainType->isCollection() || \is_a($mainType->getClassName(), \Traversable::class, true) || \is_a($mainType->getClassName(), \ArrayAccess::class, true); // it's safer to fall back to other extractors if the generic type is too abstract if (!$collection && !class_exists($mainType->getClassName())) { From a6d0f3bb44c4a56501af9ee16d13a4cc5449f4d1 Mon Sep 17 00:00:00 2001 From: Willem Mouwen Date: Tue, 2 Jul 2024 21:27:13 +0200 Subject: [PATCH 18/59] test: kebab-case to snake_case --- src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php index 0f80dcf74e1df..14727da2394d2 100644 --- a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php +++ b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php @@ -1070,6 +1070,8 @@ public static function provideSnake() ['x_y', 'x_y'], ['x_y', 'X_Y'], ['xu_yo', 'xu_yo'], + ['symfony_is_great', 'symfony-is-great'], + ['symfony_is_great', 'symfony.is.great'], ['symfony_is_great', 'symfonyIsGreat'], ['symfony5_is_great', 'symfony5IsGreat'], ['symfony5is_great', 'symfony5isGreat'], From 6cfef7e435b0007f5eca6cc82175d1ee34e0813f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 6 Jul 2024 07:14:17 +0200 Subject: [PATCH 19/59] use copy() instead of rename() on Windows On Windows depending on the PHP version rename() can fail if the target file is being executed. Since the source file is not used by another process using copy() instead should be safe to be used. --- .../Component/Cache/Traits/FilesystemCommonTrait.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php index 0455093c9b93c..ab7e7dd90fe64 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php @@ -114,8 +114,13 @@ private function write(string $file, string $data, ?int $expiresAt = null) touch($this->tmp, $expiresAt ?: time() + 31556952); // 1 year in seconds } - $success = rename($this->tmp, $file); - $unlink = !$success; + if ('\\' === \DIRECTORY_SEPARATOR) { + $success = copy($this->tmp, $file); + $unlink = true; + } else { + $success = rename($this->tmp, $file); + $unlink = !$success; + } return $success; } finally { From 92093b95c283afba9497092012930d089ca74b22 Mon Sep 17 00:00:00 2001 From: Mark Schmale Date: Mon, 8 Jul 2024 15:20:15 +0200 Subject: [PATCH 20/59] Change incorrect check for the `stateless` request attribute We only want to use the session if the request is **not** `stateless`. The old code used the sesison only in `stateless` requests (so requests not intended to use the session (=state) at all). --- .../Bundle/WebProfilerBundle/Controller/ProfilerController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 23895f70bb6ec..a7c0644fdd1bf 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -180,7 +180,7 @@ public function searchBarAction(Request $request): Response $this->cspHandler?->disableCsp(); $session = null; - if ($request->attributes->getBoolean('_stateless') && $request->hasSession()) { + if (!$request->attributes->getBoolean('_stateless') && $request->hasSession()) { $session = $request->getSession(); } From bb1bf2879ce613616c02e4a27620bfb472fe07ed Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 8 Jul 2024 21:30:21 +0200 Subject: [PATCH 21/59] Fix typo --- .../Command/SecretsDecryptToLocalCommand.php | 2 +- src/Symfony/Component/Dotenv/Tests/DotenvTest.php | 12 ++++++------ .../HttpClient/Tests/CurlHttpClientTest.php | 2 +- .../HttpFoundation/Tests/BinaryFileResponseTest.php | 2 +- .../Tests/EventListener/LocaleListenerTest.php | 2 +- .../Tests/EventListener/SessionListenerTest.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php index 24bb242d91d15..1eaf3d0c91f28 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php @@ -50,7 +50,7 @@ protected function configure() %command.full_name% -When the option --force is provided, secrets that already exist in the local vault are overriden. +When the --force option is provided, secrets that already exist in the local vault are overridden. %command.full_name% --force EOF diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index 72d0d5630ec9a..644126d6b2ba1 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -430,16 +430,16 @@ public function testHttpVarIsPartiallyOverridden() $this->assertSame('http_value', $_SERVER['HTTP_TEST_ENV_VAR']); } - public function testEnvVarIsOverriden() + public function testEnvVarIsOverridden() { - putenv('TEST_ENV_VAR_OVERRIDEN=original_value'); + putenv('TEST_ENV_VAR_OVERRIDDEN=original_value'); $dotenv = (new Dotenv())->usePutenv(); - $dotenv->populate(['TEST_ENV_VAR_OVERRIDEN' => 'new_value'], true); + $dotenv->populate(['TEST_ENV_VAR_OVERRIDDEN' => 'new_value'], true); - $this->assertSame('new_value', getenv('TEST_ENV_VAR_OVERRIDEN')); - $this->assertSame('new_value', $_ENV['TEST_ENV_VAR_OVERRIDEN']); - $this->assertSame('new_value', $_SERVER['TEST_ENV_VAR_OVERRIDEN']); + $this->assertSame('new_value', getenv('TEST_ENV_VAR_OVERRIDDEN')); + $this->assertSame('new_value', $_ENV['TEST_ENV_VAR_OVERRIDDEN']); + $this->assertSame('new_value', $_SERVER['TEST_ENV_VAR_OVERRIDDEN']); } public function testMemorizingLoadedVarsNamesInSpecialVar() diff --git a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php index ec43a83a075db..3ff0c9ac17c9c 100644 --- a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php @@ -121,7 +121,7 @@ public function testOverridingInternalAttributesUsingCurlOptions() $httpClient->request('POST', 'http://localhost:8057/', [ 'extra' => [ 'curl' => [ - \CURLOPT_PRIVATE => 'overriden private', + \CURLOPT_PRIVATE => 'overridden private', ], ], ]); diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index 222b5f2987294..4599bd84b6ae9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -368,7 +368,7 @@ public function testAcceptRangeOnUnsafeMethods() $this->assertEquals('none', $response->headers->get('Accept-Ranges')); } - public function testAcceptRangeNotOverriden() + public function testAcceptRangeNotOverridden() { $request = Request::create('/', 'POST'); $response = new BinaryFileResponse(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index e22950ddd913a..2b536337712d0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -204,7 +204,7 @@ public function testRequestNoLocaleFromAcceptLanguageHeader() $this->assertEquals('de', $request->getLocale()); } - public function testRequestAttributeLocaleNotOverridenFromAcceptLanguageHeader() + public function testRequestAttributeLocaleNotOverriddenFromAcceptLanguageHeader() { $request = Request::create('/'); $request->attributes->set('_locale', 'it'); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php index 7b3cc8159257b..9e7171a83587d 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php @@ -539,7 +539,7 @@ public function testUninitializedSessionWithoutInitializedSession() $this->assertSame('60', $response->headers->getCacheControlDirective('s-maxage')); } - public function testResponseHeadersMaxAgeAndExpiresNotBeOverridenIfSessionStarted() + public function testResponseHeadersMaxAgeAndExpiresNotBeOverriddenIfSessionStarted() { $session = $this->createMock(Session::class); $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); From 35d60669ab2616ad41dd2c1760069b3720969feb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 8 Jul 2024 11:06:36 +0200 Subject: [PATCH 22/59] [AssetMapper] Split test dirs in tests --- .../CompiledAssetMapperConfigReaderTest.php | 4 +-- .../ImportMap/ImportMapConfigReaderTest.php | 19 +++++----- .../ImportMap/ImportMapGeneratorTest.php | 5 ++- .../Tests/ImportMap/ImportMapManagerTest.php | 10 ++---- .../ImportMap/RemotePackageDownloaderTest.php | 2 +- .../ImportMap/RemotePackageStorageTest.php | 35 +++++++++++-------- ...MapperAwareAssetPackageIntegrationTest.php | 25 +++++++++---- .../Path/LocalPublicAssetsFilesystemTest.php | 4 +-- 8 files changed, 57 insertions(+), 47 deletions(-) diff --git a/src/Symfony/Component/AssetMapper/Tests/CompiledAssetMapperConfigReaderTest.php b/src/Symfony/Component/AssetMapper/Tests/CompiledAssetMapperConfigReaderTest.php index 355bf838e1c25..8619c2b3719d4 100644 --- a/src/Symfony/Component/AssetMapper/Tests/CompiledAssetMapperConfigReaderTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/CompiledAssetMapperConfigReaderTest.php @@ -23,8 +23,8 @@ class CompiledAssetMapperConfigReaderTest extends TestCase protected function setUp(): void { $this->filesystem = new Filesystem(); - $this->writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing')) { + $this->writableRoot = __DIR__.'/../Fixtures/compiled_asset_mapper_config_reader'; + if (!file_exists(__DIR__.'/../Fixtures/compiled_asset_mapper_config_reader')) { $this->filesystem->mkdir($this->writableRoot); } // realpath to help path comparisons in the tests diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapConfigReaderTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapConfigReaderTest.php index fbfb8b4654664..a9737be5408fa 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapConfigReaderTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapConfigReaderTest.php @@ -26,17 +26,14 @@ class ImportMapConfigReaderTest extends TestCase protected function setUp(): void { $this->filesystem = new Filesystem(); - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing')) { - $this->filesystem->mkdir(__DIR__.'/../Fixtures/importmaps_for_writing'); - } - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing/assets')) { - $this->filesystem->mkdir(__DIR__.'/../Fixtures/importmaps_for_writing/assets'); + if (!file_exists(__DIR__.'/../Fixtures/importmap_config_reader/assets')) { + $this->filesystem->mkdir(__DIR__.'/../Fixtures/importmap_config_reader/assets'); } } protected function tearDown(): void { - $this->filesystem->remove(__DIR__.'/../Fixtures/importmaps_for_writing'); + $this->filesystem->remove(__DIR__.'/../Fixtures/importmap_config_reader'); } public function testGetEntriesAndWriteEntries() @@ -63,7 +60,7 @@ public function testGetEntriesAndWriteEntries() ], ]; EOF; - file_put_contents(__DIR__.'/../Fixtures/importmaps_for_writing/importmap.php', $importMap); + file_put_contents(__DIR__.'/../Fixtures/importmap_config_reader/importmap.php', $importMap); $remotePackageStorage = $this->createMock(RemotePackageStorage::class); $remotePackageStorage->expects($this->any()) @@ -72,7 +69,7 @@ public function testGetEntriesAndWriteEntries() return '/path/to/vendor/'.$packageModuleSpecifier.'.'.$type->value; }); $reader = new ImportMapConfigReader( - __DIR__.'/../Fixtures/importmaps_for_writing/importmap.php', + __DIR__.'/../Fixtures/importmap_config_reader/importmap.php', $remotePackageStorage, ); $entries = $reader->getEntries(); @@ -100,11 +97,11 @@ public function testGetEntriesAndWriteEntries() $this->assertSame('package/with_file.js', $packageWithFileEntry->packageModuleSpecifier); // now save the original raw data from importmap.php and delete the file - $originalImportMapData = (static fn () => include __DIR__.'/../Fixtures/importmaps_for_writing/importmap.php')(); - unlink(__DIR__.'/../Fixtures/importmaps_for_writing/importmap.php'); + $originalImportMapData = (static fn () => eval('?>'.file_get_contents(__DIR__.'/../Fixtures/importmap_config_reader/importmap.php')))(); + unlink(__DIR__.'/../Fixtures/importmap_config_reader/importmap.php'); // dump the entries back to the file $reader->writeEntries($entries); - $newImportMapData = (static fn () => include __DIR__.'/../Fixtures/importmaps_for_writing/importmap.php')(); + $newImportMapData = (static fn () => eval('?>'.file_get_contents(__DIR__.'/../Fixtures/importmap_config_reader/importmap.php')))(); $this->assertSame($originalImportMapData, $newImportMapData); } diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapGeneratorTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapGeneratorTest.php index deafa38e2cef8..24289ff3d6740 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapGeneratorTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapGeneratorTest.php @@ -30,10 +30,9 @@ class ImportMapGeneratorTest extends TestCase private AssetMapperInterface&MockObject $assetMapper; private CompiledAssetMapperConfigReader&MockObject $compiledConfigReader; private ImportMapConfigReader&MockObject $configReader; - private ImportMapGenerator $importMapGenerator; private Filesystem $filesystem; - private static string $writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; + private static string $writableRoot = __DIR__.'/../Fixtures/importmap_generator'; protected function setUp(): void { @@ -725,7 +724,7 @@ private function createImportMapGenerator(): ImportMapGenerator return ImportMapEntry::createRemote($importName, $type, $path, $version, $packageModuleSpecifier, $isEntrypoint); }); - return $this->importMapGenerator = new ImportMapGenerator( + return new ImportMapGenerator( $this->assetMapper, $this->compiledConfigReader, $this->configReader, diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php index 551a60492460d..51764e654f529 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php @@ -32,18 +32,14 @@ class ImportMapManagerTest extends TestCase private PackageResolverInterface&MockObject $packageResolver; private ImportMapConfigReader&MockObject $configReader; private RemotePackageDownloader&MockObject $remotePackageDownloader; - private ImportMapManager $importMapManager; private Filesystem $filesystem; - private static string $writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; + private static string $writableRoot = __DIR__.'/../Fixtures/importmap_manager'; protected function setUp(): void { $this->filesystem = new Filesystem(); - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing')) { - $this->filesystem->mkdir(self::$writableRoot); - } - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing/assets')) { + if (!file_exists(__DIR__.'/../Fixtures/importmap_manager/assets')) { $this->filesystem->mkdir(self::$writableRoot.'/assets'); } } @@ -386,7 +382,7 @@ private function createImportMapManager(): ImportMapManager return ImportMapEntry::createRemote($importName, $type, $path, $version, $packageModuleSpecifier, $isEntrypoint); }); - return $this->importMapManager = new ImportMapManager( + return new ImportMapManager( $this->assetMapper, $this->configReader, $this->remotePackageDownloader, diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php index e3e8cff663894..b03d0dc63430d 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php @@ -24,7 +24,7 @@ class RemotePackageDownloaderTest extends TestCase { private Filesystem $filesystem; - private static string $writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; + private static string $writableRoot = __DIR__.'/../Fixtures/remote_package_downloader'; protected function setUp(): void { diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php index 0019f604cc8c5..9064eecc1856d 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php @@ -20,14 +20,14 @@ class RemotePackageStorageTest extends TestCase { private Filesystem $filesystem; - private static string $writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; + private static string $writableRoot; + private static int $writableRootIndex = 0; protected function setUp(): void { + self::$writableRoot = sys_get_temp_dir().'/remote_package_storage'.++self::$writableRootIndex; $this->filesystem = new Filesystem(); - if (!$this->filesystem->exists(self::$writableRoot)) { - $this->filesystem->mkdir(self::$writableRoot); - } + $this->filesystem->mkdir(self::$writableRoot); } protected function tearDown(): void @@ -41,19 +41,24 @@ public function testGetStorageDir() $this->assertSame(realpath(self::$writableRoot.'/assets/vendor'), realpath($storage->getStorageDir())); } - public function testSaveThrowsWhenVendorDirectoryIsNotWritable() + public function testSaveThrowsWhenFailing() { - $this->filesystem->mkdir($vendorDir = self::$writableRoot.'/assets/acme/vendor'); - $this->filesystem->chmod($vendorDir, 0555); + $vendorDir = self::$writableRoot.'/assets/acme/vendor'; + $this->filesystem->mkdir($vendorDir.'/module_specifier'); + $this->filesystem->touch($vendorDir.'/module_specifier/module_specifier.index.js'); + $this->filesystem->chmod($vendorDir.'/module_specifier/module_specifier.index.js', 0555); $storage = new RemotePackageStorage($vendorDir); $entry = ImportMapEntry::createRemote('foo', ImportMapType::JS, '/does/not/matter', '1.0.0', 'module_specifier', false); $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage('file_put_contents('.$vendorDir.'/module_specifier/module_specifier.index.js): Failed to open stream: No such file or directory'); - $storage->save($entry, 'any content'); + $this->expectExceptionMessage('file_put_contents('.$vendorDir.'/module_specifier/module_specifier.index.js): Failed to open stream: Permission denied'); - $this->filesystem->remove($vendorDir); + try { + $storage->save($entry, 'any content'); + } finally { + $this->filesystem->chmod($vendorDir.'/module_specifier/module_specifier.index.js', 0777); + } } public function testIsDownloaded() @@ -106,7 +111,7 @@ public function testSaveExtraFile() public function testGetDownloadedPath(string $packageModuleSpecifier, ImportMapType $importMapType, string $expectedPath) { $storage = new RemotePackageStorage(self::$writableRoot.'/assets/vendor'); - $this->assertSame($expectedPath, $storage->getDownloadPath($packageModuleSpecifier, $importMapType)); + $this->assertSame(self::$writableRoot.$expectedPath, $storage->getDownloadPath($packageModuleSpecifier, $importMapType)); } public static function getDownloadPathTests(): iterable @@ -114,25 +119,25 @@ public static function getDownloadPathTests(): iterable yield 'javascript bare package' => [ 'packageModuleSpecifier' => 'foo', 'importMapType' => ImportMapType::JS, - 'expectedPath' => self::$writableRoot.'/assets/vendor/foo/foo.index.js', + 'expectedPath' => '/assets/vendor/foo/foo.index.js', ]; yield 'javascript package with path' => [ 'packageModuleSpecifier' => 'foo/bar', 'importMapType' => ImportMapType::JS, - 'expectedPath' => self::$writableRoot.'/assets/vendor/foo/bar.js', + 'expectedPath' => '/assets/vendor/foo/bar.js', ]; yield 'javascript package with path and extension' => [ 'packageModuleSpecifier' => 'foo/bar.js', 'importMapType' => ImportMapType::JS, - 'expectedPath' => self::$writableRoot.'/assets/vendor/foo/bar.js', + 'expectedPath' => '/assets/vendor/foo/bar.js', ]; yield 'CSS package with path' => [ 'packageModuleSpecifier' => 'foo/bar', 'importMapType' => ImportMapType::CSS, - 'expectedPath' => self::$writableRoot.'/assets/vendor/foo/bar.css', + 'expectedPath' => '/assets/vendor/foo/bar.css', ]; } } diff --git a/src/Symfony/Component/AssetMapper/Tests/MapperAwareAssetPackageIntegrationTest.php b/src/Symfony/Component/AssetMapper/Tests/MapperAwareAssetPackageIntegrationTest.php index 28818fd7a6515..821e660c6aae4 100644 --- a/src/Symfony/Component/AssetMapper/Tests/MapperAwareAssetPackageIntegrationTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/MapperAwareAssetPackageIntegrationTest.php @@ -11,18 +11,31 @@ namespace Symfony\Component\AssetMapper\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\Asset\Packages; use Symfony\Component\AssetMapper\Tests\Fixtures\AssetMapperTestAppKernel; +use Symfony\Component\Filesystem\Filesystem; -class MapperAwareAssetPackageIntegrationTest extends KernelTestCase +class MapperAwareAssetPackageIntegrationTest extends TestCase { - public function testDefaultAssetPackageIsDecorated() + private AssetMapperTestAppKernel $kernel; + private Filesystem $filesystem; + + protected function setUp(): void + { + $this->filesystem = new Filesystem(); + $this->kernel = new AssetMapperTestAppKernel('test', true); + $this->kernel->boot(); + } + + protected function tearDown(): void { - $kernel = new AssetMapperTestAppKernel('test', true); - $kernel->boot(); + $this->filesystem->remove($this->kernel->getProjectDir().'/var'); + } - $packages = $kernel->getContainer()->get('public.assets.packages'); + public function testDefaultAssetPackageIsDecorated() + { + $packages = $this->kernel->getContainer()->get('public.assets.packages'); \assert($packages instanceof Packages); $this->assertSame('/assets/file1-b3445cb7a86a0795a7af7f2004498aef.css', $packages->getUrl('file1.css')); $this->assertSame('/non-existent.css', $packages->getUrl('non-existent.css')); diff --git a/src/Symfony/Component/AssetMapper/Tests/Path/LocalPublicAssetsFilesystemTest.php b/src/Symfony/Component/AssetMapper/Tests/Path/LocalPublicAssetsFilesystemTest.php index 4363ccbf577a8..5e24546e0fbe8 100644 --- a/src/Symfony/Component/AssetMapper/Tests/Path/LocalPublicAssetsFilesystemTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/Path/LocalPublicAssetsFilesystemTest.php @@ -18,12 +18,12 @@ class LocalPublicAssetsFilesystemTest extends TestCase { private Filesystem $filesystem; - private static string $writableRoot = __DIR__.'/../Fixtures/importmaps_for_writing'; + private static string $writableRoot = __DIR__.'/../Fixtures/local_public_assets_filesystem'; protected function setUp(): void { $this->filesystem = new Filesystem(); - if (!file_exists(__DIR__.'/../Fixtures/importmaps_for_writing')) { + if (!file_exists(__DIR__.'/../Fixtures/local_public_assets_filesystem')) { $this->filesystem->mkdir(self::$writableRoot); } } From 97e713b7f9e6f7a54dbeb54ef2b00bf2298738af Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 9 Jul 2024 14:08:44 +0200 Subject: [PATCH 23/59] [Contracts][HttpClient] Skip tests when zlib's `ob_gzhandler()` doesn't exist --- .../Component/HttpClient/Tests/HttplugClientTest.php | 6 ++++++ src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php | 3 +++ .../Contracts/HttpClient/Test/HttpClientTestCase.php | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/Symfony/Component/HttpClient/Tests/HttplugClientTest.php b/src/Symfony/Component/HttpClient/Tests/HttplugClientTest.php index 0e62425b6b698..41ed55eda7822 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttplugClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/HttplugClientTest.php @@ -37,6 +37,9 @@ public static function tearDownAfterClass(): void TestHttpServer::stop(); } + /** + * @requires function ob_gzhandler + */ public function testSendRequest() { $client = new HttplugClient(new NativeHttpClient()); @@ -51,6 +54,9 @@ public function testSendRequest() $this->assertSame('HTTP/1.1', $body['SERVER_PROTOCOL']); } + /** + * @requires function ob_gzhandler + */ public function testSendAsyncRequest() { $client = new HttplugClient(new NativeHttpClient()); diff --git a/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php b/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php index d1f4deb03a006..65b7f5b3f6794 100644 --- a/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php @@ -33,6 +33,9 @@ public static function tearDownAfterClass(): void TestHttpServer::stop(); } + /** + * @requires function ob_gzhandler + */ public function testSendRequest() { $factory = new Psr17Factory(); diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php index 994e92621ff25..10c6395c6acf8 100644 --- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php +++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php @@ -25,6 +25,10 @@ abstract class HttpClientTestCase extends TestCase { public static function setUpBeforeClass(): void { + if (!function_exists('ob_gzhandler')) { + static::markTestSkipped('The "ob_gzhandler" function is not available.'); + } + TestHttpServer::start(); } From 7b5d17fa8af40eb1f0acb26b975a76a907f05d81 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Jul 2024 20:35:14 +0200 Subject: [PATCH 24/59] fix merge --- .../EventListener/SendFailedMessageForRetryListenerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php b/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php index 3108a56b1731e..defa4cc4245df 100644 --- a/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php +++ b/src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent; use Symfony\Component\Messenger\Event\WorkerMessageRetriedEvent; From 770e7fc92e873f744cf386dc09452865017d7c77 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Jul 2024 22:57:15 +0200 Subject: [PATCH 25/59] use more entropy with uniqid() --- .../Bridge/PhpUnit/Tests/DeprecationErrorHandler/log_file.phpt | 2 +- .../Tests/CacheWarmer/AnnotationsCacheWarmerTest.php | 2 +- .../Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php | 2 +- src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php | 2 +- .../Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php | 2 +- .../Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/log_file.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/log_file.phpt index 7f114ab5e2e5a..51f8d6cb1b21e 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/log_file.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/log_file.phpt @@ -2,7 +2,7 @@ Test DeprecationErrorHandler with log file --FILE-- cacheDir = sys_get_temp_dir().'/'.uniqid(); + $this->cacheDir = sys_get_temp_dir().'/'.uniqid('', true); $fs = new Filesystem(); $fs->mkdir($this->cacheDir); parent::setUp(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php index 85975c62170e0..f44eefedf66ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php @@ -36,7 +36,7 @@ class ConfigBuilderCacheWarmerTest extends TestCase protected function setUp(): void { - $this->varDir = sys_get_temp_dir().'/'.uniqid(); + $this->varDir = sys_get_temp_dir().'/'.uniqid('', true); $fs = new Filesystem(); $fs->mkdir($this->varDir); } diff --git a/src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php b/src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php index c7578774e6cc1..2b5042512162c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Iqsms/IqsmsTransport.php @@ -64,7 +64,7 @@ protected function doSend(MessageInterface $message): SentMessage 'phone' => $message->getPhone(), 'text' => $message->getSubject(), 'sender' => $this->from, - 'clientId' => uniqid(), + 'clientId' => uniqid('', true), ], ], 'login' => $this->login, diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php index 97c067196eb03..dad9dd98c416e 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php @@ -33,7 +33,7 @@ protected function setUp(): void { parent::setUp(); - $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.uniqid('CompiledUrlMatcher').'.php'; + $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.uniqid('CompiledUrlMatcher', true).'.php'; } protected function tearDown(): void diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php index 6d562e30f57fd..43e764abe111c 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryCompilerTest.php @@ -29,7 +29,7 @@ final class ClassMetadataFactoryCompilerTest extends TestCase protected function setUp(): void { - $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_serializer_metadata.'.uniqid('CompiledClassMetadataFactory').'.php'; + $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_serializer_metadata.'.uniqid('CompiledClassMetadataFactory', true).'.php'; } protected function tearDown(): void From 0bec5794d2066f65a9397be3f428276057ae34c3 Mon Sep 17 00:00:00 2001 From: Greg Korba Date: Tue, 9 Jul 2024 12:41:52 +0200 Subject: [PATCH 26/59] Support for PHP-CS-Fixer's parallel runner --- .php-cs-fixer.dist.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6d5d4c2dfa0a5..3a51ed538ba69 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -23,6 +23,8 @@ EOF; return (new PhpCsFixer\Config()) + // @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777 + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setRules([ '@PHP71Migration' => true, '@PHPUnit75Migration:risky' => true, From b8778375607a95e823edfcd943a1487828b7a540 Mon Sep 17 00:00:00 2001 From: Konstantin Chigakov Date: Sun, 7 Jul 2024 06:41:48 +0400 Subject: [PATCH 27/59] [Cache] Improve `dbindex` DSN parameter parsing --- .../Cache/Tests/Traits/RedisTraitTest.php | 75 +++++++++++++++++++ .../Component/Cache/Traits/RedisTrait.php | 8 +- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php b/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php index 650a0c71c1c2e..9373ff6c9217f 100644 --- a/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php +++ b/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\SkippedTestSuiteError; use PHPUnit\Framework\TestCase; +use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Traits\RedisTrait; /** @@ -133,4 +134,78 @@ public function testPconnectSelectsCorrectDatabase() ini_set('redis.pconnect.connection_limit', $prevPoolSize); } } + + /** + * @dataProvider provideDbIndexDsnParameter + */ + public function testDbIndexDsnParameter(string $dsn, int $expectedDb) + { + if (!getenv('REDIS_AUTHENTICATED_HOST')) { + self::markTestSkipped('REDIS_AUTHENTICATED_HOST env var is not defined.'); + } + + $mock = new class () { + use RedisTrait; + }; + $connection = $mock::createConnection($dsn); + self::assertSame($expectedDb, $connection->getDbNum()); + } + + public static function provideDbIndexDsnParameter(): array + { + return [ + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST'), + 0, + ], + [ + 'redis:?host['.getenv('REDIS_HOST').']', + 0, + ], + [ + 'redis:?host['.getenv('REDIS_HOST').']&dbindex=1', + 1, + ], + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'?dbindex=2', + 2, + ], + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/4', + 4, + ], + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/?dbindex=5', + 5, + ], + ]; + } + + /** + * @dataProvider provideInvalidDbIndexDsnParameter + */ + public function testInvalidDbIndexDsnParameter(string $dsn) + { + if (!getenv('REDIS_AUTHENTICATED_HOST')) { + self::markTestSkipped('REDIS_AUTHENTICATED_HOST env var is not defined.'); + } + $this->expectException(InvalidArgumentException::class); + + $mock = new class () { + use RedisTrait; + }; + $mock::createConnection($dsn); + } + + public static function provideInvalidDbIndexDsnParameter(): array + { + return [ + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/abc' + ], + [ + 'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/3?dbindex=6' + ] + ]; + } } diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 518a563060240..129254bd68c7a 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -152,10 +152,10 @@ public static function createConnection(string $dsn, array $options = []) if (isset($params['host']) || isset($params['path'])) { if (!isset($params['dbindex']) && isset($params['path'])) { if (preg_match('#/(\d+)?$#', $params['path'], $m)) { - $params['dbindex'] = $m[1] ?? '0'; + $params['dbindex'] = $m[1] ?? $query['dbindex'] ?? '0'; $params['path'] = substr($params['path'], 0, -\strlen($m[0])); } elseif (isset($params['host'])) { - throw new InvalidArgumentException('Invalid Redis DSN: query parameter "dbindex" must be a number.'); + throw new InvalidArgumentException('Invalid Redis DSN: parameter "dbindex" must be a number.'); } } @@ -170,6 +170,10 @@ public static function createConnection(string $dsn, array $options = []) throw new InvalidArgumentException('Invalid Redis DSN: missing host.'); } + if (isset($params['dbindex'], $query['dbindex']) && $params['dbindex'] !== $query['dbindex']) { + throw new InvalidArgumentException('Invalid Redis DSN: path and query "dbindex" parameters mismatch.'); + } + $params += $query + $options + self::$defaultConnectionOptions; if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class) && !class_exists(\RedisSentinel::class)) { From b91e8a273af1860e4c5f8ce8bb10eb3ce7663e4e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Jul 2024 11:35:34 +0200 Subject: [PATCH 28/59] use more entropy with uniqid() --- .../Tests/Factory/HttpFoundationFactoryTest.php | 4 ++-- .../Tests/Factory/PsrHttpFactoryTest.php | 6 +++--- .../PsrHttpMessage/Tests/Functional/CovertTest.php | 2 +- .../Bridge/Redis/Tests/Transport/ConnectionTest.php | 2 +- .../Serializer/Debug/TraceableSerializer.php | 12 ++++++------ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php b/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php index ed2b7e9d8e2bf..e40992e372428 100644 --- a/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php +++ b/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php @@ -172,7 +172,7 @@ public function testCreateUploadedFile() $symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile); $size = $symfonyUploadedFile->getSize(); - $uniqid = uniqid(); + $uniqid = uniqid('', true); $symfonyUploadedFile->move($this->tmpDir, $uniqid); $this->assertEquals($uploadedFile->getSize(), $size); @@ -198,7 +198,7 @@ public function testCreateUploadedFileWithError() private function createUploadedFile(string $content, int $error, string $clientFileName, string $clientMediaType): UploadedFile { - $filePath = tempnam($this->tmpDir, uniqid()); + $filePath = tempnam($this->tmpDir, uniqid('', true)); file_put_contents($filePath, $content); return new UploadedFile($filePath, filesize($filePath), $error, $clientFileName, $clientMediaType); diff --git a/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/PsrHttpFactoryTest.php b/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/PsrHttpFactoryTest.php index 41629e8c69fc9..0c4122168449f 100644 --- a/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/PsrHttpFactoryTest.php +++ b/src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/PsrHttpFactoryTest.php @@ -131,7 +131,7 @@ public function testGetContentCanBeCalledAfterRequestCreation() private function createUploadedFile(string $content, string $originalName, string $mimeType, int $error): UploadedFile { - $path = tempnam($this->tmpDir, uniqid()); + $path = tempnam($this->tmpDir, uniqid('', true)); file_put_contents($path, $content); return new UploadedFile($path, $originalName, $mimeType, $error, true); @@ -182,7 +182,7 @@ public function testCreateResponseFromStreamed() public function testCreateResponseFromBinaryFile() { - $path = tempnam($this->tmpDir, uniqid()); + $path = tempnam($this->tmpDir, uniqid('', true)); file_put_contents($path, 'Binary'); $response = new BinaryFileResponse($path); @@ -194,7 +194,7 @@ public function testCreateResponseFromBinaryFile() public function testCreateResponseFromBinaryFileWithRange() { - $path = tempnam($this->tmpDir, uniqid()); + $path = tempnam($this->tmpDir, uniqid('', true)); file_put_contents($path, 'Binary'); $request = new Request(); diff --git a/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/CovertTest.php b/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/CovertTest.php index b0ea766922db5..c350f2964d7d5 100644 --- a/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/CovertTest.php +++ b/src/Symfony/Bridge/PsrHttpMessage/Tests/Functional/CovertTest.php @@ -217,7 +217,7 @@ public static function responseProvider(): array private static function createUploadedFile(string $content, string $originalName, string $mimeType, int $error): UploadedFile { - $path = tempnam(sys_get_temp_dir(), uniqid()); + $path = tempnam(sys_get_temp_dir(), uniqid('', true)); file_put_contents($path, $content); return new UploadedFile($path, $originalName, $mimeType, $error, true); diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php index b563540893d7f..28a840e6bb4e4 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php @@ -413,7 +413,7 @@ public function testInvalidSentinelMasterName() } $master = getenv('MESSENGER_REDIS_DSN'); - $uid = uniqid('sentinel_'); + $uid = uniqid('sentinel_', true); $exp = explode('://', $master, 2)[1]; $this->expectException(\InvalidArgumentException::class); diff --git a/src/Symfony/Component/Serializer/Debug/TraceableSerializer.php b/src/Symfony/Component/Serializer/Debug/TraceableSerializer.php index 2e375e08d610f..789ae65ca0aa8 100644 --- a/src/Symfony/Component/Serializer/Debug/TraceableSerializer.php +++ b/src/Symfony/Component/Serializer/Debug/TraceableSerializer.php @@ -41,7 +41,7 @@ public function __construct( public function serialize(mixed $data, string $format, array $context = []): string { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->serialize($data, $format, $context); @@ -56,7 +56,7 @@ public function serialize(mixed $data, string $format, array $context = []): str public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->deserialize($data, $type, $format, $context); @@ -71,7 +71,7 @@ public function deserialize(mixed $data, string $type, string $format, array $co public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->normalize($object, $format, $context); @@ -86,7 +86,7 @@ public function normalize(mixed $object, ?string $format = null, array $context public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->denormalize($data, $type, $format, $context); @@ -101,7 +101,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a public function encode(mixed $data, string $format, array $context = []): string { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->encode($data, $format, $context); @@ -116,7 +116,7 @@ public function encode(mixed $data, string $format, array $context = []): string public function decode(string $data, string $format, array $context = []): mixed { - $context[self::DEBUG_TRACE_ID] = $traceId = uniqid(); + $context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true); $startTime = microtime(true); $result = $this->serializer->decode($data, $format, $context); From 5a3c2a63c7318a4ca4c78d80b8a6c51da1a4b1c1 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 16 Jul 2024 09:39:12 +0200 Subject: [PATCH 29/59] [HttpFoundation] Add tests for `MethodRequestMatcher` and `SchemeRequestMatcher` --- .../Tests/RequestMatcher/MethodRequestMatcherTest.php | 7 +++++++ .../Tests/RequestMatcher/SchemeRequestMatcherTest.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/MethodRequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/MethodRequestMatcherTest.php index d4af82cd985ff..19db917fe6bf5 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/MethodRequestMatcherTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/MethodRequestMatcherTest.php @@ -27,6 +27,13 @@ public function test(string $requestMethod, array|string $matcherMethod, bool $i $this->assertSame($isMatch, $matcher->matches($request)); } + public function testAlwaysMatchesOnEmptyMethod() + { + $matcher = new MethodRequestMatcher([]); + $request = Request::create('https://example.com', 'POST'); + $this->assertTrue($matcher->matches($request)); + } + public static function getData() { return [ diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/SchemeRequestMatcherTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/SchemeRequestMatcherTest.php index f8d83645f1089..6614bfcc210f9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/SchemeRequestMatcherTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/SchemeRequestMatcherTest.php @@ -42,6 +42,13 @@ public function test(string $requestScheme, array|string $matcherScheme, bool $i } } + public function testAlwaysMatchesOnParamsHeaders() + { + $matcher = new SchemeRequestMatcher([]); + $request = Request::create('sftp://example.com'); + $this->assertTrue($matcher->matches($request)); + } + public static function getData() { return [ From 12e72476d6e37dfa92130742d2297500ce538f0b Mon Sep 17 00:00:00 2001 From: Amr Ezzat Date: Tue, 16 Jul 2024 22:23:07 +0300 Subject: [PATCH 30/59] [Core] Fix & Enhance security arabic translation. --- .../Security/Core/Resources/translations/security.ar.xlf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.ar.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.ar.xlf index d90e830ff18f4..f75eb12c005eb 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.ar.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.ar.xlf @@ -64,7 +64,7 @@ Too many failed login attempts, please try again later. - عدد كبير جدا من محاولات الدخول الفاشلة، يرجى المحاولة مرة أخرى في وقت لاحق. + العديد من محاولات الدخول الفاشلة، يرجى المحاولة مرة أخرى في وقت لاحق. Invalid or expired login link. @@ -72,11 +72,11 @@ Too many failed login attempts, please try again in %minutes% minute. - عدد كبير جدا من محاولات الدخول الفاشلة، يرجى اعادة المحاولة بعد %minutes% دقيقة. + العديد من محاولات الدخول الفاشلة، يرجى اعادة المحاولة بعد %minutes% دقيقة. Too many failed login attempts, please try again in %minutes% minutes. - عدد محاولات تسجيل الدخول الفاشلة كثيرة، الرجاء المحاولة مرة أخرى بعد %minutes% دقيقة.|عدد محاولات تسجيل الدخول الفاشلة كثيرة، الرجاء المحاولة مرة أخرى بعد %minutes% دقائق. + العديد من محاولات الدخول الفاشلة ، يرجى اعادة المحاولة بعد %minutes% دقائق. From 4c9445d58e9c2ce52f9b8dc92614e1febb82692c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 14 Jul 2024 23:06:23 +0200 Subject: [PATCH 31/59] fix compatibility with Redis Relay 0.8.1 --- .../Cache/Tests/Traits/RedisProxiesTest.php | 24 ++- .../Component/Cache/Traits/RelayProxy.php | 6 +- .../Cache/Traits/RelayProxyTrait.php | 156 ++++++++++++++++++ 3 files changed, 179 insertions(+), 7 deletions(-) create mode 100644 src/Symfony/Component/Cache/Traits/RelayProxyTrait.php diff --git a/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php b/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php index d12a2831fb484..4b144237ecd4b 100644 --- a/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php +++ b/src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Relay\Relay; +use Symfony\Component\Cache\Traits\RelayProxy; use Symfony\Component\VarExporter\LazyProxyTrait; use Symfony\Component\VarExporter\ProxyHelper; @@ -62,14 +63,30 @@ public function testRelayProxy() { $proxy = file_get_contents(\dirname(__DIR__, 2).'/Traits/RelayProxy.php'); $proxy = substr($proxy, 0, 4 + strpos($proxy, '[];')); + $expectedProxy = $proxy; $methods = []; + $expectedMethods = []; + + foreach ((new \ReflectionClass(RelayProxy::class))->getMethods() as $method) { + if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name) || $method->isStatic()) { + continue; + } + + $return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return '; + $expectedMethods[$method->name] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args}); + } + + EOPHP; + } foreach ((new \ReflectionClass(Relay::class))->getMethods() as $method) { if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name) || $method->isStatic()) { continue; } $return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return '; - $methods[] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<name] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args}); } @@ -80,6 +97,9 @@ public function testRelayProxy() uksort($methods, 'strnatcmp'); $proxy .= implode('', $methods)."}\n"; - $this->assertStringEqualsFile(\dirname(__DIR__, 2).'/Traits/RelayProxy.php', $proxy); + uksort($expectedMethods, 'strnatcmp'); + $expectedProxy .= implode('', $expectedMethods)."}\n"; + + $this->assertEquals($expectedProxy, $proxy); } } diff --git a/src/Symfony/Component/Cache/Traits/RelayProxy.php b/src/Symfony/Component/Cache/Traits/RelayProxy.php index ac839dfda9ca0..96d7d19b46785 100644 --- a/src/Symfony/Component/Cache/Traits/RelayProxy.php +++ b/src/Symfony/Component/Cache/Traits/RelayProxy.php @@ -28,6 +28,7 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter use LazyProxyTrait { resetLazyObject as reset; } + use RelayProxyTrait; private const LAZY_OBJECT_PROPERTY_SCOPES = []; @@ -291,11 +292,6 @@ public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $re return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args()); } - public function copy($src, $dst, $options = null): \Relay\Relay|false|int - { - return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); - } - public function echo($arg): \Relay\Relay|bool|string { return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); diff --git a/src/Symfony/Component/Cache/Traits/RelayProxyTrait.php b/src/Symfony/Component/Cache/Traits/RelayProxyTrait.php new file mode 100644 index 0000000000000..a1d252b96d2bf --- /dev/null +++ b/src/Symfony/Component/Cache/Traits/RelayProxyTrait.php @@ -0,0 +1,156 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Cache\Traits; + +if (version_compare(phpversion('relay'), '0.8.1', '>=')) { + /** + * @internal + */ + trait RelayProxyTrait + { + public function copy($src, $dst, $options = null): \Relay\Relay|bool + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); + } + + public function jsonArrAppend($key, $value_or_array, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrAppend(...\func_get_args()); + } + + public function jsonArrIndex($key, $path, $value, $start = 0, $stop = -1): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrIndex(...\func_get_args()); + } + + public function jsonArrInsert($key, $path, $index, $value, ...$other_values): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrInsert(...\func_get_args()); + } + + public function jsonArrLen($key, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrLen(...\func_get_args()); + } + + public function jsonArrPop($key, $path = null, $index = -1): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrPop(...\func_get_args()); + } + + public function jsonArrTrim($key, $path, $start, $stop): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrTrim(...\func_get_args()); + } + + public function jsonClear($key, $path = null): \Relay\Relay|false|int + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonClear(...\func_get_args()); + } + + public function jsonDebug($command, $key, $path = null): \Relay\Relay|false|int + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDebug(...\func_get_args()); + } + + public function jsonDel($key, $path = null): \Relay\Relay|false|int + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDel(...\func_get_args()); + } + + public function jsonForget($key, $path = null): \Relay\Relay|false|int + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonForget(...\func_get_args()); + } + + public function jsonGet($key, $options = [], ...$paths): mixed + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonGet(...\func_get_args()); + } + + public function jsonMerge($key, $path, $value): \Relay\Relay|bool + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMerge(...\func_get_args()); + } + + public function jsonMget($key_or_array, $path): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMget(...\func_get_args()); + } + + public function jsonMset($key, $path, $value, ...$other_triples): \Relay\Relay|bool + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMset(...\func_get_args()); + } + + public function jsonNumIncrBy($key, $path, $value): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumIncrBy(...\func_get_args()); + } + + public function jsonNumMultBy($key, $path, $value): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumMultBy(...\func_get_args()); + } + + public function jsonObjKeys($key, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjKeys(...\func_get_args()); + } + + public function jsonObjLen($key, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjLen(...\func_get_args()); + } + + public function jsonResp($key, $path = null): \Relay\Relay|array|false|int|string + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonResp(...\func_get_args()); + } + + public function jsonSet($key, $path, $value, $condition = null): \Relay\Relay|bool + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonSet(...\func_get_args()); + } + + public function jsonStrAppend($key, $value, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrAppend(...\func_get_args()); + } + + public function jsonStrLen($key, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrLen(...\func_get_args()); + } + + public function jsonToggle($key, $path): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonToggle(...\func_get_args()); + } + + public function jsonType($key, $path = null): \Relay\Relay|array|false + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonType(...\func_get_args()); + } + } +} else { + /** + * @internal + */ + trait RelayProxyTrait + { + public function copy($src, $dst, $options = null): \Relay\Relay|false|int + { + return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); + } + } +} From 22a0789a0085c3ee96f4ef715ecad8255cf0e105 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 17 Jul 2024 12:28:07 +0200 Subject: [PATCH 32/59] use firewall-specific user checkers when manually logging in users --- .../SecurityBundle/DependencyInjection/SecurityExtension.php | 3 +++ .../Bundle/SecurityBundle/Resources/config/security.php | 5 ++++- src/Symfony/Bundle/SecurityBundle/Security.php | 3 ++- src/Symfony/Bundle/SecurityBundle/Tests/SecurityTest.php | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 3d00b30a06fc4..383f68d203aca 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -579,6 +579,9 @@ private function createFirewall(ContainerBuilder $container, string $id, array $ $container->setAlias('security.user_checker.'.$id, new Alias($firewall['user_checker'], false)); + $userCheckerLocator = $container->getDefinition('security.user_checker_locator'); + $userCheckerLocator->replaceArgument(0, array_merge($userCheckerLocator->getArgument(0), [$id => new ServiceClosureArgument(new Reference('security.user_checker.'.$id))])); + foreach ($this->getSortedFactories() as $factory) { $key = str_replace('-', '_', $factory->getKey()); if ('custom_authenticators' !== $key && \array_key_exists($key, $firewall)) { diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php index d17254892215c..ccd77ad0e914d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php @@ -19,6 +19,7 @@ use Symfony\Bundle\SecurityBundle\Security\FirewallContext; use Symfony\Bundle\SecurityBundle\Security\FirewallMap; use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext; +use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; use Symfony\Component\Ldap\Security\LdapUserProvider; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; @@ -88,7 +89,7 @@ 'security.authenticator.managers_locator' => service('security.authenticator.managers_locator')->ignoreOnInvalid(), 'request_stack' => service('request_stack'), 'security.firewall.map' => service('security.firewall.map'), - 'security.user_checker' => service('security.user_checker'), + 'security.user_checker_locator' => service('security.user_checker_locator'), 'security.firewall.event_dispatcher_locator' => service('security.firewall.event_dispatcher_locator'), 'security.csrf.token_manager' => service('security.csrf.token_manager')->ignoreOnInvalid(), ]), @@ -124,6 +125,8 @@ ->args(['none']) ->set('security.user_checker', InMemoryUserChecker::class) + ->set('security.user_checker_locator', ServiceLocator::class) + ->args([[]]) ->set('security.expression_language', ExpressionLanguage::class) ->args([service('cache.security_expression_language')->nullOnInvalid()]) diff --git a/src/Symfony/Bundle/SecurityBundle/Security.php b/src/Symfony/Bundle/SecurityBundle/Security.php index 0c6260356e615..acb30adba8adf 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security.php +++ b/src/Symfony/Bundle/SecurityBundle/Security.php @@ -127,7 +127,8 @@ public function login(UserInterface $user, ?string $authenticatorName = null, ?s $authenticator = $this->getAuthenticator($authenticatorName, $firewallName); - $this->container->get('security.user_checker')->checkPreAuth($user); + $userCheckerLocator = $this->container->get('security.user_checker_locator'); + $userCheckerLocator->get($firewallName)->checkPreAuth($user); return $this->container->get('security.authenticator.managers_locator')->get($firewallName)->authenticateUser($user, $authenticator, $request, $badges); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityTest.php index 045dfc70a7c5e..35bd329b2297e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/SecurityTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/SecurityTest.php @@ -142,7 +142,7 @@ public function testLogin() ['request_stack', $requestStack], ['security.firewall.map', $firewallMap], ['security.authenticator.managers_locator', $this->createContainer('main', $userAuthenticator)], - ['security.user_checker', $userChecker], + ['security.user_checker_locator', $this->createContainer('main', $userChecker)], ]) ; @@ -188,7 +188,7 @@ public function testLoginReturnsAuthenticatorResponse() ['request_stack', $requestStack], ['security.firewall.map', $firewallMap], ['security.authenticator.managers_locator', $this->createContainer('main', $userAuthenticator)], - ['security.user_checker', $userChecker], + ['security.user_checker_locator', $this->createContainer('main', $userChecker)], ]) ; From 458efa7d8ef562468282ace173901f623e302b60 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 17 Jul 2024 16:17:24 +0200 Subject: [PATCH 33/59] restrict the maximum length of the X-Debug-Exception header --- .../Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php | 2 +- .../ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php index 05cbeec166b6e..0602ea4bdb1d6 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php @@ -72,7 +72,7 @@ public function render(\Throwable $exception): FlattenException { $headers = ['Content-Type' => 'text/html; charset='.$this->charset]; if (\is_bool($this->debug) ? $this->debug : ($this->debug)($exception)) { - $headers['X-Debug-Exception'] = rawurlencode($exception->getMessage()); + $headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000)); $headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine(); } diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php index e6c4c898e19df..69ec52cc8ca62 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php @@ -58,7 +58,7 @@ public function render(\Throwable $exception): FlattenException $headers = ['Vary' => 'Accept']; $debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception); if ($debug) { - $headers['X-Debug-Exception'] = rawurlencode($exception->getMessage()); + $headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000)); $headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine(); } From cfd553cc806f6f9e3eda76ed412184db08aaf51c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 17 Jul 2024 16:06:07 +0200 Subject: [PATCH 34/59] add validation message translations for the WordCount constraint --- .../Validator/Resources/translations/validators.af.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ar.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.az.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.be.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.bg.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.bs.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ca.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.cs.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.cy.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.da.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.de.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.el.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.en.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.es.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.et.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.eu.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.fa.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.fi.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.fr.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.gl.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.he.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.hr.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.hu.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.hy.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.id.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.it.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ja.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.lb.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.lt.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.lv.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.mk.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.mn.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.my.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.nb.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.nl.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.nn.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.no.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.pl.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.pt.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.pt_BR.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ro.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ru.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.sk.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.sl.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.sq.xlf | 8 ++++++++ .../Resources/translations/validators.sr_Cyrl.xlf | 8 ++++++++ .../Resources/translations/validators.sr_Latn.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.sv.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.th.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.tl.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.tr.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.uk.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.ur.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.uz.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.vi.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.zh_CN.xlf | 8 ++++++++ .../Validator/Resources/translations/validators.zh_TW.xlf | 8 ++++++++ 57 files changed, 456 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf index f975fc5164edb..e09d3fc06aa70 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Die URL mis 'n topvlakdomein. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf index 08012ac233bdd..94a91d42a71bb 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. هذا الرابط يفتقر إلى نطاق المستوى الأعلى. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf index 2eeae5f8a69ce..390e5f869c323 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Bu URL yuxarı səviyyəli domeni çatışmır. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf index a0665388e4bee..3ebae4cb6bb2f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Гэтаму URL бракуе дамен верхняга ўзроўню. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf index d2405339f0c35..dffefdb7d9056 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. На този URL липсва домейн от най-високо ниво. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf index 9fd444a59efff..f5e90aba54a7a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Ovom URL-u nedostaje domena najvišeg nivoa. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf index 652c0a48d693c..d0fd3a8aa39b4 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Aquesta URL no conté un domini de primer nivell. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf index 2c4c54d9f60af..459d07fd727cc 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Této URL chybí doména nejvyššího řádu. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf index a1ebdf7f81e24..7f3357daf5398 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Mae'r URL hwn yn colli parth lefel uchaf. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf index 808d8c6ad66d9..d80251b2a7483 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Denne URL mangler et topdomæne. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 3b65306314922..9d6f2c808f2bd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Dieser URL fehlt eine Top-Level-Domain. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf index a60471835745b..bb0ccb46e92ec 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Αυτή η διεύθυνση URL λείπει ένας τομέας ανώτατου επιπέδου. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index 721139011caec..cf08ea281938f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. This URL is missing a top-level domain. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index d58045471c70c..66ce4b60c5aec 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Esta URL no contiene una extensión de dominio (TLD). + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf index d9d641322976b..988bb0aa07203 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Sellel URL-il puudub ülataseme domeen. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf index bdcbaa393e6a1..362dfa9c0cd34 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. URL honek ez du goi-mailako domeinurik. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf index 0f2cf5bbf1fed..fb8b629b4d1a3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. این URL فاقد دامنه سطح بالا است. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf index e9ca6c83347a6..6b8902f014dc2 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Tästä URL-osoitteesta puuttuu ylätason verkkotunnus. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index 4e949d838cae7..bb76a4ec450b7 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Cette URL doit contenir un domaine de premier niveau. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf index 2a1199bed5c71..7885473fb2e84 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Esta URL non contén un dominio de nivel superior. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf index cd406b4eb86c8..6e5ab52297777 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. לכתובת URL זו חסר דומיין רמה עליונה. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index a7542a9353293..0ddbeb6f20c81 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Ovom URL-u nedostaje vršna domena. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf index a31848c775fde..0c8002ae1ecc4 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Az URL-ből hiányzik a legfelső szintű tartomány (top-level domain). + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf index d8ff322e6ed76..29f916fff06d1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Այս URL-ը չունի վերին մակարդակի դոմեյն: + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf index b894c69d855d6..2814599a0fc64 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. URL ini tidak memiliki domain tingkat atas. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf index 74f3a75b0c97e..1f409315e6dbf 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Questo URL è privo di un dominio di primo livello. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf index 9ec98ebbd47c4..d94a414e31998 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. このURLはトップレベルドメインがありません。 + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf index 28d1eff019aac..3c0a6f200e4f8 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Dësen URL feelt eng Top-Level-Domain. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index e16daea93b80f..e6f090e237f9d 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Šiam URL trūksta aukščiausio lygio domeno. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf index 66e370fea944d..9b2b9bd9f4485 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Šim URL trūkst augšējā līmeņa domēna. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf index d941f59ea8c8c..b891990799cd3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. На овој URL недостасува домен од највисоко ниво. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf index 4f997a7031592..987d73199ac09 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Энэ URL дээд түвшингийн домейн дутуу байна. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf index 57b6e276dc9c5..b7353e83a4c7d 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. ဤ URL တွင် အမြင့်ဆုံးအဆင့်ဒိုမိန်း ပါဝင်မရှိပါ။ + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf index 27a4d3c55a1ef..2abe0fb7f0805 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Denne URL-en mangler et toppnivådomene. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index aa4a3e2151f18..96e1d20d93d0f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Deze URL mist een top-level domein. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf index de400b7d5115c..e825815ced1b6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Denne URL-en manglar eit toppnivådomene. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf index 27a4d3c55a1ef..2abe0fb7f0805 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Denne URL-en mangler et toppnivådomene. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 42b6e9571b349..c6aa585d473c1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Podany URL nie zawiera domeny najwyższego poziomu. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf index 54c2f46b64f75..f771faa84f5de 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Esta URL está faltando o domínio de nível superior. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf index d1e653dbac4ce..e600bb17ff7f6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Esta URL está faltando o domínio de nível superior. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf index 3c0ace5490efd..79cf6941acc57 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Acestui URL îi lipsește un domeniu de nivel superior. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index dbee06a984b2c..70cb1144bf899 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. В этом URL отсутствует домен верхнего уровня. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf index 8886395e6e8c7..8785adcc18257 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Tomuto URL chýba doména najvyššej úrovne. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf index 03e750b8af75b..4926c1b4f815e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Temu URL manjka domena najvišje ravni. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf index e9b31b88258d9..9942b5cf26bc6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf @@ -451,6 +451,14 @@ This URL is missing a top-level domain. Kësaj URL i mungon një domain i nivelit të lartë. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf index 0550626d03f4d..3aa3be49e8d45 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Овом URL недостаје домен највишег нивоа. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf index 5a85bd764d3cc..ac7d7186dfee7 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Ovom URL nedostaje domen najvišeg nivoa. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf index d7be868c10e96..01668a87d21b3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Denna URL saknar en toppdomän. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf index 0d811ed040f88..c6f0b829a6af6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. URL นี้ขาดโดเมนระดับสูงสุด. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf index 8e8146a0faade..1d831bd8ea0f3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Kulang ang URL na ito sa top-level domain. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf index 3553af7b74ddd..685e6ca1a928d 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Bu URL bir üst düzey alan adı eksik. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf index 7b9918910b151..b67e3e604decc 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Цьому URL не вистачає домену верхнього рівня. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf index f994cb57a84e2..d18604407c71c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. اس URL میں ٹاپ لیول ڈومین موجود نہیں ہے۔ + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf index 1e43fb0fff8cf..d21bc24a3cc5b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. Bu URL yuqori darajali domenni o'z ichiga olmaydi. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf index b3073cc7370a0..e1cdb6d09fb91 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. URL này thiếu miền cấp cao. + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf index fabf86d3b0e13..15b234fb0d4ef 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. 此URL缺少顶级域名。 + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf index feee108a1bd3d..3812029fcad81 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf @@ -442,6 +442,14 @@ This URL is missing a top-level domain. 此URL缺少頂級域名。 + + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + + + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + From b0eaf91111a0e30eab09f0370615d44671890d3c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 13 Jul 2024 10:06:00 +0200 Subject: [PATCH 35/59] [Validator] Add German translation for `WordCount` constraint --- .../Validator/Resources/translations/validators.de.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 9d6f2c808f2bd..6a9919ddd36ad 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Dieser Wert ist zu kurz. Er muss aus mindestens einem Wort bestehen.|Dieser Wert ist zu kurz. Er muss mindestens {{ min }} Wörter enthalten. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Dieser Wert ist zu lang. Er darf maximal aus einem Wort bestehen.|Dieser Wert ist zu lang. Er darf maximal {{ max }} Wörter enthalten. From bd98f5d320436cd545a4d6273e86f6e01302b0eb Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 12 Jul 2024 16:49:44 +0200 Subject: [PATCH 36/59] [Validator] Add `WordCount` constraint French translation --- .../Validator/Resources/translations/validators.fr.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index bb76a4ec450b7..f06189712e3a0 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Cette valeur est trop courte. Elle doit contenir au moins un mot.|Cette valeur est trop courte. Elle doit contenir au moins {{ min }} mots. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Cette valeur est trop longue. Elle doit contenir au maximum un mot.|Cette valeur est trop longue. Elle doit contenir au maximum {{ max }} mots. From 7d8ccd914be2f3149fdb78cd96f72e792652a2cd Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 18 Jul 2024 10:51:08 +0300 Subject: [PATCH 37/59] [Validator] Add WordCount constraint Lithuanian translation --- .../Validator/Resources/translations/validators.lt.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index e6f090e237f9d..dc28eeba77223 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Per mažas žodžių skaičius. Turi susidaryti bent iš 1 žodžio.|Per mažas žodžių skaičius. Turi susidaryti iš {{ min }} arba daugiau žodžių. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Per didelis žodžių skaičius. Turi susidaryti iš 1 žodžio.|Per didelis žodžių skaičius. Turi susidaryti iš {{ max }} arba mažiau žodžių. From 3c6badbc7850c5efe466c82fa04826f9eb595903 Mon Sep 17 00:00:00 2001 From: Tomasz Kowalczyk Date: Fri, 19 Jul 2024 07:48:40 +0200 Subject: [PATCH 38/59] [Validator] added Polish translation for units 114 and 115 --- .../Validator/Resources/translations/validators.pl.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index c6aa585d473c1..337a5949501ce 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Podana wartość jest zbyt krótka. Powinna zawierać co najmniej jedno słowo.|Podana wartość jest zbyt krótka. Powinna zawierać co najmniej {{ min }} słów. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Podana wartość jest zbyt długa. Powinna zawierać jedno słowo.|Podana wartość jest zbyt długa. Powinna zawierać {{ max }} słów lub mniej. From 5f9b6d7849ab022da0e8efd09786aecd11436b7d Mon Sep 17 00:00:00 2001 From: Marin Binzari Date: Fri, 19 Jul 2024 10:26:48 +0300 Subject: [PATCH 39/59] [Profiler] Add word wrap in tables in dialog to see all the text --- .../Resources/views/Collector/workflow.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig index 377b74f609f21..522d93da32430 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig @@ -60,6 +60,7 @@ dialog table td { padding: .625em; text-align: center; + word-wrap: break-word; } dialog table th { From 0af710bc9fee194d6265c887e8258a0309b720a2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jul 2024 10:08:53 +0200 Subject: [PATCH 40/59] fix tests --- .../DataCollector/FormDataExtractorTest.php | 90 +++++++++++++------ 1 file changed, 62 insertions(+), 28 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php index ec01721c704b4..b8a1fee374035 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php @@ -26,6 +26,7 @@ use Symfony\Component\Form\ResolvedFormType; use Symfony\Component\Form\ResolvedFormTypeFactory; use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; +use Symfony\Component\Validator\Constraints\WordCount; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\VarDumper\Test\VarDumperTestTrait; @@ -300,35 +301,68 @@ public function testExtractSubmittedDataStoresErrorCause() $form->addError(new FormError('Invalid!', null, [], null, $violation)); $origin = spl_object_hash($form); - $this->assertDumpMatchesFormat(<< array:1 [ - "norm" => "Foobar" - ] - "errors" => array:1 [ - 0 => array:3 [ - "message" => "Invalid!" - "origin" => "$origin" - "trace" => array:2 [ - 0 => Symfony\Component\Validator\ConstraintViolation { - -message: "Foo" - -messageTemplate: "Foo" - -parameters: [] - -plural: null - -root: "Root" - -propertyPath: "property.path" - -invalidValue: "Invalid!" - -constraint: null - -code: null - -cause: Exception {%A} + if (class_exists(WordCount::class)) { + $expectedFormat = <<<"EODUMP" + array:3 [ + "submitted_data" => array:1 [ + "norm" => "Foobar" + ] + "errors" => array:1 [ + 0 => array:3 [ + "message" => "Invalid!" + "origin" => "$origin" + "trace" => array:2 [ + 0 => Symfony\Component\Validator\ConstraintViolation { + -message: "Foo" + -messageTemplate: "Foo" + -parameters: [] + -root: "Root" + -propertyPath: "property.path" + -invalidValue: "Invalid!" + -plural: null + -code: null + -constraint: null + -cause: Exception {%A} + } + 1 => Exception {#1} + ] + ] + ] + "synchronized" => true + ] + EODUMP; + } else { + $expectedFormat = <<<"EODUMP" + array:3 [ + "submitted_data" => array:1 [ + "norm" => "Foobar" + ] + "errors" => array:1 [ + 0 => array:3 [ + "message" => "Invalid!" + "origin" => "$origin" + "trace" => array:2 [ + 0 => Symfony\Component\Validator\ConstraintViolation { + -message: "Foo" + -messageTemplate: "Foo" + -parameters: [] + -plural: null + -root: "Root" + -propertyPath: "property.path" + -invalidValue: "Invalid!" + -constraint: null + -code: null + -cause: Exception {%A} + } + 1 => Exception {#1} + ] + ] + ] + "synchronized" => true + ] + EODUMP; } - 1 => Exception {#1} - ] - ] - ] - "synchronized" => true -] -EODUMP + $this->assertDumpMatchesFormat($expectedFormat , $this->dataExtractor->extractSubmittedData($form) ); From dd83a2c0a16017121d1e6183cb3555224edaa8e2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jul 2024 20:38:32 +0200 Subject: [PATCH 41/59] add test to prevent future regressions --- src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php index 14727da2394d2..d17d186f6bd65 100644 --- a/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php +++ b/src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php @@ -1086,6 +1086,7 @@ public static function provideSnake() ['symfonyisgreat', 'SYMFONY IS GREAT'], ['symfonyisgreat', 'SYMFONY _ IS _ GREAT'], ['symfony_isgreat', 'Symfony IS GREAT!'], + ['123_customer_with_special_name', '123-customer,with/special#name'], ]; } From bf2a0436352ea87334051cf9849d20d4cc6a6bfe Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2024 10:53:29 +0200 Subject: [PATCH 42/59] fix Finder test using the ftp wrapper by switching the server being used --- .../Tests/Iterator/RecursiveDirectoryIteratorTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 3b3caa5e3f789..49144505f7883 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -27,7 +27,7 @@ protected function setUp(): void */ public function testRewindOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS); + $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); $i->rewind(); @@ -39,11 +39,11 @@ public function testRewindOnFtp() */ public function testSeekOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS); + $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); $contains = [ - 'ftp://speedtest:speedtest@ftp.otenet.gr'.\DIRECTORY_SEPARATOR.'test100Mb.db', - 'ftp://speedtest:speedtest@ftp.otenet.gr'.\DIRECTORY_SEPARATOR.'test100k.db', + 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'pub', + 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'readme.txt', ]; $actual = []; From 72f1f38e552d5bbf7ef3ee309368795b4b83eccd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2024 13:02:29 +0200 Subject: [PATCH 43/59] be explicit about the signal to reset --- .../Component/Console/Tests/ApplicationTest.php | 10 ++++------ .../Component/Console/Tests/ConsoleEventsTest.php | 10 ++++------ .../Tests/SignalRegistry/SignalRegistryTest.php | 10 ++++------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index d8e1ae8b97e5d..ac1d47245b1ef 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -71,12 +71,10 @@ protected function tearDown(): void if (\function_exists('pcntl_signal')) { // We reset all signals to their default value to avoid side effects - for ($i = 1; $i <= 15; ++$i) { - if (9 === $i) { - continue; - } - pcntl_signal($i, \SIG_DFL); - } + pcntl_signal(\SIGINT, \SIG_DFL); + pcntl_signal(\SIGTERM, \SIG_DFL); + pcntl_signal(\SIGUSR1, \SIG_DFL); + pcntl_signal(\SIGUSR2, \SIG_DFL); } } diff --git a/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php b/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php index 93c228aa47eef..9c04d2706e8da 100644 --- a/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php +++ b/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php @@ -35,12 +35,10 @@ protected function tearDown(): void if (\function_exists('pcntl_signal')) { pcntl_async_signals(false); // We reset all signals to their default value to avoid side effects - for ($i = 1; $i <= 15; ++$i) { - if (9 === $i) { - continue; - } - pcntl_signal($i, \SIG_DFL); - } + pcntl_signal(\SIGINT, \SIG_DFL); + pcntl_signal(\SIGTERM, \SIG_DFL); + pcntl_signal(\SIGUSR1, \SIG_DFL); + pcntl_signal(\SIGUSR2, \SIG_DFL); } } diff --git a/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php b/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php index 4cb4354163812..f997f7c1d8cee 100644 --- a/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php +++ b/src/Symfony/Component/Console/Tests/SignalRegistry/SignalRegistryTest.php @@ -23,12 +23,10 @@ protected function tearDown(): void { pcntl_async_signals(false); // We reset all signals to their default value to avoid side effects - for ($i = 1; $i <= 15; ++$i) { - if (9 === $i) { - continue; - } - pcntl_signal($i, \SIG_DFL); - } + pcntl_signal(\SIGINT, \SIG_DFL); + pcntl_signal(\SIGTERM, \SIG_DFL); + pcntl_signal(\SIGUSR1, \SIG_DFL); + pcntl_signal(\SIGUSR2, \SIG_DFL); } public function testOneCallbackForASignalSignalIsHandled() From 6d7717048e630ad98681c5f43616fcf039043d94 Mon Sep 17 00:00:00 2001 From: Benjamin Lebon Date: Mon, 22 Jul 2024 20:03:36 +0200 Subject: [PATCH 44/59] [PropertyInfo] Fix nullable value returned from extractFromMutator on CollectionType Signed-off-by: Benjamin Lebon --- .../PropertyInfo/Extractor/ReflectionExtractor.php | 2 +- .../Tests/Extractor/ReflectionExtractorTest.php | 1 + .../Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index a4f2cc9f5e028..5119f28e2cfe0 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -458,7 +458,7 @@ private function extractFromMutator(string $class, string $property): ?array $type = $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass()); if (1 === \count($type) && \in_array($prefix, $this->arrayMutatorPrefixes)) { - $type = [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type[0])]; + $type = [new Type(Type::BUILTIN_TYPE_ARRAY, $this->isNullableProperty($class, $property), null, true, new Type(Type::BUILTIN_TYPE_INT), $type[0])]; } return $type; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 59823cc1c1085..0fdab63361f5e 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -523,6 +523,7 @@ public function testTypedProperties() $this->assertEquals([new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))], $this->extractor->getTypes(Php74Dummy::class, 'stringCollection')); $this->assertEquals([new Type(Type::BUILTIN_TYPE_INT, true)], $this->extractor->getTypes(Php74Dummy::class, 'nullableWithDefault')); $this->assertEquals([new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)], $this->extractor->getTypes(Php74Dummy::class, 'collection')); + $this->assertEquals([new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, Dummy::class))], $this->extractor->getTypes(Php74Dummy::class, 'nullableTypedCollection')); } /** diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php index 816b857b67b11..dc72d07756b88 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php74Dummy.php @@ -23,6 +23,9 @@ class Php74Dummy private ?int $nullableWithDefault = 1; public array $collection = []; + /** @var Dummy[]|null */ + public ?array $nullableTypedCollection = null; + public function addStringCollection(string $string): void { } @@ -30,4 +33,8 @@ public function addStringCollection(string $string): void public function removeStringCollection(string $string): void { } + + public function addNullableTypedCollection(Dummy $dummy): void + { + } } From b9258dfc49db8c3fa9ebdd286742f021a2b5ae2f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 23 Jul 2024 08:10:24 +0200 Subject: [PATCH 45/59] move adding detailed JSON error messages to the validate phase --- .../DependencyInjection/Configuration.php | 2 +- .../DependencyInjection/ConfigurationTest.php | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index ad352160822ae..4f23d43964402 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1197,7 +1197,7 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e ->arrayNode('default_context') ->normalizeKeys(false) ->useAttributeAsKey('name') - ->beforeNormalization() + ->validate() ->ifTrue(fn () => $this->debug && class_exists(JsonParser::class)) ->then(fn (array $v) => $v + [JsonDecode::DETAILED_ERROR_MESSAGES => true]) ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index ca34ce1092e7d..1e4ee15a63de3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Connection; use PHPUnit\Framework\TestCase; +use Seld\JsonLint\JsonParser; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration; use Symfony\Bundle\FullStack; use Symfony\Component\Cache\Adapter\DoctrineAdapter; @@ -566,6 +567,63 @@ public function testEnabledLockNeedsResources() ]); } + public function testSerializerJsonDetailedErrorMessagesEnabledWhenDefaultContextIsConfigured() + { + $processor = new Processor(); + $config = $processor->processConfiguration(new Configuration(true), [ + [ + 'serializer' => [ + 'default_context' => [ + 'foo' => 'bar', + ], + ], + ], + ]); + + $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => true], $config['serializer']['default_context'] ?? []); + } + + public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisabled() + { + $processor = new Processor(); + $config = $processor->processConfiguration(new Configuration(true), [ + [ + 'serializer' => [ + 'default_context' => [ + 'foo' => 'bar', + JsonDecode::DETAILED_ERROR_MESSAGES => false, + ], + ], + ], + ]); + + $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => false], $config['serializer']['default_context'] ?? []); + } + + public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisabledWithSeveralConfigsBeingMerged() + { + $processor = new Processor(); + $config = $processor->processConfiguration(new Configuration(true), [ + [ + 'serializer' => [ + 'default_context' => [ + 'foo' => 'bar', + JsonDecode::DETAILED_ERROR_MESSAGES => false, + ], + ], + ], + [ + 'serializer' => [ + 'default_context' => [ + 'foobar' => 'baz', + ], + ], + ], + ]); + + $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => false, 'foobar' => 'baz'], $config['serializer']['default_context'] ?? []); + } + protected static function getBundleDefaultConfig() { return [ From 74b01633fe3260be83e58a68947f46ffed2c51cb Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 22 Jul 2024 14:51:40 +0200 Subject: [PATCH 46/59] [ErrorHandler][VarDumper] Remove PHP 8.4 deprecations --- src/Symfony/Component/ErrorHandler/ErrorHandler.php | 7 +++++-- .../Component/ErrorHandler/Tests/ErrorHandlerTest.php | 11 +++++++++-- src/Symfony/Component/VarDumper/Caster/DOMCaster.php | 9 +-------- .../Component/VarDumper/Caster/ExceptionCaster.php | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php index b5109f457bc71..840353f327514 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php @@ -55,7 +55,6 @@ class ErrorHandler \E_USER_DEPRECATED => 'User Deprecated', \E_NOTICE => 'Notice', \E_USER_NOTICE => 'User Notice', - \E_STRICT => 'Runtime Notice', \E_WARNING => 'Warning', \E_USER_WARNING => 'User Warning', \E_COMPILE_WARNING => 'Compile Warning', @@ -73,7 +72,6 @@ class ErrorHandler \E_USER_DEPRECATED => [null, LogLevel::INFO], \E_NOTICE => [null, LogLevel::WARNING], \E_USER_NOTICE => [null, LogLevel::WARNING], - \E_STRICT => [null, LogLevel::WARNING], \E_WARNING => [null, LogLevel::WARNING], \E_USER_WARNING => [null, LogLevel::WARNING], \E_COMPILE_WARNING => [null, LogLevel::WARNING], @@ -183,6 +181,11 @@ public static function call(callable $function, ...$arguments) public function __construct(?BufferingLogger $bootstrappingLogger = null, bool $debug = false) { + if (\PHP_VERSION_ID < 80400) { + $this->levels[\E_STRICT] = 'Runtime Notice'; + $this->loggers[\E_STRICT] = [null, LogLevel::WARNING]; + } + if ($bootstrappingLogger) { $this->bootstrappingLogger = $bootstrappingLogger; $this->setDefaultLogger($bootstrappingLogger); diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php index 2b625f6388af3..e4294c802ae03 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php @@ -213,7 +213,6 @@ public function testDefaultLogger() \E_USER_DEPRECATED => [null, LogLevel::INFO], \E_NOTICE => [$logger, LogLevel::WARNING], \E_USER_NOTICE => [$logger, LogLevel::CRITICAL], - \E_STRICT => [null, LogLevel::WARNING], \E_WARNING => [null, LogLevel::WARNING], \E_USER_WARNING => [null, LogLevel::WARNING], \E_COMPILE_WARNING => [null, LogLevel::WARNING], @@ -225,6 +224,11 @@ public function testDefaultLogger() \E_ERROR => [null, LogLevel::CRITICAL], \E_CORE_ERROR => [null, LogLevel::CRITICAL], ]; + + if (\PHP_VERSION_ID < 80400) { + $loggers[\E_STRICT] = [null, LogLevel::WARNING]; + } + $this->assertSame($loggers, $handler->setLoggers([])); } finally { restore_error_handler(); @@ -478,7 +482,6 @@ public function testBootstrappingLogger() \E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO], \E_NOTICE => [$bootLogger, LogLevel::WARNING], \E_USER_NOTICE => [$bootLogger, LogLevel::WARNING], - \E_STRICT => [$bootLogger, LogLevel::WARNING], \E_WARNING => [$bootLogger, LogLevel::WARNING], \E_USER_WARNING => [$bootLogger, LogLevel::WARNING], \E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING], @@ -491,6 +494,10 @@ public function testBootstrappingLogger() \E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL], ]; + if (\PHP_VERSION_ID < 80400) { + $loggers[\E_STRICT] = [$bootLogger, LogLevel::WARNING]; + } + $this->assertSame($loggers, $handler->setLoggers([])); $handler->handleError(\E_DEPRECATED, 'Foo message', __FILE__, 123, []); diff --git a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php index 4dd16e0ee7461..5d933cf75a83c 100644 --- a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php @@ -23,7 +23,7 @@ class DOMCaster { private const ERROR_CODES = [ - \DOM_PHP_ERR => 'DOM_PHP_ERR', + 0 => 'DOM_PHP_ERR', \DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', \DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', \DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', @@ -138,16 +138,12 @@ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, boo 'doctype' => $dom->doctype, 'implementation' => $dom->implementation, 'documentElement' => new CutStub($dom->documentElement), - 'actualEncoding' => $dom->actualEncoding, 'encoding' => $dom->encoding, 'xmlEncoding' => $dom->xmlEncoding, - 'standalone' => $dom->standalone, 'xmlStandalone' => $dom->xmlStandalone, - 'version' => $dom->version, 'xmlVersion' => $dom->xmlVersion, 'strictErrorChecking' => $dom->strictErrorChecking, 'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI, - 'config' => $dom->config, 'formatOutput' => $dom->formatOutput, 'validateOnParse' => $dom->validateOnParse, 'resolveExternals' => $dom->resolveExternals, @@ -275,9 +271,6 @@ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $i 'publicId' => $dom->publicId, 'systemId' => $dom->systemId, 'notationName' => $dom->notationName, - 'actualEncoding' => $dom->actualEncoding, - 'encoding' => $dom->encoding, - 'version' => $dom->version, ]; return $a; diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index 7f5cb65eb24c3..d3f5e123f48bc 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -41,7 +41,7 @@ class ExceptionCaster \E_USER_ERROR => 'E_USER_ERROR', \E_USER_WARNING => 'E_USER_WARNING', \E_USER_NOTICE => 'E_USER_NOTICE', - \E_STRICT => 'E_STRICT', + 2048 => 'E_STRICT', ]; private static $framesCache = []; From a3e0dc9eddba73d5349ddfc9fc8eb9d5c72643c9 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2024 16:01:59 +0200 Subject: [PATCH 47/59] properly set up constraint options --- ...idatorWithPositiveOrZeroConstraintTest.php | 27 ++++++++++++++++++- ...hanValidatorWithPositiveConstraintTest.php | 22 ++++++++++++++- ...idatorWithNegativeOrZeroConstraintTest.php | 23 ++++++++++------ ...hanValidatorWithNegativeConstraintTest.php | 19 ++++++++----- 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php index e019c99e31751..fed0595e4a8e5 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php @@ -23,7 +23,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate { protected static function createConstraint(?array $options = null): Constraint { - return new PositiveOrZero(); + return new PositiveOrZero($options); } /** @@ -92,6 +92,11 @@ public function testInvalidValuePath() $this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); } + public static function provideAllValidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint'); + } + /** * @dataProvider provideValidComparisonsToPropertyPath */ @@ -100,6 +105,11 @@ public function testValidComparisonToPropertyPath($comparedValue) $this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); } + public function testNoViolationOnNullObjectWithPropertyPath() + { + $this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); + } + /** * @dataProvider throwsOnInvalidStringDatesProvider */ @@ -112,4 +122,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter() { $this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); } + + public static function throwsOnInvalidStringDatesProvider(): array + { + self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint'); + } + + public static function provideAllInvalidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the Negative constraint'); + } + + public static function provideComparisonsToNullValueAtPropertyPath(): array + { + self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); + } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php index 967d87c5a21a6..c2327682fec6f 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php @@ -23,7 +23,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato { protected static function createConstraint(?array $options = null): Constraint { - return new Positive(); + return new Positive($options); } /** @@ -95,6 +95,11 @@ public function testInvalidValuePath() $this->markTestSkipped('PropertyPath option is not used in Positive constraint'); } + public static function provideAllValidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the Positive constraint'); + } + /** * @dataProvider provideValidComparisonsToPropertyPath */ @@ -115,4 +120,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter() { $this->markTestSkipped('PropertyPath option is not used in Positive constraint'); } + + public static function throwsOnInvalidStringDatesProvider(): array + { + self::markTestSkipped('The "value" option cannot be used in the Positive constraint'); + } + + public static function provideAllInvalidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the Positive constraint'); + } + + public static function provideComparisonsToNullValueAtPropertyPath(): array + { + self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint'); + } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 05d36a8186620..0702d38406228 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -23,7 +23,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO { protected static function createConstraint(?array $options = null): Constraint { - return new NegativeOrZero(); + return new NegativeOrZero($options); } /** @@ -95,6 +95,11 @@ public function testInvalidValuePath() $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); } + public static function provideAllValidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint'); + } + /** * @dataProvider provideValidComparisonsToPropertyPath */ @@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue) $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); } - /** - * @dataProvider throwsOnInvalidStringDatesProvider - */ - public function testThrowsOnInvalidStringDates(AbstractComparison $constraint, $expectedMessage, $value) + public function testInvalidComparisonToPropertyPathAddsPathAsParameter() { - $this->markTestSkipped('The compared value cannot be an invalid string date because it is hardcoded to 0.'); + $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); } /** @@ -119,8 +121,13 @@ public function testCompareWithNullValueAtPropertyAt($dirtyValue, $dirtyValueAsS $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); } - public function testInvalidComparisonToPropertyPathAddsPathAsParameter() + public static function throwsOnInvalidStringDatesProvider(): array { - $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); + self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint'); + } + + public static function provideAllInvalidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint'); } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index f56b48adcf72e..7f969f97d5892 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -23,7 +23,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest { protected static function createConstraint(?array $options = null): Constraint { - return new Negative(); + return new Negative($options); } /** @@ -95,6 +95,11 @@ public function testInvalidValuePath() $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); } + public static function provideAllValidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the Negative constraint'); + } + /** * @dataProvider provideValidComparisonsToPropertyPath */ @@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue) $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); } - /** - * @dataProvider throwsOnInvalidStringDatesProvider - */ - public function testThrowsOnInvalidStringDates(AbstractComparison $constraint, $expectedMessage, $value) + public static function throwsOnInvalidStringDatesProvider(): array { - $this->markTestSkipped('The compared value cannot be an invalid string date because it is hardcoded to 0.'); + self::markTestSkipped('The "value" option cannot be used in the Negative constraint'); } /** @@ -123,4 +125,9 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter() { $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); } + + public static function provideAllInvalidComparisons(): array + { + self::markTestSkipped('The "value" option cannot be used in the Negative constraint'); + } } From ac78bba0b1c599282bc9d902e7d93b3557a27b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 25 Jul 2024 15:57:40 +0200 Subject: [PATCH 48/59] [DependencyInjection] Do not try to load default method name on interface --- .../Compiler/PriorityTaggedServiceTrait.php | 4 ++++ .../Tests/Compiler/PriorityTaggedServiceTraitTest.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php index 8c4d841f5a1f8..8d27303ee0cc6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php @@ -133,6 +133,10 @@ public static function getDefault(ContainerBuilder $container, string $serviceId return null; } + if ($r->isInterface()) { + return null; + } + if (null !== $indexAttribute) { $service = $class !== $serviceId ? sprintf('service "%s"', $serviceId) : 'on the corresponding service'; $message = [sprintf('Either method "%s::%s()" should ', $class, $defaultMethod), sprintf(' or tag "%s" on %s is missing attribute "%s".', $tagName, $service, $indexAttribute)]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php index 4d5ee1fb41b3d..c39d79f9e8772 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php @@ -151,6 +151,8 @@ public function testTheIndexedTagsByDefaultIndexMethod() $container->register('service3', IntTagClass::class)->addTag('my_custom_tag'); + $container->register('service4', HelloInterface::class)->addTag('my_custom_tag'); + $priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation(); $tag = new TaggedIteratorArgument('my_custom_tag', 'foo', 'getFooBar'); @@ -158,6 +160,7 @@ public function testTheIndexedTagsByDefaultIndexMethod() 'bar_tab_class_with_defaultmethod' => new TypedReference('service2', BarTagClass::class), 'service1' => new TypedReference('service1', FooTagClass::class), '10' => new TypedReference('service3', IntTagClass::class), + 'service4' => new TypedReference('service4', HelloInterface::class), ]; $services = $priorityTaggedServiceTraitImplementation->test($tag, $container); $this->assertSame(array_keys($expected), array_keys($services)); @@ -244,3 +247,8 @@ class HelloNamedService extends \stdClass class HelloNamedService2 { } + +interface HelloInterface +{ + public static function getFooBar(): string; +} From d83afb2a4320d35a4551f1cc81cb58c9776fa2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Vi=C3=B1als?= Date: Wed, 24 Jul 2024 16:18:16 +0200 Subject: [PATCH 49/59] [Validator] Add Catalan and Spanish translation for `WordCount` constraint" --- .../Validator/Resources/translations/validators.ca.xlf | 4 ++-- .../Validator/Resources/translations/validators.es.xlf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf index d0fd3a8aa39b4..60f747f62f715 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Aquest valor és massa curt. Ha de contenir almenys una paraula.|Aquest valor és massa curt. Ha de contenir almenys {{ min }} paraules. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Aquest valor és massa llarg. Ha de contenir una paraula.|Aquest valor és massa llarg. Ha de contenir {{ max }} paraules o menys. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index 66ce4b60c5aec..f9b3277229c8a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -444,11 +444,11 @@ This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. - This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words. + Este valor es demasiado corto. Debe contener al menos una palabra.|Este valor es demasiado corto. Debe contener al menos {{ min }} palabras. This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. - This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less. + Este valor es demasiado largo. Debe contener una palabra.|Este valor es demasiado largo. Debe contener {{ max }} palabras o menos. From 1b35b845c6d126fbabdbe6aef90c9ec8460f76a5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2024 08:39:19 +0200 Subject: [PATCH 50/59] treat uninitialized properties referenced by property paths as null --- .../AbstractComparisonValidator.php | 3 ++ .../Validator/Constraints/BicValidator.php | 3 ++ .../Validator/Constraints/RangeValidator.php | 3 ++ .../AbstractComparisonValidatorTestCase.php | 28 ++++++++++++++++++ .../Tests/Constraints/BicValidatorTest.php | 13 +++++++++ .../Constraints/Fixtures/BicTypedDummy.php | 17 +++++++++++ .../Constraints/Fixtures/MinMaxTyped.php | 18 ++++++++++++ .../Tests/Constraints/Fixtures/TypedDummy.php | 17 +++++++++++ ...idatorWithNegativeOrZeroConstraintTest.php | 10 +++++++ ...hanValidatorWithNegativeConstraintTest.php | 10 +++++++ .../Tests/Constraints/RangeValidatorTest.php | 29 +++++++++++++++++++ src/Symfony/Component/Validator/composer.json | 2 +- 12 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Validator/Tests/Constraints/Fixtures/BicTypedDummy.php create mode 100644 src/Symfony/Component/Validator/Tests/Constraints/Fixtures/MinMaxTyped.php create mode 100644 src/Symfony/Component/Validator/Tests/Constraints/Fixtures/TypedDummy.php diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php index b179fe81095dd..90e022671e15e 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\Validator\Constraint; @@ -56,6 +57,8 @@ public function validate($value, Constraint $constraint) $comparedValue = $this->getPropertyAccessor()->getValue($object, $path); } catch (NoSuchPropertyException $e) { throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } catch (UninitializedPropertyException $e) { + $comparedValue = null; } } else { $comparedValue = $constraint->value; diff --git a/src/Symfony/Component/Validator/Constraints/BicValidator.php b/src/Symfony/Component/Validator/Constraints/BicValidator.php index 240f2dd26c41a..fa458b196cef3 100644 --- a/src/Symfony/Component/Validator/Constraints/BicValidator.php +++ b/src/Symfony/Component/Validator/Constraints/BicValidator.php @@ -13,6 +13,7 @@ use Symfony\Component\Intl\Countries; use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessor; use Symfony\Component\Validator\Constraint; @@ -130,6 +131,8 @@ public function validate($value, Constraint $constraint) $iban = $this->getPropertyAccessor()->getValue($object, $path); } catch (NoSuchPropertyException $e) { throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } catch (UninitializedPropertyException $e) { + $iban = null; } } if (!$iban) { diff --git a/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/src/Symfony/Component/Validator/Constraints/RangeValidator.php index 3268e0da21f30..9a0d7177cd8e4 100644 --- a/src/Symfony/Component/Validator/Constraints/RangeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/RangeValidator.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\Validator\Constraint; @@ -178,6 +179,8 @@ private function getLimit(?string $propertyPath, $default, Constraint $constrain return $this->getPropertyAccessor()->getValue($object, $propertyPath); } catch (NoSuchPropertyException $e) { throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $propertyPath, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } catch (UninitializedPropertyException $e) { + return null; } } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 9d3c99c983473..6501b7edb1891 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -16,6 +16,7 @@ use Symfony\Component\Validator\Constraints\AbstractComparison; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; +use Symfony\Component\Validator\Tests\Constraints\Fixtures\TypedDummy; class ComparisonTest_Class { @@ -274,6 +275,33 @@ public function testCompareWithNullValueAtPropertyAt($dirtyValue, $dirtyValueAsS } } + /** + * @requires PHP 7.4 + * + * @dataProvider provideComparisonsToNullValueAtPropertyPath + */ + public function testCompareWithUninitializedPropertyAtPropertyPath($dirtyValue, $dirtyValueAsString, $isValid) + { + $this->setObject(new TypedDummy()); + + $this->validator->validate($dirtyValue, $this->createConstraint([ + 'message' => 'Constraint Message', + 'propertyPath' => 'value', + ])); + + if ($isValid) { + $this->assertNoViolation(); + } else { + $this->buildViolation('Constraint Message') + ->setParameter('{{ value }}', $dirtyValueAsString) + ->setParameter('{{ compared_value }}', 'null') + ->setParameter('{{ compared_value_type }}', 'null') + ->setParameter('{{ compared_value_path }}', 'value') + ->setCode($this->getErrorCode()) + ->assertRaised(); + } + } + public static function provideAllInvalidComparisons(): array { // The provider runs before setUp(), so we need to manually fix diff --git a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php index 536e74b073a74..1eac0fa47d374 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php @@ -18,6 +18,7 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; +use Symfony\Component\Validator\Tests\Constraints\Fixtures\BicTypedDummy; class BicValidatorTest extends ConstraintValidatorTestCase { @@ -92,6 +93,18 @@ public function testInvalidComparisonToPropertyPathFromAttribute() ->assertRaised(); } + /** + * @requires PHP 7.4 + */ + public function testPropertyPathReferencingUninitializedProperty() + { + $this->setObject(new BicTypedDummy()); + + $this->validator->validate('UNCRIT2B912', new Bic(['ibanPropertyPath' => 'iban'])); + + $this->assertNoViolation(); + } + public function testValidComparisonToValue() { $constraint = new Bic(['iban' => 'FR14 2004 1010 0505 0001 3M02 606']); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/BicTypedDummy.php b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/BicTypedDummy.php new file mode 100644 index 0000000000000..90ad4009c15c1 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/BicTypedDummy.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; + +class BicTypedDummy +{ + public string $iban; +} diff --git a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/MinMaxTyped.php b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/MinMaxTyped.php new file mode 100644 index 0000000000000..1595030fa6a63 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/MinMaxTyped.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; + +class MinMaxTyped +{ + public int $min; + public int $max; +} diff --git a/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/TypedDummy.php b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/TypedDummy.php new file mode 100644 index 0000000000000..73d2543376c43 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/TypedDummy.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints\Fixtures; + +class TypedDummy +{ + public mixed $value; +} diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 0702d38406228..7d4c7fb139e0d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -121,6 +121,16 @@ public function testCompareWithNullValueAtPropertyAt($dirtyValue, $dirtyValueAsS $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); } + /** + * @requires PHP 7.4 + * + * @dataProvider provideComparisonsToNullValueAtPropertyPath + */ + public function testCompareWithUninitializedPropertyAtPropertyPath($dirtyValue, $dirtyValueAsString, $isValid) + { + $this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint'); + } + public static function throwsOnInvalidStringDatesProvider(): array { self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index 7f969f97d5892..ccf52e3065ff2 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -121,6 +121,16 @@ public function testCompareWithNullValueAtPropertyAt($dirtyValue, $dirtyValueAsS $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); } + /** + * @requires PHP 7.4 + * + * @dataProvider provideComparisonsToNullValueAtPropertyPath + */ + public function testCompareWithUninitializedPropertyAtPropertyPath($dirtyValue, $dirtyValueAsString, $isValid) + { + $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); + } + public function testInvalidComparisonToPropertyPathAddsPathAsParameter() { $this->markTestSkipped('PropertyPath option is not used in Negative constraint'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php index 83a2a3d596048..01e606d63852e 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Validator\Constraints\RangeValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; +use Symfony\Component\Validator\Tests\Constraints\Fixtures\MinMaxTyped; use Symfony\Component\Validator\Tests\IcuCompatibilityTrait; class RangeValidatorTest extends ConstraintValidatorTestCase @@ -1042,6 +1043,34 @@ public function testInvalidDatesCombinedMinPropertyPath($value, $dateTimeAsStrin ->assertRaised(); } + /** + * @requires PHP 7.4 + */ + public function testMinPropertyPathReferencingUninitializedProperty() + { + $object = new MinMaxTyped(); + $object->max = 5; + $this->setObject($object); + + $this->validator->validate(5, new Range(['minPropertyPath' => 'min', 'maxPropertyPath' => 'max'])); + + $this->assertNoViolation(); + } + + /** + * @requires PHP 7.4 + */ + public function testMaxPropertyPathReferencingUninitializedProperty() + { + $object = new MinMaxTyped(); + $object->min = 5; + $this->setObject($object); + + $this->validator->validate(5, new Range(['minPropertyPath' => 'min', 'maxPropertyPath' => 'max'])); + + $this->assertNoViolation(); + } + public static function provideMessageIfMinAndMaxSet(): array { $notInRangeMessage = (new Range(['min' => '']))->notInRangeMessage; diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 19a27b3333a81..9d1fc800fd26e 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -38,7 +38,7 @@ "symfony/expression-language": "^5.1|^6.0", "symfony/cache": "^4.4|^5.0|^6.0", "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/property-access": "^5.4|^6.0", "symfony/property-info": "^5.3|^6.0", "symfony/translation": "^5.4.35|~6.3.12|^6.4.3", "doctrine/annotations": "^1.13|^2", From d9fa8005897b1709a9c4e4eca7e81a01b716db06 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 16 Jul 2024 09:31:57 +0200 Subject: [PATCH 51/59] [HttpFoundation] Add tests for uncovered sections --- .../HttpFoundation/Tests/InputBagTest.php | 18 ++++++++++++ .../AbstractRequestRateLimiterTest.php | 29 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php index b21e988a4a8b0..fc3f0964c5c69 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php @@ -98,4 +98,22 @@ public function testFilterArrayWithoutArrayFlagIsDeprecated() $this->expectDeprecation('Since symfony/http-foundation 5.1: Filtering an array value with "Symfony\Component\HttpFoundation\InputBag::filter()" without passing the FILTER_REQUIRE_ARRAY or FILTER_FORCE_ARRAY flag is deprecated'); $bag->filter('foo', \FILTER_VALIDATE_INT); } + + public function testAdd() + { + $bag = new InputBag(['foo' => 'bar']); + $bag->add(['baz' => 'qux']); + + $this->assertSame('bar', $bag->get('foo'), '->add() does not remove existing parameters'); + $this->assertSame('qux', $bag->get('baz'), '->add() adds new parameters'); + } + + public function testReplace() + { + $bag = new InputBag(['foo' => 'bar']); + $bag->replace(['baz' => 'qux']); + + $this->assertNull($bag->get('foo'), '->replace() removes existing parameters'); + $this->assertSame('qux', $bag->get('baz'), '->replace() adds new parameters'); + } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/AbstractRequestRateLimiterTest.php b/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/AbstractRequestRateLimiterTest.php index 4e102777a45c6..26f2fac90801e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/AbstractRequestRateLimiterTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/AbstractRequestRateLimiterTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\RateLimiter\LimiterInterface; +use Symfony\Component\RateLimiter\Policy\NoLimiter; use Symfony\Component\RateLimiter\RateLimit; class AbstractRequestRateLimiterTest extends TestCase @@ -33,6 +34,34 @@ public function testConsume(array $rateLimits, ?RateLimit $expected) $this->assertSame($expected, $rateLimiter->consume(new Request())); } + public function testConsumeWithoutLimiterAddsSpecialNoLimiter() + { + $rateLimiter = new MockAbstractRequestRateLimiter([]); + + try { + $this->assertSame(\PHP_INT_MAX, $rateLimiter->consume(new Request())->getLimit()); + } catch (\TypeError $error) { + if (str_contains($error->getMessage(), 'RateLimit::__construct(): Argument #1 ($availableTokens) must be of type int, float given')) { + $this->markTestSkipped('This test cannot be run on a version of the RateLimiter component that uses \INF instead of \PHP_INT_MAX in NoLimiter.'); + } + + throw $error; + } + } + + public function testResetLimiters() + { + $rateLimiter = new MockAbstractRequestRateLimiter([ + $limiter1 = $this->createMock(LimiterInterface::class), + $limiter2 = $this->createMock(LimiterInterface::class), + ]); + + $limiter1->expects($this->once())->method('reset'); + $limiter2->expects($this->once())->method('reset'); + + $rateLimiter->reset(new Request()); + } + public static function provideRateLimits() { $now = new \DateTimeImmutable(); From f164370dcf1109dbf8d90459a333ef3622a22977 Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Wed, 24 Jul 2024 19:24:44 +0800 Subject: [PATCH 52/59] [DoctrineBridge] fix messenger bus dispatch inside an active transaction --- .../Messenger/DoctrineOpenTransactionLoggerMiddleware.php | 3 ++- .../DoctrineOpenTransactionLoggerMiddlewareTest.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php index 2ef3bbbb92815..1efbdd47e163c 100644 --- a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php +++ b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php @@ -43,11 +43,12 @@ protected function handleForManager(EntityManagerInterface $entityManager, Envel } $this->isHandling = true; + $initialTransactionLevel = $entityManager->getConnection()->getTransactionNestingLevel(); try { return $stack->next()->handle($envelope, $stack); } finally { - if ($entityManager->getConnection()->isTransactionActive()) { + if ($entityManager->getConnection()->getTransactionNestingLevel() > $initialTransactionLevel) { $this->logger->error('A handler opened a transaction but did not close it.', [ 'message' => $envelope->getMessage(), ]); diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php index 3682ad00d5085..a1d4118deba3e 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php @@ -50,9 +50,9 @@ public function log($level, $message, $context = []): void public function testMiddlewareWrapsInTransactionAndFlushes() { - $this->connection->expects($this->exactly(1)) - ->method('isTransactionActive') - ->willReturn(true, true, false) + $this->connection->expects($this->exactly(2)) + ->method('getTransactionNestingLevel') + ->willReturn(0, 1) ; $this->middleware->handle(new Envelope(new \stdClass()), $this->getStackMock()); From 0507c22a952d4b377a7037936a8813ed780ac029 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 25 Jul 2024 11:09:46 +0200 Subject: [PATCH 53/59] [Translation] Fix CSV escape char in `CsvFileLoader` on PHP >= 7.4 --- .../Component/Translation/Loader/CsvFileLoader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php index 8d5d4db9a721f..0cf05731bb231 100644 --- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php @@ -22,7 +22,7 @@ class CsvFileLoader extends FileLoader { private $delimiter = ';'; private $enclosure = '"'; - private $escape = '\\'; + private $escape = ''; /** * {@inheritdoc} @@ -38,7 +38,7 @@ protected function loadResource(string $resource) } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); - $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); + $file->setCsvControl($this->delimiter, $this->enclosure, '' === $this->escape && \PHP_VERSION_ID < 70400 ? '\\' : $this->escape); foreach ($file as $data) { if (false === $data) { @@ -56,10 +56,10 @@ protected function loadResource(string $resource) /** * Sets the delimiter, enclosure, and escape character for CSV. */ - public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') + public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '') { $this->delimiter = $delimiter; $this->enclosure = $enclosure; - $this->escape = $escape; + $this->escape = '' === $escape && \PHP_VERSION_ID < 70400 ? '\\' : $escape; } } From 6a96ff91161e05300f3c08295106cdec1d848760 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 24 Jul 2024 10:06:13 +0200 Subject: [PATCH 54/59] [Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php | 4 ++-- src/Symfony/Component/Console/Output/StreamOutput.php | 2 +- src/Symfony/Component/VarDumper/Dumper/CliDumper.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 2821d92e358f4..c2c0cbb8fc9e6 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -410,7 +410,7 @@ private static function hasColorSupport() } // Follow https://no-color.org/ - if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) { + if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { return false; } diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index 816e8d9c2158c..c409cd26bc54b 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -368,7 +368,7 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla } } -$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), false === $getEnvVar('NO_COLOR') ? 'always' : 'never'); +$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), '' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never'); $cmd = str_replace('%', '%%', implode(' ', $cmd)).' %1$s'; if ('\\' === \DIRECTORY_SEPARATOR) { @@ -458,7 +458,7 @@ class SymfonyExcludeListSimplePhpunit { } } - array_splice($argv, 1, 0, ['--colors='.(false === $getEnvVar('NO_COLOR') ? 'always' : 'never')]); + array_splice($argv, 1, 0, ['--colors='.('' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never')]); $_SERVER['argv'] = $argv; $_SERVER['argc'] = ++$argc; include "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"; diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 5f5ffce329b93..72479f8a2563a 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -91,7 +91,7 @@ protected function doWrite(string $message, bool $newline) protected function hasColorSupport() { // Follow https://no-color.org/ - if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) { + if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { return false; } diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 3e86e4ab49faa..359171b3b1ca1 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -606,7 +606,7 @@ private function hasColorSupport($stream): bool } // Follow https://no-color.org/ - if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) { + if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { return false; } From f1a03f0d5e174f67dd1a5f9f5a16a8835bb0481c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 26 Jul 2024 15:11:24 +0200 Subject: [PATCH 55/59] Sync .github/expected-missing-return-types.diff --- .github/expected-missing-return-types.diff | 182 +++++++++--------- .../Normalizer/AbstractNormalizer.php | 2 + 2 files changed, 93 insertions(+), 91 deletions(-) diff --git a/.github/expected-missing-return-types.diff b/.github/expected-missing-return-types.diff index 73d86100bdd53..d5326aec3d5e5 100644 --- a/.github/expected-missing-return-types.diff +++ b/.github/expected-missing-return-types.diff @@ -154,7 +154,7 @@ diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/Regist diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php -@@ -160,5 +160,5 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface +@@ -164,5 +164,5 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface * @return array{0:ClassMetadata, 1:string}|null */ - protected function getMetadata(string $class) @@ -653,7 +653,7 @@ diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExt + public function load(array $configs, ContainerBuilder $container): void { $loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config')); -@@ -2995,5 +2995,5 @@ class FrameworkExtension extends Extension +@@ -3007,5 +3007,5 @@ class FrameworkExtension extends Extension * @return void */ - public static function registerRateLimiter(ContainerBuilder $container, string $name, array $limiterConfig) @@ -1339,14 +1339,14 @@ diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfo diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php -@@ -283,5 +283,5 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac +@@ -287,5 +287,5 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac * @return void */ - public function reset() + public function reset(): void { $this->commit(); -@@ -299,5 +299,5 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac +@@ -303,5 +303,5 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac * @return void */ - public function __wakeup() @@ -1464,7 +1464,7 @@ diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/ + protected function doUnlink(string $file): bool { return @unlink($file); -@@ -176,5 +176,5 @@ trait FilesystemCommonTrait +@@ -181,5 +181,5 @@ trait FilesystemCommonTrait * @return void */ - public function __wakeup() @@ -1749,21 +1749,21 @@ diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.p diff --git a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php --- a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php -@@ -34,5 +34,5 @@ class YamlReferenceDumper +@@ -33,5 +33,5 @@ class YamlReferenceDumper * @return string */ - public function dump(ConfigurationInterface $configuration) + public function dump(ConfigurationInterface $configuration): string { return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree()); -@@ -42,5 +42,5 @@ class YamlReferenceDumper +@@ -41,5 +41,5 @@ class YamlReferenceDumper * @return string */ - public function dumpAtPath(ConfigurationInterface $configuration, string $path) + public function dumpAtPath(ConfigurationInterface $configuration, string $path): string { $rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree(); -@@ -71,5 +71,5 @@ class YamlReferenceDumper +@@ -70,5 +70,5 @@ class YamlReferenceDumper * @return string */ - public function dumpNode(NodeInterface $node) @@ -5162,84 +5162,84 @@ diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Compo + public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false): void { $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://'); -@@ -89,5 +89,5 @@ class Filesystem +@@ -92,5 +92,5 @@ class Filesystem * @throws IOException On any directory creation failure */ - public function mkdir(string|iterable $dirs, int $mode = 0777) + public function mkdir(string|iterable $dirs, int $mode = 0777): void { foreach ($this->toIterable($dirs) as $dir) { -@@ -132,5 +132,5 @@ class Filesystem +@@ -135,5 +135,5 @@ class Filesystem * @throws IOException When touch fails */ - public function touch(string|iterable $files, ?int $time = null, ?int $atime = null) + public function touch(string|iterable $files, ?int $time = null, ?int $atime = null): void { foreach ($this->toIterable($files) as $file) { -@@ -148,5 +148,5 @@ class Filesystem +@@ -151,5 +151,5 @@ class Filesystem * @throws IOException When removal fails */ - public function remove(string|iterable $files) + public function remove(string|iterable $files): void { if ($files instanceof \Traversable) { -@@ -216,5 +216,5 @@ class Filesystem +@@ -219,5 +219,5 @@ class Filesystem * @throws IOException When the change fails */ - public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false) + public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false): void { foreach ($this->toIterable($files) as $file) { -@@ -238,5 +238,5 @@ class Filesystem +@@ -241,5 +241,5 @@ class Filesystem * @throws IOException When the change fails */ - public function chown(string|iterable $files, string|int $user, bool $recursive = false) + public function chown(string|iterable $files, string|int $user, bool $recursive = false): void { foreach ($this->toIterable($files) as $file) { -@@ -266,5 +266,5 @@ class Filesystem +@@ -269,5 +269,5 @@ class Filesystem * @throws IOException When the change fails */ - public function chgrp(string|iterable $files, string|int $group, bool $recursive = false) + public function chgrp(string|iterable $files, string|int $group, bool $recursive = false): void { foreach ($this->toIterable($files) as $file) { -@@ -292,5 +292,5 @@ class Filesystem +@@ -295,5 +295,5 @@ class Filesystem * @throws IOException When origin cannot be renamed */ - public function rename(string $origin, string $target, bool $overwrite = false) + public function rename(string $origin, string $target, bool $overwrite = false): void { // we check that target does not exist -@@ -334,5 +334,5 @@ class Filesystem +@@ -337,5 +337,5 @@ class Filesystem * @throws IOException When symlink fails */ - public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false) + public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false): void { self::assertFunctionExists('symlink'); -@@ -373,5 +373,5 @@ class Filesystem +@@ -376,5 +376,5 @@ class Filesystem * @throws IOException When link fails, including if link already exists */ - public function hardlink(string $originFile, string|iterable $targetFiles) + public function hardlink(string $originFile, string|iterable $targetFiles): void { self::assertFunctionExists('link'); -@@ -531,5 +531,5 @@ class Filesystem +@@ -534,5 +534,5 @@ class Filesystem * @throws IOException When file type is unknown */ - public function mirror(string $originDir, string $targetDir, ?\Traversable $iterator = null, array $options = []) + public function mirror(string $originDir, string $targetDir, ?\Traversable $iterator = null, array $options = []): void { $targetDir = rtrim($targetDir, '/\\'); -@@ -657,5 +657,5 @@ class Filesystem +@@ -660,5 +660,5 @@ class Filesystem * @throws IOException if the file cannot be written to */ - public function dumpFile(string $filename, $content) + public function dumpFile(string $filename, $content): void { if (\is_array($content)) { -@@ -704,5 +704,5 @@ class Filesystem +@@ -707,5 +707,5 @@ class Filesystem * @throws IOException If the file is not writable */ - public function appendToFile(string $filename, $content/* , bool $lock = false */) @@ -8077,14 +8077,14 @@ diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/ + protected function getCasters(): array { $casters = [ -@@ -86,5 +86,5 @@ abstract class DataCollector implements DataCollectorInterface +@@ -98,5 +98,5 @@ abstract class DataCollector implements DataCollectorInterface * @return void */ - public function __wakeup() + public function __wakeup(): void { } -@@ -107,5 +107,5 @@ abstract class DataCollector implements DataCollectorInterface +@@ -119,5 +119,5 @@ abstract class DataCollector implements DataCollectorInterface * @return void */ - public function reset() @@ -8678,21 +8678,21 @@ diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component + protected function initializeContainer(): void { $class = $this->getContainerClass(); -@@ -618,5 +618,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl +@@ -626,5 +626,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl * @return void */ - protected function prepareContainer(ContainerBuilder $container) + protected function prepareContainer(ContainerBuilder $container): void { $extensions = []; -@@ -671,5 +671,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl +@@ -679,5 +679,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl * @return void */ - protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass) + protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass): void { // cache the container -@@ -849,5 +849,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl +@@ -857,5 +857,5 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl * @return void */ - public function __wakeup() @@ -9771,7 +9771,7 @@ diff --git a/src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFa diff --git a/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php b/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php --- a/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php +++ b/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php -@@ -33,5 +33,5 @@ class ValidationFailedException extends RuntimeException +@@ -37,5 +37,5 @@ class ValidationFailedException extends RuntimeException implements EnvelopeAwar * @return object */ - public function getViolatingMessage() @@ -9919,7 +9919,7 @@ diff --git a/src/Symfony/Component/Mime/Message.php b/src/Symfony/Component/Mime - public function ensureValidity() + public function ensureValidity(): void { - if (!$this->headers->has('To') && !$this->headers->has('Cc') && !$this->headers->has('Bcc')) { + if (!$this->headers->get('To')?->getBody() && !$this->headers->get('Cc')?->getBody() && !$this->headers->get('Bcc')?->getBody()) { diff --git a/src/Symfony/Component/Mime/Part/DataPart.php b/src/Symfony/Component/Mime/Part/DataPart.php --- a/src/Symfony/Component/Mime/Part/DataPart.php +++ b/src/Symfony/Component/Mime/Part/DataPart.php @@ -9933,7 +9933,7 @@ diff --git a/src/Symfony/Component/Mime/Part/DataPart.php b/src/Symfony/Componen diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php -@@ -236,5 +236,5 @@ class TextPart extends AbstractPart +@@ -240,5 +240,5 @@ class TextPart extends AbstractPart * @return void */ - public function __wakeup() @@ -9943,7 +9943,7 @@ diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Componen diff --git a/src/Symfony/Component/Mime/RawMessage.php b/src/Symfony/Component/Mime/RawMessage.php --- a/src/Symfony/Component/Mime/RawMessage.php +++ b/src/Symfony/Component/Mime/RawMessage.php -@@ -76,5 +76,5 @@ class RawMessage +@@ -97,5 +97,5 @@ class RawMessage * @throws LogicException if the message is not valid */ - public function ensureValidity() @@ -10103,35 +10103,35 @@ diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Componen diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php -@@ -203,5 +203,5 @@ class Process implements \IteratorAggregate +@@ -204,5 +204,5 @@ class Process implements \IteratorAggregate * @return void */ - public function __wakeup() + public function __wakeup(): void { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); -@@ -294,5 +294,5 @@ class Process implements \IteratorAggregate +@@ -295,5 +295,5 @@ class Process implements \IteratorAggregate * @throws LogicException In case a callback is provided and output has been disabled */ - public function start(?callable $callback = null, array $env = []) + public function start(?callable $callback = null, array $env = []): void { if ($this->isRunning()) { -@@ -1145,5 +1145,5 @@ class Process implements \IteratorAggregate +@@ -1146,5 +1146,5 @@ class Process implements \IteratorAggregate * @throws ProcessTimedOutException In case the timeout was reached */ - public function checkTimeout() + public function checkTimeout(): void { if (self::STATUS_STARTED !== $this->status) { -@@ -1186,5 +1186,5 @@ class Process implements \IteratorAggregate +@@ -1187,5 +1187,5 @@ class Process implements \IteratorAggregate * @return void */ - public function setOptions(array $options) + public function setOptions(array $options): void { if ($this->isRunning()) { -@@ -1283,5 +1283,5 @@ class Process implements \IteratorAggregate +@@ -1284,5 +1284,5 @@ class Process implements \IteratorAggregate * @return void */ - protected function updateStatus(bool $blocking) @@ -10777,7 +10777,7 @@ diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Ro + public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory): void { $this->configCacheFactory = $configCacheFactory; -@@ -318,5 +318,5 @@ class Router implements RouterInterface, RequestMatcherInterface +@@ -320,5 +320,5 @@ class Router implements RouterInterface, RequestMatcherInterface * @return void */ - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) @@ -11544,43 +11544,43 @@ diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalize - public function normalize(mixed $object, ?string $format = null, array $context = []) + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - if (!isset($context['cache_key'])) { -@@ -233,5 +233,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer + $context['_read_attributes'] = true; +@@ -235,5 +235,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return object */ - protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, ?string $format = null) + protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, ?string $format = null): object { if ($class !== $mappedClass = $this->getMappedClass($data, $class, $context)) { -@@ -284,5 +284,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -286,5 +286,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return string[] */ - abstract protected function extractAttributes(object $object, ?string $format = null, array $context = []); + abstract protected function extractAttributes(object $object, ?string $format = null, array $context = []): array; /** -@@ -291,5 +291,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -293,5 +293,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return mixed */ - abstract protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []); + abstract protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed; /** -@@ -298,5 +298,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -300,5 +300,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return bool */ - public function supportsDenormalization(mixed $data, string $type, ?string $format = null /* , array $context = [] */) + public function supportsDenormalization(mixed $data, string $type, ?string $format = null /* , array $context = [] */): bool { return class_exists($type) || (interface_exists($type, false) && null !== $this->classDiscriminatorResolver?->getMappingForClass($type)); -@@ -306,5 +306,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer +@@ -308,5 +308,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return mixed */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []) + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - if (!isset($context['cache_key'])) { -@@ -422,5 +422,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer + $context['_read_attributes'] = false; +@@ -430,5 +430,5 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer * @return void */ - abstract protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []); @@ -11625,16 +11625,16 @@ diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.p diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php -@@ -152,5 +152,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer +@@ -166,5 +166,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer * @return void */ - protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void { - $setter = 'set'.ucfirst($attribute); -@@ -182,5 +182,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer + $setter = 'set'.$attribute; +@@ -180,5 +180,5 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer } - + - protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []): bool { @@ -11678,20 +11678,20 @@ diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php -@@ -138,5 +138,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer +@@ -150,5 +150,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer * @return void */ - protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void { try { -@@ -189,5 +189,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer +@@ -183,5 +183,5 @@ class ObjectNormalizer extends AbstractObjectNormalizer } - + - protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []): bool { - $ignoredAttributes = $context[self::IGNORED_ATTRIBUTES] ?? $this->defaultContext[self::IGNORED_ATTRIBUTES]; + if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -12164,8 +12164,8 @@ diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Sy @@ -56,5 +56,5 @@ class CsvFileLoader extends FileLoader * @return void */ -- public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') -+ public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\'): void +- public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '') ++ public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = ''): void { $this->delimiter = $delimiter; diff --git a/src/Symfony/Component/Translation/LoggingTranslator.php b/src/Symfony/Component/Translation/LoggingTranslator.php @@ -12581,7 +12581,7 @@ diff --git a/src/Symfony/Component/Validator/ConstraintViolationListInterface.ph diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php -@@ -38,5 +38,5 @@ abstract class AbstractComparisonValidator extends ConstraintValidator +@@ -39,5 +39,5 @@ abstract class AbstractComparisonValidator extends ConstraintValidator * @return void */ - public function validate(mixed $value, Constraint $constraint) @@ -12611,7 +12611,7 @@ diff --git a/src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.p diff --git a/src/Symfony/Component/Validator/Constraints/BicValidator.php b/src/Symfony/Component/Validator/Constraints/BicValidator.php --- a/src/Symfony/Component/Validator/Constraints/BicValidator.php +++ b/src/Symfony/Component/Validator/Constraints/BicValidator.php -@@ -67,5 +67,5 @@ class BicValidator extends ConstraintValidator +@@ -68,5 +68,5 @@ class BicValidator extends ConstraintValidator * @return void */ - public function validate(mixed $value, Constraint $constraint) @@ -12778,7 +12778,7 @@ diff --git a/src/Symfony/Component/Validator/Constraints/ExpressionValidator.php diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php -@@ -134,5 +134,5 @@ class File extends Constraint +@@ -135,5 +135,5 @@ class File extends Constraint * @return void */ - public function __set(string $option, mixed $value) @@ -13009,7 +13009,7 @@ diff --git a/src/Symfony/Component/Validator/Constraints/NotNullValidator.php b/ diff --git a/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/src/Symfony/Component/Validator/Constraints/RangeValidator.php --- a/src/Symfony/Component/Validator/Constraints/RangeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/RangeValidator.php -@@ -35,5 +35,5 @@ class RangeValidator extends ConstraintValidator +@@ -36,5 +36,5 @@ class RangeValidator extends ConstraintValidator * @return void */ - public function validate(mixed $value, Constraint $constraint) @@ -13280,7 +13280,7 @@ diff --git a/src/Symfony/Component/Validator/ObjectInitializerInterface.php b/sr diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php -@@ -291,5 +291,5 @@ abstract class ConstraintValidatorTestCase extends TestCase +@@ -295,5 +295,5 @@ abstract class ConstraintValidatorTestCase extends TestCase * @psalm-return T */ - abstract protected function createValidator(); @@ -13399,63 +13399,63 @@ diff --git a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php b/src/Symfony/ + public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array { $a += [ -@@ -188,5 +188,5 @@ class DOMCaster +@@ -184,5 +184,5 @@ class DOMCaster * @return array */ - public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested) + public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -201,5 +201,5 @@ class DOMCaster +@@ -197,5 +197,5 @@ class DOMCaster * @return array */ - public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested) + public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -217,5 +217,5 @@ class DOMCaster +@@ -213,5 +213,5 @@ class DOMCaster * @return array */ - public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested) + public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -230,5 +230,5 @@ class DOMCaster +@@ -226,5 +226,5 @@ class DOMCaster * @return array */ - public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested) + public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -242,5 +242,5 @@ class DOMCaster +@@ -238,5 +238,5 @@ class DOMCaster * @return array */ - public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested) + public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -259,5 +259,5 @@ class DOMCaster +@@ -255,5 +255,5 @@ class DOMCaster * @return array */ - public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested) + public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -272,5 +272,5 @@ class DOMCaster +@@ -268,5 +268,5 @@ class DOMCaster * @return array */ - public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested) + public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -289,5 +289,5 @@ class DOMCaster +@@ -282,5 +282,5 @@ class DOMCaster * @return array */ - public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested) + public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested): array { $a += [ -@@ -302,5 +302,5 @@ class DOMCaster +@@ -295,5 +295,5 @@ class DOMCaster * @return array */ - public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, bool $isNested) @@ -13826,78 +13826,78 @@ diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/S - public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested) + public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested): array { - self::addMap($a, $c, [ -@@ -140,5 +140,5 @@ class ReflectionCaster + $map = [ +@@ -146,5 +146,5 @@ class ReflectionCaster * @return array */ - public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested) + public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested): array { $prefix = Caster::PREFIX_VIRTUAL; -@@ -178,5 +178,5 @@ class ReflectionCaster +@@ -184,5 +184,5 @@ class ReflectionCaster * @return array */ - public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0) + public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array { $prefix = Caster::PREFIX_VIRTUAL; -@@ -212,5 +212,5 @@ class ReflectionCaster +@@ -218,5 +218,5 @@ class ReflectionCaster * @return array */ - public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0) + public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array { $prefix = Caster::PREFIX_VIRTUAL; -@@ -273,5 +273,5 @@ class ReflectionCaster +@@ -279,5 +279,5 @@ class ReflectionCaster * @return array */ - public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested) + public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested): array { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); -@@ -286,5 +286,5 @@ class ReflectionCaster +@@ -292,5 +292,5 @@ class ReflectionCaster * @return array */ - public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested) + public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested): array { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); -@@ -296,5 +296,5 @@ class ReflectionCaster +@@ -302,5 +302,5 @@ class ReflectionCaster * @return array */ - public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested) + public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested): array { $prefix = Caster::PREFIX_VIRTUAL; -@@ -339,5 +339,5 @@ class ReflectionCaster +@@ -345,5 +345,5 @@ class ReflectionCaster * @return array */ - public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested) + public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested): array { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); -@@ -352,5 +352,5 @@ class ReflectionCaster +@@ -358,5 +358,5 @@ class ReflectionCaster * @return array */ - public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested) + public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested): array { $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId(); -@@ -362,5 +362,5 @@ class ReflectionCaster +@@ -368,5 +368,5 @@ class ReflectionCaster * @return array */ - public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested) + public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested): array { self::addMap($a, $c, [ -@@ -381,5 +381,5 @@ class ReflectionCaster +@@ -387,5 +387,5 @@ class ReflectionCaster * @return array */ - public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested) + public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested): array { self::addMap($a, $c, [ -@@ -396,5 +396,5 @@ class ReflectionCaster +@@ -402,5 +402,5 @@ class ReflectionCaster * @return string */ - public static function getSignature(array $a) @@ -14216,84 +14216,84 @@ diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Sym diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php -@@ -91,5 +91,5 @@ class CliDumper extends AbstractDumper +@@ -92,5 +92,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function setColors(bool $colors) + public function setColors(bool $colors): void { $this->colors = $colors; -@@ -101,5 +101,5 @@ class CliDumper extends AbstractDumper +@@ -102,5 +102,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function setMaxStringWidth(int $maxStringWidth) + public function setMaxStringWidth(int $maxStringWidth): void { $this->maxStringWidth = $maxStringWidth; -@@ -113,5 +113,5 @@ class CliDumper extends AbstractDumper +@@ -114,5 +114,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function setStyles(array $styles) + public function setStyles(array $styles): void { $this->styles = $styles + $this->styles; -@@ -125,5 +125,5 @@ class CliDumper extends AbstractDumper +@@ -126,5 +126,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function setDisplayOptions(array $displayOptions) + public function setDisplayOptions(array $displayOptions): void { $this->displayOptions = $displayOptions + $this->displayOptions; -@@ -133,5 +133,5 @@ class CliDumper extends AbstractDumper +@@ -134,5 +134,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value) + public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value): void { $this->dumpKey($cursor); -@@ -197,5 +197,5 @@ class CliDumper extends AbstractDumper +@@ -198,5 +198,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) + public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void { $this->dumpKey($cursor); -@@ -289,5 +289,5 @@ class CliDumper extends AbstractDumper +@@ -290,5 +290,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild) + public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild): void { $this->colors ??= $this->supportsColors(); -@@ -329,5 +329,5 @@ class CliDumper extends AbstractDumper +@@ -330,5 +330,5 @@ class CliDumper extends AbstractDumper * @return void */ - public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut) + public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut): void { if (empty($cursor->attr['cut_hash'])) { -@@ -347,5 +347,5 @@ class CliDumper extends AbstractDumper +@@ -348,5 +348,5 @@ class CliDumper extends AbstractDumper * @return void */ - protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut) + protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut): void { if ($cut) { -@@ -365,5 +365,5 @@ class CliDumper extends AbstractDumper +@@ -366,5 +366,5 @@ class CliDumper extends AbstractDumper * @return void */ - protected function dumpKey(Cursor $cursor) + protected function dumpKey(Cursor $cursor): void { if (null !== $key = $cursor->hashKey) { -@@ -576,5 +576,5 @@ class CliDumper extends AbstractDumper +@@ -577,5 +577,5 @@ class CliDumper extends AbstractDumper * @return void */ - protected function dumpLine(int $depth, bool $endOfValue = false) + protected function dumpLine(int $depth, bool $endOfValue = false): void { if (null === $this->colors) { -@@ -591,5 +591,5 @@ class CliDumper extends AbstractDumper +@@ -592,5 +592,5 @@ class CliDumper extends AbstractDumper * @return void */ - protected function endValue(Cursor $cursor) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index ccada2ed69d1c..aeae375fba642 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -267,6 +267,8 @@ protected function getGroups(array $context): array /** * Is this attribute allowed? + * + * @return bool */ protected function isAllowedAttribute(object|string $classOrObject, string $attribute, ?string $format = null, array $context = []) { From c984e229b9142d60a8702bfaa99910181c259df0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 26 Jul 2024 15:15:05 +0200 Subject: [PATCH 56/59] Fix merge --- .../Tests/DependencyInjection/ConfigurationTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 1e4ee15a63de3..1d48dce8f1709 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -572,6 +572,7 @@ public function testSerializerJsonDetailedErrorMessagesEnabledWhenDefaultContext $processor = new Processor(); $config = $processor->processConfiguration(new Configuration(true), [ [ + 'http_method_override' => false, 'serializer' => [ 'default_context' => [ 'foo' => 'bar', @@ -588,6 +589,7 @@ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisa $processor = new Processor(); $config = $processor->processConfiguration(new Configuration(true), [ [ + 'http_method_override' => false, 'serializer' => [ 'default_context' => [ 'foo' => 'bar', @@ -605,6 +607,7 @@ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisa $processor = new Processor(); $config = $processor->processConfiguration(new Configuration(true), [ [ + 'http_method_override' => false, 'serializer' => [ 'default_context' => [ 'foo' => 'bar', From 25260d475a9d233a780f95a70b250a251af1e172 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 26 Jul 2024 15:24:20 +0200 Subject: [PATCH 57/59] Fix merge (bis) --- .../Tests/DependencyInjection/ConfigurationTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 1d48dce8f1709..171cfedc4c3f5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -573,6 +573,8 @@ public function testSerializerJsonDetailedErrorMessagesEnabledWhenDefaultContext $config = $processor->processConfiguration(new Configuration(true), [ [ 'http_method_override' => false, + 'handle_all_throwables' => true, + 'php_errors' => ['log' => true], 'serializer' => [ 'default_context' => [ 'foo' => 'bar', @@ -590,6 +592,8 @@ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisa $config = $processor->processConfiguration(new Configuration(true), [ [ 'http_method_override' => false, + 'handle_all_throwables' => true, + 'php_errors' => ['log' => true], 'serializer' => [ 'default_context' => [ 'foo' => 'bar', @@ -608,6 +612,8 @@ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisa $config = $processor->processConfiguration(new Configuration(true), [ [ 'http_method_override' => false, + 'handle_all_throwables' => true, + 'php_errors' => ['log' => true], 'serializer' => [ 'default_context' => [ 'foo' => 'bar', From ca777c581bf13e6c81ad9118c9cdab71537ef015 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Jul 2024 16:51:55 +0200 Subject: [PATCH 58/59] Update CHANGELOG for 6.4.10 --- CHANGELOG-6.4.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG-6.4.md b/CHANGELOG-6.4.md index 6171610473139..8059eaa560721 100644 --- a/CHANGELOG-6.4.md +++ b/CHANGELOG-6.4.md @@ -7,6 +7,32 @@ in 6.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/v6.4.0...v6.4.1 +* 6.4.10 (2024-07-26) + + * bug #57803 [FrameworkBundle] move adding detailed JSON error messages to the validate phase (xabbuh) + * bug #57815 [Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling (alexandre-daubois) + * bug #57828 [Translation] Fix CSV escape char in `CsvFileLoader` on PHP >= 7.4 (alexandre-daubois) + * bug #57812 [Validator] treat uninitialized properties referenced by property paths as null (xabbuh) + * bug #57816 [DoctrineBridge] fix messenger bus dispatch inside an active transaction (IndraGunawan) + * bug #57799 [ErrorHandler][VarDumper] Remove PHP 8.4 deprecations (alexandre-daubois) + * bug #57772 [WebProfilerBundle] Add word wrap in tables in dialog to see all the text in workflow listeners dialog (SpartakusMd) + * bug #57802 [PropertyInfo] Fix nullable value returned from extractFromMutator on CollectionType (benjilebon) + * bug #57832 [DependencyInjection] Do not try to load default method name on interface (lyrixx) + * bug #57748 [SecurityBundle] use firewall-specific user checkers when manually logging in users (xabbuh) + * bug #57753 [ErrorHandler] restrict the maximum length of the X-Debug-Exception header (xabbuh) + * bug #57674 [Cache] Improve `dbindex` DSN parameter parsing (constantable) + * bug #57679 [WebProfilerBundle] Change incorrect check for the `stateless` request attribute (themasch) + * bug #57663 [Cache] use copy() instead of rename() on Windows (xabbuh) + * bug #57617 [PropertyInfo] Handle collection in PhpStan same as PhpDoc (mtarld) + * bug #54057 [Messenger] Passing actual `Envelope` to `WorkerMessageRetriedEvent` (daffoxdev) + * bug #57645 [Routing] Discard in-memory cache of routes when writing the file-based cache (mpdude) + * bug #57621 [Mailer]  force HTTP 1.1 for Mailgun API requests (xabbuh) + * bug #57616 [String] Revert "Fixed u()->snake(), b()->snake() and s()->snake() methods" (nicolas-grekas) + * bug #57593 [SecurityBundle] Compare paths after realpath() has been applied to both (xabbuh) + * bug #57594 [String] Normalize underscores in snake() (xabbuh) + * bug #57585 [HttpFoundation] Fix MockArraySessionStorage to generate more conform ids (Seldaek) + * bug #57589 [FrameworkBundle] fix AssetMapper usage without assets enabled (xabbuh) + * 6.4.9 (2024-06-28) * bug #57553 [HttpKernel] Enable optional cache-warmers when cache-dir != build-dir (nicolas-grekas) From 13a7f27aef5a49e803e5c5ae844c2f99c4a80fd7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Jul 2024 16:52:04 +0200 Subject: [PATCH 59/59] Update VERSION for 6.4.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 4f06ff8944ba9..22c3bc2b3372e 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.4.10-DEV'; + public const VERSION = '6.4.10'; public const VERSION_ID = 60410; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 10; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2026'; public const END_OF_LIFE = '11/2027';