diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f749de5e0d82a..c2e5d98e69343 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | 7.2 for features / 5.4, 6.4, 7.0, and 7.1 for bug fixes +| Branch? | 7.2 for features / 5.4, 6.4, and 7.1 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | Deprecations? | yes/no diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 7994d7dcc44b4..25efdc118e4a7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -44,6 +44,13 @@ jobs: LDAP_PORT_NUMBER: 3389 LDAP_USERS: a LDAP_PASSWORDS: a + ftp: + image: onekilo79/ftpd_test + ports: + - 21:21 + - 30000-30009:30000-30009 + volumes: + - ./:/hostmount redis: image: redis:6.2.8 ports: @@ -144,6 +151,11 @@ jobs: curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default/buckets -d 'ramQuotaMB=100&bucketType=ephemeral&name=cache' curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default -d 'memoryQuota=256' + - name: Create FTP fixtures + run: | + mkdir -p ./ftpusers/test/pub + touch ./ftpusers/test/pub/example ./ftpusers/test/readme.txt + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -196,6 +208,7 @@ jobs: - name: Run tests run: ./phpunit --group integration -v env: + INTEGRATION_FTP_URL: 'ftp://test:test@localhost' REDIS_HOST: 'localhost:16379' REDIS_AUTHENTICATED_HOST: 'localhost:16380' REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005' diff --git a/CHANGELOG-5.4.md b/CHANGELOG-5.4.md index 5fcb1b3325c48..8e55ce7f210fe 100644 --- a/CHANGELOG-5.4.md +++ b/CHANGELOG-5.4.md @@ -7,6 +7,34 @@ 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.43 (2024-08-30) + + * bug #58110 [PropertyAccess] Fix handling property names with a `.` (alexandre-daubois) + * bug #58127 [Validator] synchronize IBAN formats (xabbuh) + * bug #58112 fix Twig 3.12 compatibility (xabbuh) + * bug #58078 [TwigBridge] Fix Twig deprecation notice (yceruto) + * bug #58000 [DependencyInjection] Fix issue between decorator and service locator index (lyrixx) + * bug #58044 [HttpClient] Do not overwrite the host to request when using option "resolve" (xabbuh) + * bug #57298 [DependencyInjection] Fix handling of repeated `#[Autoconfigure]` attributes (alexandre-daubois) + * bug #57493 [SecurityBundle] Make security schema deterministic (MatTheCat) + * bug #58020 [TwigBridge] fix compatibility with Twig 3.12 and 4.0 (xabbuh) + * bug #58002 [Security] Revert stateless check for ContextListener (VincentLanglet) + * bug #57853 [Console] Fix side-effects from running bash completions (Seldaek) + * bug #57997 [Console][PhpUnitBridge][VarDumper] Fix handling NO_COLOR env var (nicolas-grekas) + * bug #57984 [Validator] Add `D` regex modifier in relevant validators (alexandre-daubois) + * bug #57981 [HttpClient] reject malformed URLs with a meaningful exception (xabbuh) + * bug #57968 [Yaml] :bug: throw ParseException on invalid date (homersimpsons) + * bug #57925 [Validator] reset the validation context after validating nested constraints (xabbuh) + * bug #57920 [Form] Fix handling empty data in ValueToDuplicatesTransformer (xabbuh) + * bug #57917 [HttpKernel] [WebProfileBundle] Fix Routing panel for URLs with a colon (akeylimepie) + * bug #57861 [Form] NumberType: Fix parsing of numbers in exponential notation with negative exponent (jbtronics) + * bug #57921 [Finder] do not duplicate directory separators (xabbuh) + * bug #57895 [Finder] do not duplicate directory separators (xabbuh) + * bug #57905 [Validator] allow more unicode characters in URL paths (xabbuh) + * bug #57899 [String] [EnglishInflector] Fix words ending with `le`, e.g., `articles` (aleho) + * bug #57887 [Uid] Ensure UuidV1 is created in lowercase (smnandre) + * bug #57870 [HttpClient] Disable HTTP/2 PUSH by default when using curl (nicolas-grekas) + * 5.4.42 (2024-07-26) * bug #57815 [Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling (alexandre-daubois) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e0cdfdc00f607..97c88efdd0dbe 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -32,8 +32,8 @@ The Symfony Connect username in parenthesis allows to get more information - Yonel Ceruto (yonelceruto) - Hugo Hamon (hhamon) - Tobias Nyholm (tobias) - - Jérôme Tamarelle (gromnan) - HypeMC (hypemc) + - Jérôme Tamarelle (gromnan) - Samuel ROZE (sroze) - Antoine Lamirault (alamirault) - Pascal Borreli (pborreli) @@ -51,37 +51,37 @@ The Symfony Connect username in parenthesis allows to get more information - Igor Wiedler - Jan Schädlich (jschaedl) - Mathieu Lechat (mat_the_cat) - - Gabriel Ostrolucký (gadelat) - Matthias Pigulla (mpdude) + - Gabriel Ostrolucký (gadelat) + - Simon André (simonandre) - Jonathan Wage (jwage) - Vincent Langlet (deviling) - Valentin Udaltsov (vudaltsov) - Alexandre Salomé (alexandresalome) - - Simon André (simonandre) - Grégoire Paris (greg0ire) - William DURAND - ornicar - Dany Maillard (maidmaid) + - Mathias Arlaud (mtarld) - Eriksen Costa - Diego Saint Esteben (dosten) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Gábor Egyed (1ed) - Francis Besset (francisbesset) - - Mathias Arlaud (mtarld) - Titouan Galopin (tgalopin) - Pierre du Plessis (pierredup) - David Maicher (dmaicher) - - Bulat Shakirzyanov (avalanche123) - Tomasz Kowalczyk (thunderer) + - Bulat Shakirzyanov (avalanche123) - Iltar van der Berg - Miha Vrhovnik (mvrhov) - Gary PEGEOT (gary-p) - Saša Stamenković (umpirsky) - Allison Guilhem (a_guilhem) - - Mathieu Piot (mpiot) - Mathieu Santostefano (welcomattic) - Alexander Schranz (alexander-schranz) + - Mathieu Piot (mpiot) - Vasilij Duško (staff) - Sarah Khalil (saro0h) - Laurent VOULLEMIER (lvo) @@ -166,6 +166,7 @@ The Symfony Connect username in parenthesis allows to get more information - excelwebzone - Paráda József (paradajozsef) - Maximilian Beckers (maxbeckers) + - Valtteri R (valtzu) - Baptiste Clavié (talus) - Alexander Schwenn (xelaris) - Fabien Pennequin (fabienpennequin) @@ -173,11 +174,11 @@ The Symfony Connect username in parenthesis allows to get more information - Malte Schlüter (maltemaltesich) - jeremyFreeAgent (jeremyfreeagent) - Michael Babker (mbabker) - - Valtteri R (valtzu) - Joshua Thijssen - Vasilij Dusko - Daniel Wehner (dawehner) - Maxime Helias (maxhelias) + - Dāvis Zālītis (k0d3r1s) - Robert Schönthal (digitalkaoz) - Smaine Milianni (ismail1432) - François-Xavier de Guillebon (de-gui_f) @@ -189,7 +190,6 @@ The Symfony Connect username in parenthesis allows to get more information - Niels Keurentjes (curry684) - OGAWA Katsuhiro (fivestar) - Jhonny Lidfors (jhonne) - - Dāvis Zālītis (k0d3r1s) - Juti Noppornpitak (shiroyuki) - Gregor Harlan (gharlan) - Hugo Alliaume (kocal) @@ -246,6 +246,7 @@ The Symfony Connect username in parenthesis allows to get more information - Daniel Burger - Ben Davies (bendavies) - YaFou + - Guillaume (guill) - Clemens Tolboom - Oleg Voronkovich - Helmer Aaviksoo @@ -274,7 +275,6 @@ The Symfony Connect username in parenthesis allows to get more information - Sébastien Alfaiate (seb33300) - James Halsall (jaitsu) - Christian Scheb - - Guillaume (guill) - Mikael Pajunen - Warnar Boekkooi (boekkooi) - Justin Hileman (bobthecow) @@ -354,6 +354,9 @@ The Symfony Connect username in parenthesis allows to get more information - Marcin Sikoń (marphi) - Michele Orselli (orso) - Sven Paulus (subsven) + - Indra Gunawan (indragunawan) + - Peter Kruithof (pkruithof) + - Alex Hofbauer (alexhofbauer) - Maxime Veber (nek-) - Valentine Boineau (valentineboineau) - Rui Marinho (ruimarinho) @@ -383,6 +386,7 @@ The Symfony Connect username in parenthesis allows to get more information - Alexander Kotynia (olden) - Elnur Abdurrakhimov (elnur) - Manuel Reinhard (sprain) + - Antonio J. García Lagar (ajgarlag) - BoShurik - Quentin Devos - Adam Prager (padam87) @@ -392,9 +396,6 @@ The Symfony Connect username in parenthesis allows to get more information - Roman Ring (inori) - Xavier Montaña Carreras (xmontana) - Arjen van der Meijden - - Indra Gunawan (indragunawan) - - Peter Kruithof (pkruithof) - - Alex Hofbauer (alexhofbauer) - Romaric Drigon (romaricdrigon) - Sylvain Fabre (sylfabre) - Xavier Perez @@ -458,7 +459,6 @@ The Symfony Connect username in parenthesis allows to get more information - Tim Goudriaan (codedmonkey) - Robert Kiss (kepten) - Zan Baldwin (zanbaldwin) - - Antonio J. García Lagar (ajgarlag) - Alexandre Quercia (alquerci) - Marcos Sánchez - Emanuele Panzeri (thepanz) @@ -473,6 +473,7 @@ The Symfony Connect username in parenthesis allows to get more information - Iker Ibarguren (ikerib) - Michael Hirschler (mvhirsch) - Michael Holm (hollo) + - Robert Meijers - Blanchon Vincent (blanchonvincent) - Christian Schmidt - Ben Hakim @@ -552,7 +553,6 @@ The Symfony Connect username in parenthesis allows to get more information - Pierre Rineau - Kai Dederichs - Pavel Kirpitsov (pavel-kirpichyov) - - Robert Meijers - Artur Eshenbrener - Harm van Tilborg (hvt) - Thomas Perez (scullwm) @@ -655,6 +655,7 @@ The Symfony Connect username in parenthesis allows to get more information - Alexandru Furculita (afurculita) - Michel Salib (michelsalib) - Ben Roberts (benr77) + - Ahmed Ghanem (ahmedghanem00) - Valentin Jonovs - geoffrey - Benoit Galati (benoitgalati) @@ -743,6 +744,7 @@ The Symfony Connect username in parenthesis allows to get more information - Vadim Borodavko (javer) - Tavo Nieves J (tavoniievez) - Luc Vieillescazes (iamluc) + - roman joly (eltharin) - Erik Saunier (snickers) - François Dume (franek) - Jerzy Lekowski (jlekowski) @@ -931,7 +933,6 @@ The Symfony Connect username in parenthesis allows to get more information - Bastien DURAND (deamon) - Dmitry Simushev - alcaeus - - Ahmed Ghanem (ahmedghanem00) - Simon Leblanc (leblanc_simon) - Fred Cox - Simon DELICATA @@ -946,6 +947,7 @@ The Symfony Connect username in parenthesis allows to get more information - Jon Gotlin (jongotlin) - Adrian Nguyen (vuphuong87) - benjaminmal + - Roy de Vos Burchart - Andrey Sevastianov - Oleksandr Barabolia (oleksandrbarabolia) - Khoo Yong Jun @@ -1088,6 +1090,7 @@ The Symfony Connect username in parenthesis allows to get more information - Marek Pietrzak (mheki) - “Filip - Mickaël Andrieu (mickaelandrieu) + - Jan Böhmer - Simon Watiau (simonwatiau) - Ruben Jacobs (rubenj) - Simon Schick (simonsimcity) @@ -1212,6 +1215,7 @@ The Symfony Connect username in parenthesis allows to get more information - stoccc - Grégoire Penverne (gpenverne) - Venu + - Ryan Hendrickson - Damien Fa - Jonatan Männchen - Dennis Hotson @@ -1241,6 +1245,7 @@ The Symfony Connect username in parenthesis allows to get more information - Edvin Hultberg - shubhalgupta - Felds Liscia (felds) + - Benjamin Lebon - Sergey Panteleev - Alexander Grimalovsky (flying) - Andrew Hilobok (hilobok) @@ -1249,8 +1254,8 @@ The Symfony Connect username in parenthesis allows to get more information - Max Baldanza - Volodymyr Panivko - kick-the-bucket + - Thomas Durand - fedor.f - - roman joly (eltharin) - Yosmany Garcia (yosmanyga) - Jeremiasz Major - Jibé Barth (jibbarth) @@ -1337,6 +1342,7 @@ The Symfony Connect username in parenthesis allows to get more information - Dhananjay Goratela - Kien Nguyen - Bozhidar Hristov + - Oriol Viñals - arai - Achilles Kaloeridis (achilles) - Laurent Bassin (lbassin) @@ -1353,6 +1359,7 @@ The Symfony Connect username in parenthesis allows to get more information - Sergey Zolotov (enleur) - Nicole Cordes (ichhabrecht) - Maksim Kotlyar (makasim) + - Thibaut THOUEMENT (thibaut_thouement) - Neil Ferreira - Julie Hourcade (juliehde) - Dmitry Parnas (parnas) @@ -1384,6 +1391,7 @@ The Symfony Connect username in parenthesis allows to get more information - Gabrielle Langer - Jörn Lang - Adrian Günter (adrianguenter) + - Amr Ezzat (amrezzat) - David Marín Carreño (davefx) - Fabien LUCAS (flucas2) - Alex (garrett) @@ -1491,6 +1499,7 @@ The Symfony Connect username in parenthesis allows to get more information - Thomas Jarrand - Baptiste Leduc (bleduc) - soyuka + - Piotr Zajac - Patrick Kaufmann - Ismail Özgün Turan (dadeather) - Mickael Perraud @@ -1514,6 +1523,7 @@ The Symfony Connect username in parenthesis allows to get more information - Stefan Graupner (efrane) - Gemorroj (gemorroj) - Adrien Chinour + - Jonas Claes - Mateusz Żyła (plotkabytes) - Rikijs Murgs - WoutervanderLoop.nl @@ -1678,6 +1688,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ariel J. Birnbaum - Yannick - Patrick Luca Fazzi (ap3ir0n) + - Tim Lieberman - Danijel Obradović - Pablo Borowicz - Ondřej Frei @@ -1854,7 +1865,6 @@ The Symfony Connect username in parenthesis allows to get more information - hjkl - Dan Wilga - Thijs Reijgersberg - - Jan Böhmer - Florian Heller - Oleksii Svitiashchuk - Andrew Tch @@ -1905,6 +1915,7 @@ The Symfony Connect username in parenthesis allows to get more information - Will Donohoe - peter - Jeroen de Boer + - Oleg Sedinkin (akeylimepie) - Jérémy Jourdin (jjk801) - BRAMILLE Sébastien (oktapodia) - Loïc Ovigne (oviglo) @@ -2108,6 +2119,7 @@ The Symfony Connect username in parenthesis allows to get more information - Oriol Mangas Abellan (oriolman) - Raphaël Geffroy (raphael-geffroy) - Sebastian Göttschkes (sgoettschkes) + - Marcin Nowak - Frankie Wittevrongel - Tatsuya Tsuruoka - Ross Tuck @@ -2189,6 +2201,7 @@ The Symfony Connect username in parenthesis allows to get more information - Flavien Knuchel (knuch) - Mathieu TUDISCO (mathieutu) - Dmytro Dzubenko + - Martijn Croonen - Peter Ward - markusu49 - Steve Frécinaux @@ -2279,6 +2292,7 @@ The Symfony Connect username in parenthesis allows to get more information - Patrick Daley (padrig) - Phillip Look (plook) - Foxprodev + - Artfaith - developer-av - Max Summe - Ema Panz @@ -2349,7 +2363,6 @@ The Symfony Connect username in parenthesis allows to get more information - Thomas Hanke - ffd000 - Daniel Tschinder - - Thomas Durand - Arnaud CHASSEUX - Zlatoslav Desyatnikov - Wickex @@ -2581,7 +2594,6 @@ The Symfony Connect username in parenthesis allows to get more information - Marcel Siegert - ryunosuke - Bruno BOUTAREL - - Roy de Vos Burchart - John Stevenson - everyx - Richard Heine @@ -2813,6 +2825,7 @@ The Symfony Connect username in parenthesis allows to get more information - efeen - Mikko Ala-Fossi - Jan Christoph Beyer + - withbest - Nicolas Pion - Muhammed Akbulut - Daniel Tiringer @@ -2899,12 +2912,12 @@ The Symfony Connect username in parenthesis allows to get more information - Ivo - Ismo Vuorinen - Markus Staab - - Ryan Hendrickson - Valentin - Gerard - Sören Bernstein - michael.kubovic - devel + - Iain Cambridge - taiiiraaa - Ali Tavafi - gedrox @@ -3146,7 +3159,6 @@ The Symfony Connect username in parenthesis allows to get more information - Adrien Peyre (adpeyre) - Aaron Scherer (aequasi) - Alexandre Jardin (alexandre.jardin) - - Amr Ezzat (amrezzat) - Bart Brouwer (bartbrouwer) - baron (bastien) - Bastien Clément (bastienclement) @@ -3283,6 +3295,7 @@ The Symfony Connect username in parenthesis allows to get more information - Edwin Hageman - Mantas Urnieža - temperatur + - ToshY - Paul Andrieux - Sezil - misterx @@ -3408,6 +3421,7 @@ The Symfony Connect username in parenthesis allows to get more information - tsilefy - Enrico - Adrien Foulon + - Sylvain Just - Ryan Rud - Ondrej Slinták - Jérémie Broutier @@ -3481,6 +3495,7 @@ The Symfony Connect username in parenthesis allows to get more information - enomotodev - Vincent - Benjamin Long + - Fabio Panaccione - Kévin Gonella - Ben Miller - Peter Gribanov @@ -3750,8 +3765,10 @@ The Symfony Connect username in parenthesis allows to get more information - Aleksandar Dimitrov (netbull) - Pierre-Henry Soria 🌴 (pierrehenry) - Pierre Geyer (ptheg) + - Richard Henkenjohann (richardhj) - Thomas BERTRAND (sevrahk) - Vladislav (simpson) + - Marin Bînzari (spartakusmd) - Stefanos Psarras (stefanos) - Matej Žilák (teo_sk) - Gary Houbre (thegarious) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index c2c0cbb8fc9e6..66a677431588e 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 ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { + if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) { return false; } diff --git a/src/Symfony/Bridge/Twig/Node/DumpNode.php b/src/Symfony/Bridge/Twig/Node/DumpNode.php index 4b710f82cb42e..01a2eef8a78ae 100644 --- a/src/Symfony/Bridge/Twig/Node/DumpNode.php +++ b/src/Symfony/Bridge/Twig/Node/DumpNode.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Twig\Node; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Attribute\YieldReady; use Twig\Compiler; use Twig\Node\Node; @@ -30,7 +31,12 @@ public function __construct(string $varPrefix, ?Node $values, int $lineno, ?stri $nodes['values'] = $values; } - parent::__construct($nodes, [], $lineno, $tag); + if (class_exists(FirstClassTwigCallableReady::class)) { + parent::__construct($nodes, [], $lineno); + } else { + parent::__construct($nodes, [], $lineno, $tag); + } + $this->varPrefix = $varPrefix; } diff --git a/src/Symfony/Bridge/Twig/Node/FormThemeNode.php b/src/Symfony/Bridge/Twig/Node/FormThemeNode.php index e38557ceacbce..1d077097f119f 100644 --- a/src/Symfony/Bridge/Twig/Node/FormThemeNode.php +++ b/src/Symfony/Bridge/Twig/Node/FormThemeNode.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Twig\Node; use Symfony\Component\Form\FormRenderer; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Attribute\YieldReady; use Twig\Compiler; use Twig\Node\Node; @@ -24,7 +25,11 @@ final class FormThemeNode extends Node { public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false) { - parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag); + if (class_exists(FirstClassTwigCallableReady::class)) { + parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno); + } else { + parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag); + } } public function compile(Compiler $compiler): void diff --git a/src/Symfony/Bridge/Twig/Node/StopwatchNode.php b/src/Symfony/Bridge/Twig/Node/StopwatchNode.php index 9a69d4eff39fc..239d1ca654bca 100644 --- a/src/Symfony/Bridge/Twig/Node/StopwatchNode.php +++ b/src/Symfony/Bridge/Twig/Node/StopwatchNode.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Twig\Node; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Attribute\YieldReady; use Twig\Compiler; use Twig\Node\Expression\AssignNameExpression; @@ -26,7 +27,11 @@ final class StopwatchNode extends Node { public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null) { - parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag); + if (class_exists(FirstClassTwigCallableReady::class)) { + parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno); + } else { + parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag); + } } public function compile(Compiler $compiler): void diff --git a/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php b/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php index d24d7f75f236b..28cb6f1b4b2d3 100644 --- a/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php +++ b/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Twig\Node; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Attribute\YieldReady; use Twig\Compiler; use Twig\Node\Expression\AbstractExpression; @@ -24,7 +25,11 @@ final class TransDefaultDomainNode extends Node { public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null) { - parent::__construct(['expr' => $expr], [], $lineno, $tag); + if (class_exists(FirstClassTwigCallableReady::class)) { + parent::__construct(['expr' => $expr], [], $lineno); + } else { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } } public function compile(Compiler $compiler): void diff --git a/src/Symfony/Bridge/Twig/Node/TransNode.php b/src/Symfony/Bridge/Twig/Node/TransNode.php index 0224d46ae0e50..a711a7cab59cb 100644 --- a/src/Symfony/Bridge/Twig/Node/TransNode.php +++ b/src/Symfony/Bridge/Twig/Node/TransNode.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Twig\Node; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Attribute\YieldReady; use Twig\Compiler; use Twig\Node\Expression\AbstractExpression; @@ -42,7 +43,11 @@ public function __construct(Node $body, ?Node $domain = null, ?AbstractExpressio $nodes['locale'] = $locale; } - parent::__construct($nodes, [], $lineno, $tag); + if (class_exists(FirstClassTwigCallableReady::class)) { + parent::__construct($nodes, [], $lineno); + } else { + parent::__construct($nodes, [], $lineno, $tag); + } } public function compile(Compiler $compiler): void diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index 7570126fa80eb..12eaad3796081 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -61,7 +61,7 @@ public function enterNode(Node $node, Environment $env): Node return $node; } - if ($node instanceof FilterExpression && 'trans' === $node->getNode('filter')->getAttribute('value')) { + if ($node instanceof FilterExpression && 'trans' === ($node->hasAttribute('twig_callable') ? $node->getAttribute('twig_callable')->getName() : $node->getNode('filter')->getAttribute('value'))) { $arguments = $node->getNode('arguments'); if ($this->isNamedArguments($arguments)) { if (!$arguments->hasNode('domain') && !$arguments->hasNode(1)) { diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php index 39cd4b142af10..274f6111048e9 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php @@ -57,7 +57,7 @@ public function enterNode(Node $node, Environment $env): Node if ( $node instanceof FilterExpression && - 'trans' === $node->getNode('filter')->getAttribute('value') && + 'trans' === ($node->hasAttribute('twig_callable') ? $node->getAttribute('twig_callable')->getName() : $node->getNode('filter')->getAttribute('value')) && $node->getNode('node') instanceof ConstantExpression ) { // extract constant nodes with a trans filter @@ -85,7 +85,7 @@ public function enterNode(Node $node, Environment $env): Node ]; } elseif ( $node instanceof FilterExpression && - 'trans' === $node->getNode('filter')->getAttribute('value') && + 'trans' === ($node->hasAttribute('twig_callable') ? $node->getAttribute('twig_callable')->getName() : $node->getNode('filter')->getAttribute('value')) && $node->getNode('node') instanceof ConcatBinary && $message = $this->getConcatValueFromNode($node->getNode('node'), null) ) { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php index 29c68c0bcd8d0..26e65e7dbba5d 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php @@ -74,7 +74,7 @@ public function testGenerateFragmentUri() 'index' => sprintf(<< true, 'cache' => false]); $twig->addExtension(new HttpKernelExtension()); @@ -84,7 +84,7 @@ public function testGenerateFragmentUri() ]); $twig->addRuntimeLoader($loader); - $this->assertSame('/_fragment?_hash=PP8%2FeEbn1pr27I9wmag%2FM6jYGVwUZ0l2h0vhh2OJ6CI%3D&_path=template%3Dfoo.html.twig%26_format%3Dhtml%26_locale%3Den%26_controller%3DSymfonyBundleFrameworkBundleControllerTemplateController%253A%253AtemplateAction', $twig->render('index')); + $this->assertSame('/_fragment?_hash=XCg0hX8QzSwik8Xuu9aMXhoCeI4oJOob7lUVacyOtyY%3D&_path=template%3Dfoo.html.twig%26_format%3Dhtml%26_locale%3Den%26_controller%3DSymfony%255CBundle%255CFrameworkBundle%255CController%255CTemplateController%253A%253AtemplateAction', $twig->render('index')); } protected function getFragmentHandler($returnOrException): FragmentHandler diff --git a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php index b259990e0b7ad..c2fdb4e778541 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Compiler; use Twig\Environment; use Twig\Extension\CoreExtension; @@ -22,6 +23,7 @@ use Twig\Node\Expression\ConstantExpression; use Twig\Node\Expression\NameExpression; use Twig\Node\Node; +use Twig\TwigFunction; class SearchAndRenderBlockNodeTest extends TestCase { @@ -31,7 +33,11 @@ public function testCompileWidget() new NameExpression('form', 0), ]); - $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_widget'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -54,7 +60,11 @@ public function testCompileWidgetWithVariables() ], 0), ]); - $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_widget'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -74,7 +84,11 @@ public function testCompileLabelWithLabel() new ConstantExpression('my label', 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -94,7 +108,11 @@ public function testCompileLabelWithNullLabel() new ConstantExpression(null, 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -116,7 +134,11 @@ public function testCompileLabelWithEmptyStringLabel() new ConstantExpression('', 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -137,7 +159,11 @@ public function testCompileLabelWithDefaultLabel() new NameExpression('form', 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -161,7 +187,11 @@ public function testCompileLabelWithAttributes() ], 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -190,7 +220,11 @@ public function testCompileLabelWithLabelAndAttributes() ], 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -218,7 +252,11 @@ public function testCompileLabelWithLabelThatEvaluatesToNull() ), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); @@ -256,7 +294,11 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes() ], 0), ]); - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new SearchAndRenderBlockNode(new TwigFunction('form_label'), $arguments, 0); + } else { + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + } $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class))); diff --git a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php index bf073602583f7..be26c9b425efc 100644 --- a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php +++ b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Environment; use Twig\Loader\LoaderInterface; use Twig\Node\Expression\ArrayExpression; @@ -20,6 +21,8 @@ use Twig\Node\Expression\FilterExpression; use Twig\Node\Expression\NameExpression; use Twig\Node\Node; +use Twig\TwigFilter; +use Twig\TwigFunction; class TranslationNodeVisitorTest extends TestCase { @@ -38,15 +41,27 @@ public function testMessageExtractionWithInvalidDomainNode() { $message = 'new key'; - $node = new FilterExpression( - new ConstantExpression($message, 0), - new ConstantExpression('trans', 0), - new Node([ - new ArrayExpression([], 0), - new NameExpression('variable', 0), - ]), - 0 - ); + if (class_exists(FirstClassTwigCallableReady::class)) { + $node = new FilterExpression( + new ConstantExpression($message, 0), + new TwigFilter('trans'), + new Node([ + new ArrayExpression([], 0), + new NameExpression('variable', 0), + ]), + 0 + ); + } else { + $node = new FilterExpression( + new ConstantExpression($message, 0), + new ConstantExpression('trans', 0), + new Node([ + new ArrayExpression([], 0), + new NameExpression('variable', 0), + ]), + 0 + ); + } $this->testMessagesExtraction($node, [[$message, TranslationNodeVisitor::UNDEFINED_DOMAIN]]); } diff --git a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php index 69311afdc824d..7a79c34130016 100644 --- a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php +++ b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php @@ -13,6 +13,7 @@ use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; use Symfony\Bridge\Twig\Node\TransNode; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Node\BodyNode; use Twig\Node\Expression\ArrayExpression; use Twig\Node\Expression\ConstantExpression; @@ -20,13 +21,14 @@ use Twig\Node\ModuleNode; use Twig\Node\Node; use Twig\Source; +use Twig\TwigFilter; class TwigNodeProvider { public static function getModule($content) { return new ModuleNode( - new ConstantExpression($content, 0), + new BodyNode([new ConstantExpression($content, 0)]), null, new ArrayExpression([], 0), new ArrayExpression([], 0), @@ -45,9 +47,18 @@ public static function getTransFilter($message, $domain = null, $arguments = nul ] : []; } + if (!class_exists(FirstClassTwigCallableReady::class)) { + return new FilterExpression( + new ConstantExpression($message, 0), + new ConstantExpression('trans', 0), + new Node($arguments), + 0 + ); + } + return new FilterExpression( new ConstantExpression($message, 0), - new ConstantExpression('trans', 0), + new TwigFilter('trans'), new Node($arguments), 0 ); diff --git a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php index 41504050f74f8..c9c0ce80c1b2d 100644 --- a/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php +++ b/src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\Node\FormThemeNode; use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; +use Twig\Attribute\FirstClassTwigCallableReady; use Twig\Environment; use Twig\Loader\LoaderInterface; use Twig\Node\Expression\ArrayExpression; @@ -35,6 +36,10 @@ public function testCompile($source, $expected) $stream = $env->tokenize($source); $parser = new Parser($env); + if (class_exists(FirstClassTwigCallableReady::class)) { + $expected->setNodeTag('form_theme'); + } + $expected->setSourceContext($source); $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd b/src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd index 1a367b8397213..3b13833629102 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd @@ -117,7 +117,7 @@ - + @@ -176,7 +176,7 @@ - + diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/Authenticator/CustomAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/Authenticator/CustomAuthenticator.php new file mode 100644 index 0000000000000..89019e7be41e2 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/Authenticator/CustomAuthenticator.php @@ -0,0 +1,29 @@ +children() + ->scalarNode('foo')->defaultValue('bar')->end() + ->end() + ; + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_own_namespace.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_own_namespace.xml new file mode 100644 index 0000000000000..177cb88f59e6b --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_own_namespace.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_security_namespace.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_security_namespace.xml new file mode 100644 index 0000000000000..1dbbc9d9a8901 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_authenticator_under_security_namespace.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_own_namespace.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_own_namespace.xml new file mode 100644 index 0000000000000..45d6602516a69 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_own_namespace.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_security_namespace.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_security_namespace.xml new file mode 100644 index 0000000000000..00890b2d66be0 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/custom_provider_under_security_namespace.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomAuthenticatorTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomAuthenticatorTest.php new file mode 100644 index 0000000000000..de3db233a2060 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomAuthenticatorTest.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; +use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\Authenticator\CustomAuthenticator; +use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider\CustomProvider; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + +class XmlCustomAuthenticatorTest extends TestCase +{ + /** + * @dataProvider provideXmlConfigurationFile + */ + public function testCustomProviderElement(string $configurationFile) + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.debug', false); + $container->register('cache.system', \stdClass::class); + + $security = new SecurityExtension(); + $security->addAuthenticatorFactory(new CustomAuthenticator()); + $container->registerExtension($security); + + (new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml')))->load($configurationFile); + + $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); + $container->compile(); + + $this->addToAssertionCount(1); + } + + public static function provideXmlConfigurationFile(): iterable + { + yield 'Custom authenticator element under SecurityBundle’s namespace' => ['custom_authenticator_under_security_namespace.xml']; + yield 'Custom authenticator element under its own namespace' => ['custom_authenticator_under_own_namespace.xml']; + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomProviderTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomProviderTest.php new file mode 100644 index 0000000000000..a3f59fc299a24 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomProviderTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection; + +use PHPUnit\Framework\TestCase; +use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; +use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider\CustomProvider; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + +class XmlCustomProviderTest extends TestCase +{ + /** + * @dataProvider provideXmlConfigurationFile + */ + public function testCustomProviderElement(string $configurationFile) + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.debug', false); + $container->register('cache.system', \stdClass::class); + + $security = new SecurityExtension(); + $security->addUserProviderFactory(new CustomProvider()); + $container->registerExtension($security); + + (new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml')))->load($configurationFile); + + $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); + $container->compile(); + + $this->addToAssertionCount(1); + } + + public static function provideXmlConfigurationFile(): iterable + { + yield 'Custom provider element under SecurityBundle’s namespace' => ['custom_provider_under_security_namespace.xml']; + yield 'Custom provider element under its own namespace' => ['custom_provider_under_own_namespace.xml']; + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 097031baffb6d..2ffc3df2e5f12 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -19,7 +19,7 @@ "php": ">=7.2.5", "ext-xml": "*", "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.3|^6.0", + "symfony/dependency-injection": "^5.4.43|^6.4.11", "symfony/deprecation-contracts": "^2.1|^3", "symfony/event-dispatcher": "^5.1|^6.0", "symfony/http-kernel": "^5.3|^6.0", diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php index 0de07db823f97..60a5a9e7054d8 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php @@ -83,10 +83,10 @@ public function panelAction(string $token): Response */ private function getTraces(RequestDataCollector $request, string $method): array { - $traceRequest = Request::create( - $request->getPathInfo(), - $request->getRequestServer(true)->get('REQUEST_METHOD'), - \in_array($request->getMethod(), ['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(), + $traceRequest = new Request( + $request->getRequestQuery()->all(), + $request->getRequestRequest()->all(), + $request->getRequestAttributes()->all(), $request->getRequestCookies(true)->all(), [], $request->getRequestServer(true)->all() diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php new file mode 100644 index 0000000000000..07d5a0739e393 --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller; + +use Symfony\Bundle\FrameworkBundle\KernelBrowser; +use Symfony\Bundle\FrameworkBundle\Routing\Router; +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Bundle\WebProfilerBundle\Tests\Functional\WebProfilerBundleKernel; +use Symfony\Component\DomCrawler\Crawler; +use Symfony\Component\Routing\Route; + +class RouterControllerTest extends WebTestCase +{ + public function testFalseNegativeTrace() + { + $path = '/foo/bar:123/baz'; + + $kernel = new WebProfilerBundleKernel(); + $client = new KernelBrowser($kernel); + $client->disableReboot(); + $client->getKernel()->boot(); + + /** @var Router $router */ + $router = $client->getContainer()->get('router'); + $router->getRouteCollection()->add('route1', new Route($path)); + + $client->request('GET', $path); + + $crawler = $client->request('GET', '/_profiler/latest?panel=router&type=request'); + + $matchedRouteCell = $crawler + ->filter('#router-logs .status-success td') + ->reduce(function (Crawler $td) use ($path): bool { + return $td->text() === $path; + }); + + $this->assertSame(1, $matchedRouteCell->count()); + } +} diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 72479f8a2563a..b53955269a675 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 ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { + if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) { return false; } diff --git a/src/Symfony/Component/Console/Resources/completion.bash b/src/Symfony/Component/Console/Resources/completion.bash index 64b87ccf7c7d5..bb44037b0c2cb 100644 --- a/src/Symfony/Component/Console/Resources/completion.bash +++ b/src/Symfony/Component/Console/Resources/completion.bash @@ -7,7 +7,7 @@ _sf_{{ COMMAND_NAME }}() { # Use newline as only separator to allow space in completion values - IFS=$'\n' + local IFS=$'\n' local sf_cmd="${COMP_WORDS[0]}" # for an alias, get the real script behind it diff --git a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php index 8ca86c1110fbf..08002d4070cf6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php @@ -120,6 +120,10 @@ public function process(ContainerBuilder $container) $container->setAlias($inner, $id)->setPublic($public); } + + foreach ($decoratingDefinitions as $inner => $definition) { + $definition->addTag('container.decorator', ['id' => $inner]); + } } protected function processValue($value, bool $isRoot = false) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php index 8d27303ee0cc6..21ea304db6bac 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php @@ -82,7 +82,8 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container } elseif (null === $defaultIndex && $defaultPriorityMethod && $class) { $defaultIndex = PriorityTaggedServiceUtil::getDefault($container, $serviceId, $class, $defaultIndexMethod ?? 'getDefaultName', $tagName, $indexAttribute, $checkTaggedItem); } - $index = $index ?? $defaultIndex ?? $defaultIndex = $serviceId; + $decorated = $definition->getTag('container.decorator')[0]['id'] ?? null; + $index = $index ?? $defaultIndex ?? $defaultIndex = $decorated ?? $serviceId; $services[] = [$priority, ++$i, $index, $serviceId, $class]; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 7d52958809f62..c8ecaec19affd 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -404,7 +404,33 @@ private function parseFileToDOM(string $file): \DOMDocument try { $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); } catch (\InvalidArgumentException $e) { - throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e); + $invalidSecurityElements = []; + $errors = explode("\n", $e->getMessage()); + foreach ($errors as $i => $error) { + if (preg_match("#^\[ERROR 1871] Element '\{http://symfony\.com/schema/dic/security}([^']+)'#", $error, $matches)) { + $invalidSecurityElements[$i] = $matches[1]; + } + } + if ($invalidSecurityElements) { + $dom = XmlUtils::loadFile($file); + + foreach ($invalidSecurityElements as $errorIndex => $tagName) { + foreach ($dom->getElementsByTagNameNS('http://symfony.com/schema/dic/security', $tagName) as $element) { + if (!$parent = $element->parentNode) { + continue; + } + if ('http://symfony.com/schema/dic/security' !== $parent->namespaceURI) { + continue; + } + if ('provider' === $parent->localName || 'firewall' === $parent->localName) { + unset($errors[$errorIndex]); + } + } + } + } + if ($errors) { + throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).implode("/n", $errors), $e->getCode(), $e); + } } $this->validateExtensions($dom, $file); @@ -777,6 +803,6 @@ private function loadFromExtensions(\DOMDocument $xml) */ public static function convertDomElementToArray(\DOMElement $element) { - return XmlUtils::convertDomElementToArray($element); + return XmlUtils::convertDomElementToArray($element, false); } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 66e1cd84db52c..aee4a9c96c42a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -448,8 +448,9 @@ private function parseDefinition(string $id, $service, string $file, array $defa return $return ? $alias : $this->container->setAlias($id, $alias); } + $changes = []; if (null !== $definition) { - // no-op + $changes = $definition->getChanges(); } elseif ($this->isLoadingInstanceof) { $definition = new ChildDefinition(''); } elseif (isset($service['parent'])) { @@ -472,7 +473,7 @@ private function parseDefinition(string $id, $service, string $file, array $defa $definition->setAutoconfigured($defaults['autoconfigure']); } - $definition->setChanges([]); + $definition->setChanges($changes); if (isset($service['class'])) { $definition->setClass($service['class']); @@ -546,7 +547,7 @@ private function parseDefinition(string $id, $service, string $file, array $defa } if (\is_string($k)) { - throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file)); + throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forget a leading dash before "%s: ..." in "%s"?', $id, $k, $file)); } if (isset($call['method']) && \is_string($call['method'])) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php index cac0460841105..8c8a158a76327 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php @@ -198,7 +198,7 @@ public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitio $this->process($container); $this->assertEmpty($container->getDefinition('baz.inner')->getTags()); - $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar']], $container->getDefinition('baz')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar'], 'container.decorator' => [['id' => 'foo']]], $container->getDefinition('baz')->getTags()); } public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitionMultipleTimes() @@ -221,7 +221,7 @@ public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitio $this->process($container); $this->assertEmpty($container->getDefinition('deco1')->getTags()); - $this->assertEquals(['bar' => ['attr' => 'baz']], $container->getDefinition('deco2')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'container.decorator' => [['id' => 'foo']]], $container->getDefinition('deco2')->getTags()); } public function testProcessLeavesServiceLocatorTagOnOriginalDefinition() @@ -240,7 +240,7 @@ public function testProcessLeavesServiceLocatorTagOnOriginalDefinition() $this->process($container); $this->assertEquals(['container.service_locator' => [0 => []]], $container->getDefinition('baz.inner')->getTags()); - $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar']], $container->getDefinition('baz')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar'], 'container.decorator' => [['id' => 'foo']]], $container->getDefinition('baz')->getTags()); } public function testProcessLeavesServiceSubscriberTagOnOriginalDefinition() @@ -259,7 +259,7 @@ public function testProcessLeavesServiceSubscriberTagOnOriginalDefinition() $this->process($container); $this->assertEquals(['container.service_subscriber' => [], 'container.service_subscriber.locator' => []], $container->getDefinition('baz.inner')->getTags()); - $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar']], $container->getDefinition('baz')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar'], 'container.decorator' => [['id' => 'foo']]], $container->getDefinition('baz')->getTags()); } public function testProcessLeavesProxyTagOnOriginalDefinition() @@ -278,7 +278,7 @@ public function testProcessLeavesProxyTagOnOriginalDefinition() $this->process($container); $this->assertEquals(['proxy' => 'foo'], $container->getDefinition('baz.inner')->getTags()); - $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar']], $container->getDefinition('baz')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar'], 'container.decorator' => [['id' => 'foo']]], $container->getDefinition('baz')->getTags()); } public function testCannotDecorateSyntheticService() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php index c39d79f9e8772..e65735d4133ed 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/PriorityTaggedServiceTraitTest.php @@ -153,6 +153,9 @@ public function testTheIndexedTagsByDefaultIndexMethod() $container->register('service4', HelloInterface::class)->addTag('my_custom_tag'); + $definition = $container->register('debug.service5', \stdClass::class)->addTag('my_custom_tag'); + $definition->addTag('container.decorator', ['id' => 'service5']); + $priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation(); $tag = new TaggedIteratorArgument('my_custom_tag', 'foo', 'getFooBar'); @@ -161,6 +164,7 @@ public function testTheIndexedTagsByDefaultIndexMethod() 'service1' => new TypedReference('service1', FooTagClass::class), '10' => new TypedReference('service3', IntTagClass::class), 'service4' => new TypedReference('service4', HelloInterface::class), + 'service5' => new TypedReference('debug.service5', \stdClass::class), ]; $services = $priorityTaggedServiceTraitImplementation->test($tag, $container); $this->assertSame(array_keys($expected), array_keys($services)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterAutoconfigureAttributesPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterAutoconfigureAttributesPassTest.php index 689c75aa783be..958d1d9b39129 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterAutoconfigureAttributesPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterAutoconfigureAttributesPassTest.php @@ -19,6 +19,12 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureAttributed; use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfiguredInterface; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeated; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeatedBindings; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeatedCalls; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeatedOverwrite; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeatedProperties; +use Symfony\Component\DependencyInjection\Tests\Fixtures\AutoconfigureRepeatedTag; use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists; /** @@ -77,6 +83,99 @@ public function testAutoconfiguredTag() $this->assertEquals([AutoconfiguredInterface::class => $expected], $container->getAutoconfiguredInstanceof()); } + public function testAutoconfiguredRepeated() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeated::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->setLazy(true) + ->setPublic(true) + ->setShared(false); + + $this->assertEquals([AutoconfigureRepeated::class => $expected], $container->getAutoconfiguredInstanceof()); + } + + public function testAutoconfiguredRepeatedOverwrite() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeatedOverwrite::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->setLazy(true) + ->setPublic(false) + ->setShared(true); + + $this->assertEquals([AutoconfigureRepeatedOverwrite::class => $expected], $container->getAutoconfiguredInstanceof()); + } + + public function testAutoconfiguredRepeatedTag() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeatedTag::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->addTag('foo', ['priority' => 2]) + ->addTag('bar'); + + $this->assertEquals([AutoconfigureRepeatedTag::class => $expected], $container->getAutoconfiguredInstanceof()); + } + + public function testAutoconfiguredRepeatedCalls() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeatedCalls::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->addMethodCall('setBar', ['arg2']) + ->addMethodCall('setFoo', ['arg1']); + + $this->assertEquals([AutoconfigureRepeatedCalls::class => $expected], $container->getAutoconfiguredInstanceof()); + } + + public function testAutoconfiguredRepeatedBindingsOverwrite() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeatedBindings::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->setBindings(['$arg' => new BoundArgument('bar', false, BoundArgument::INSTANCEOF_BINDING, realpath(__DIR__.'/../Fixtures/AutoconfigureRepeatedBindings.php'))]); + + $this->assertEquals([AutoconfigureRepeatedBindings::class => $expected], $container->getAutoconfiguredInstanceof()); + } + + public function testAutoconfiguredRepeatedPropertiesOverwrite() + { + $container = new ContainerBuilder(); + $container->register('foo', AutoconfigureRepeatedProperties::class) + ->setAutoconfigured(true); + + (new RegisterAutoconfigureAttributesPass())->process($container); + + $expected = (new ChildDefinition('')) + ->setProperties([ + '$foo' => 'bar', + '$bar' => 'baz', + ]); + + $this->assertEquals([AutoconfigureRepeatedProperties::class => $expected], $container->getAutoconfiguredInstanceof()); + } + public function testMissingParent() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeated.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeated.php new file mode 100644 index 0000000000000..1b6bc639d1b10 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeated.php @@ -0,0 +1,11 @@ + 'foo'])] +#[Autoconfigure(bind: ['$arg' => 'bar'])] +class AutoconfigureRepeatedBindings +{ +} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedCalls.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedCalls.php new file mode 100644 index 0000000000000..ba794a705e000 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedCalls.php @@ -0,0 +1,18 @@ + 'to be replaced', '$bar' => 'existing to be replaced'])] +#[Autoconfigure(properties: ['$foo' => 'bar', '$bar' => 'baz'])] +class AutoconfigureRepeatedProperties +{ +} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedTag.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedTag.php new file mode 100644 index 0000000000000..671bc6074541a --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/AutoconfigureRepeatedTag.php @@ -0,0 +1,11 @@ + 2])] +#[AutoconfigureTag('bar')] +class AutoconfigureRepeatedTag +{ +} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml index 3dd00ab6f8fe8..9b1213fbcab8e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml @@ -15,4 +15,6 @@ services: decorated: class: Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator public: true + tags: + - container.decorator: { id: decorated } arguments: [!service { class: stdClass }] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.expected.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.expected.yml index d9537a05e4c34..a4e4eb995c4be 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.expected.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/child.expected.yml @@ -7,6 +7,8 @@ services: foo: class: Class2 public: true + tags: + - container.decorator: { id: bar } file: file.php lazy: true arguments: [!service { class: Class1 }] diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 309472c4321b0..7c3b108f51dc2 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -287,4 +287,11 @@ function (ExpressionLanguage $el) { ], ]; } + + public function testParseAlreadyParsedExpressionReturnsSameObject() + { + $el = new ExpressionLanguage(); + $parsed = $el->parse('1 + 1', []); + $this->assertSame($parsed, $el->parse($parsed, [])); + } } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/Node/BinaryNodeTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/Node/BinaryNodeTest.php index a44a6854ca918..518b3971bfa50 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/Node/BinaryNodeTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/Node/BinaryNodeTest.php @@ -207,4 +207,24 @@ public function testCompileMatchesWithInvalidRegexpAsExpression() $node->compile($compiler); eval('$regexp = "this is not a regexp"; '.$compiler->getSource().';'); } + + public function testDivisionByZero() + { + $node = new BinaryNode('/', new ConstantNode(1), new ConstantNode(0)); + + $this->expectException(\DivisionByZeroError::class); + $this->expectExceptionMessage('Division by zero.'); + + $node->evaluate([], []); + } + + public function testModuloByZero() + { + $node = new BinaryNode('%', new ConstantNode(1), new ConstantNode(0)); + + $this->expectException(\DivisionByZeroError::class); + $this->expectExceptionMessage('Modulo by zero.'); + + $node->evaluate([], []); + } } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/Node/NodeTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/Node/NodeTest.php index 158973cec3aa5..44f8bd7be5581 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/Node/NodeTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/Node/NodeTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\ExpressionLanguage\Tests\Node; use PHPUnit\Framework\TestCase; +use Symfony\Component\ExpressionLanguage\Compiler; use Symfony\Component\ExpressionLanguage\Node\ConstantNode; use Symfony\Component\ExpressionLanguage\Node\Node; @@ -38,4 +39,33 @@ public function testSerialization() $this->assertEquals($node, $unserializedNode); } + + public function testCompileActuallyCompilesAllNodes() + { + $nodes = []; + foreach (range(1, 10) as $ignored) { + $node = $this->createMock(Node::class); + $node->expects($this->once())->method('compile'); + + $nodes[] = $node; + } + + $node = new Node($nodes); + $node->compile($this->createMock(Compiler::class)); + } + + public function testEvaluateActuallyEvaluatesAllNodes() + { + $nodes = []; + foreach (range(1, 3) as $i) { + $node = $this->createMock(Node::class); + $node->expects($this->once())->method('evaluate') + ->willReturn($i); + + $nodes[] = $node; + } + + $node = new Node($nodes); + $this->assertSame([1, 2, 3], $node->evaluate([], [])); + } } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php index 7c02289c0d950..d7b5604b9745d 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php @@ -37,6 +37,17 @@ public function testParseWithZeroInNames() $parser->parse($lexer->tokenize('foo'), [0]); } + public function testParsePrimaryExpressionWithUnknownFunctionThrows() + { + $parser = new Parser([]); + $stream = (new Lexer())->tokenize('foo()'); + + $this->expectException(SyntaxError::class); + $this->expectExceptionMessage('The function "foo" does not exist around position 1 for expression `foo()`.'); + + $parser->parse($stream); + } + /** * @dataProvider getParseData */ diff --git a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php index 886dae588530b..ac5d720efd586 100644 --- a/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php +++ b/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php @@ -70,8 +70,9 @@ public function current() $subPathname .= $this->directorySeparator; } $subPathname .= $this->getFilename(); + $basePath = $this->rootPath; - if ('/' !== $basePath = $this->rootPath) { + if ('/' !== $basePath && !str_ends_with($basePath, $this->directorySeparator) && !str_ends_with($basePath, '/')) { $basePath .= $this->directorySeparator; } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 49144505f7883..c63dd6e734c35 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -24,26 +24,38 @@ protected function setUp(): void /** * @group network + * @group integration */ public function testRewindOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + if (!getenv('INTEGRATION_FTP_URL')) { + self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.'); + } + + $i = new RecursiveDirectoryIterator(getenv('INTEGRATION_FTP_URL').\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS); $i->rewind(); - $this->assertTrue(true); + $this->expectNotToPerformAssertions(); } /** * @group network + * @group integration */ public function testSeekOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + if (!getenv('INTEGRATION_FTP_URL')) { + self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.'); + } + + $ftpUrl = getenv('INTEGRATION_FTP_URL'); + + $i = new RecursiveDirectoryIterator($ftpUrl.\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS); $contains = [ - 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'pub', - 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'readme.txt', + $ftpUrl.\DIRECTORY_SEPARATOR.'pub', + $ftpUrl.\DIRECTORY_SEPARATOR.'readme.txt', ]; $actual = []; @@ -55,4 +67,31 @@ public function testSeekOnFtp() $this->assertEquals($contains, $actual); } + + public function testTrailingDirectorySeparatorIsStripped() + { + $fixturesDirectory = __DIR__ . '/../Fixtures/'; + $actual = []; + + foreach (new RecursiveDirectoryIterator($fixturesDirectory, RecursiveDirectoryIterator::SKIP_DOTS) as $file) { + $actual[] = $file->getPathname(); + } + + sort($actual); + + $expected = [ + $fixturesDirectory.'.dot', + $fixturesDirectory.'A', + $fixturesDirectory.'copy', + $fixturesDirectory.'dolor.txt', + $fixturesDirectory.'gitignore', + $fixturesDirectory.'ipsum.txt', + $fixturesDirectory.'lorem.txt', + $fixturesDirectory.'one', + $fixturesDirectory.'r+e.gex[c]a(r)s', + $fixturesDirectory.'with space', + ]; + + $this->assertEquals($expected, $actual); + } } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index f06fd80a118a9..d407e88586eb5 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -143,7 +143,8 @@ public function reverseTransform($value) $value = str_replace(',', $decSep, $value); } - if (str_contains($value, $decSep)) { + //If the value is in exponential notation with a negative exponent, we end up with a float value too + if (str_contains($value, $decSep) || false !== stripos($value, 'e-')) { $type = \NumberFormatter::TYPE_DOUBLE; } else { $type = \PHP_INT_SIZE === 8 diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index 5249e3b3644b4..8dd5acb6166ce 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -62,7 +62,7 @@ public function reverseTransform($array) $emptyKeys = []; foreach ($this->keys as $key) { - if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && [] !== $array[$key]) { + if (isset($array[$key]) && false !== $array[$key] && [] !== $array[$key]) { if ($array[$key] !== $result) { throw new TransformationFailedException('All values in the array should be the same.'); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index 9c2e3bcae3d13..f5246e2222319 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -632,4 +632,33 @@ public function testReverseTransformSmallInt() $this->assertSame(1.0, $transformer->reverseTransform('1')); } + + /** + * @dataProvider eNotationProvider + */ + public function testReverseTransformENotation($output, $input) + { + IntlTestHelper::requireFullIntl($this); + + \Locale::setDefault('en'); + + $transformer = new NumberToLocalizedStringTransformer(); + + $this->assertSame($output, $transformer->reverseTransform($input)); + } + + public static function eNotationProvider(): array + { + return [ + [0.001, '1E-3'], + [0.001, '1.0E-3'], + [0.001, '1e-3'], + [0.001, '1.0e-03'], + [1000.0, '1E3'], + [1000.0, '1.0E3'], + [1000.0, '1e3'], + [1000.0, '1.0e3'], + [1232.0, '1.232e3'], + ]; + } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php index fdfd983576413..462472da98bd9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php @@ -70,7 +70,7 @@ public function testReverseTransformCompletelyEmpty() 'c' => '', ]; - $this->assertNull($this->transformer->reverseTransform($input)); + $this->assertSame('', $this->transformer->reverseTransform($input)); } public function testReverseTransformCompletelyNull() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php index b2a295b276f48..ca0de12233b0c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Form; use Symfony\Component\Form\Tests\Fixtures\NotMappedType; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; @@ -191,6 +192,36 @@ public function testSetOptionsPerChildAndOverwrite() $this->assertTrue($form['second']->isRequired()); } + /** + * @dataProvider emptyDataProvider + */ + public function testSubmitNullForTextTypeWithEmptyDataOptionSetToEmptyString($emptyData, $submittedData, $expected) + { + $form = $this->factory->create(static::TESTED_TYPE, null, [ + 'type' => TextType::class, + 'options' => [ + 'empty_data' => $emptyData, + ] + ]); + $form->submit($submittedData); + + $this->assertSame($expected, $form->getData()); + } + + public static function emptyDataProvider() + { + yield ['', null, '']; + yield ['', ['first' => null, 'second' => null], '']; + yield ['', ['first' => '', 'second' => null], '']; + yield ['', ['first' => null, 'second' => ''], '']; + yield ['', ['first' => '', 'second' => ''], '']; + yield [null, null, null]; + yield [null, ['first' => null, 'second' => null], null]; + yield [null, ['first' => '', 'second' => null], null]; + yield [null, ['first' => null, 'second' => ''], null]; + yield [null, ['first' => '', 'second' => ''], null]; + } + public function testSubmitUnequal() { $input = ['first' => 'foo', 'second' => 'bar']; diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 3a2fba025aeff..478f9c091dd17 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -67,7 +67,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface, * * @see HttpClientInterface::OPTIONS_DEFAULTS for available options */ - public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50) + public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 0) { if (!\extension_loaded('curl')) { throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.'); @@ -185,10 +185,10 @@ public function request(string $method, string $url, array $options = []): Respo $multi->reset(); } - foreach ($options['resolve'] as $host => $ip) { - $resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip"; - $multi->dnsCache->hostnames[$host] = $ip; - $multi->dnsCache->removals["-$host:$port"] = "-$host:$port"; + foreach ($options['resolve'] as $resolveHost => $ip) { + $resolve[] = null === $ip ? "-$resolveHost:$port" : "$resolveHost:$port:$ip"; + $multi->dnsCache->hostnames[$resolveHost] = $ip; + $multi->dnsCache->removals["-$resolveHost:$port"] = "-$resolveHost:$port"; } $curlopts[\CURLOPT_RESOLVE] = $resolve; diff --git a/src/Symfony/Component/HttpClient/HttpClientTrait.php b/src/Symfony/Component/HttpClient/HttpClientTrait.php index 3f44f36953efc..d436a4c04cda4 100644 --- a/src/Symfony/Component/HttpClient/HttpClientTrait.php +++ b/src/Symfony/Component/HttpClient/HttpClientTrait.php @@ -445,6 +445,8 @@ private static function jsonEncode($value, ?int $flags = null, int $maxDepth = 5 */ private static function resolveUrl(array $url, ?array $base, array $queryDefaults = []): array { + $givenUrl = $url; + if (null !== $base && '' === ($base['scheme'] ?? '').($base['authority'] ?? '')) { throw new InvalidArgumentException(sprintf('Invalid "base_uri" option: host or scheme is missing in "%s".', implode('', $base))); } @@ -498,6 +500,10 @@ private static function resolveUrl(array $url, ?array $base, array $queryDefault $url['query'] = null; } + if (null !== $url['scheme'] && null === $url['authority']) { + throw new InvalidArgumentException(\sprintf('Invalid URL: host is missing in "%s".', implode('', $givenUrl))); + } + return $url; } diff --git a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php index 3ff0c9ac17c9c..9ea976271b5ae 100644 --- a/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php @@ -22,17 +22,19 @@ class CurlHttpClientTest extends HttpClientTestCase { protected function getHttpClient(string $testCase): HttpClientInterface { - if (false !== strpos($testCase, 'Push')) { - if (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304) { - $this->markTestSkipped('PHP 7.3.0 to 7.3.3 don\'t support HTTP/2 PUSH'); - } - - if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > ($v = curl_version())['version_number'] || !(\CURL_VERSION_HTTP2 & $v['features'])) { - $this->markTestSkipped('curl <7.61 is used or it is not compiled with support for HTTP/2 PUSH'); - } + if (!str_contains($testCase, 'Push')) { + return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false]); } - return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false]); + if (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304) { + $this->markTestSkipped('PHP 7.3.0 to 7.3.3 don\'t support HTTP/2 PUSH'); + } + + if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > ($v = curl_version())['version_number'] || !(\CURL_VERSION_HTTP2 & $v['features'])) { + $this->markTestSkipped('curl <7.61 is used or it is not compiled with support for HTTP/2 PUSH'); + } + + return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false], 6, 50); } public function testBindToPort() @@ -126,4 +128,20 @@ public function testOverridingInternalAttributesUsingCurlOptions() ], ]); } + + public function testKeepAuthorizationHeaderOnRedirectToSameHostWithConfiguredHostToIpAddressMapping() + { + $httpClient = $this->getHttpClient(__FUNCTION__); + $response = $httpClient->request('POST', 'http://127.0.0.1:8057/301', [ + 'headers' => [ + 'Authorization' => 'Basic Zm9vOmJhcg==', + ], + 'resolve' => [ + 'symfony.com' => '10.10.10.10', + ], + ]); + + $this->assertSame(200, $response->getStatusCode()); + $this->assertSame('/302', $response->toArray()['REQUEST_URI'] ?? null); + } } diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php index 9a1c177a533cb..d1213f0dedff4 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\SkippedTestSuiteError; use Symfony\Component\HttpClient\Exception\ClientException; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; use Symfony\Component\HttpClient\Exception\TransportException; use Symfony\Component\HttpClient\Internal\ClientState; use Symfony\Component\HttpClient\Response\StreamWrapper; @@ -455,4 +456,14 @@ public function testNullBody() $this->expectNotToPerformAssertions(); } + + public function testMisspelledScheme() + { + $httpClient = $this->getHttpClient(__FUNCTION__); + + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid URL: host is missing in "http:/localhost:8057/".'); + + $httpClient->request('GET', 'http:/localhost:8057/'); + } } diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php index 2f42eb8c4a4d2..aa0337849425f 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php @@ -63,7 +63,6 @@ public function testResolveUrl(string $base, string $url, string $expected) public static function provideResolveUrl(): array { return [ - [self::RFC3986_BASE, 'http:h', 'http:h'], [self::RFC3986_BASE, 'g', 'http://a/b/c/g'], [self::RFC3986_BASE, './g', 'http://a/b/c/g'], [self::RFC3986_BASE, 'g/', 'http://a/b/c/g/'], @@ -117,7 +116,6 @@ public static function provideResolveUrl(): array ['http://u:p@a/b/c/d;p?q', '.', 'http://u:p@a/b/c/'], // path ending with slash or no slash at all ['http://a/b/c/d/', 'e', 'http://a/b/c/d/e'], - ['http:no-slash', 'e', 'http:e'], // falsey relative parts [self::RFC3986_BASE, '//0', 'http://0/'], [self::RFC3986_BASE, '0', 'http://a/b/c/0'], diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index b4a91bcea8695..30ed687c8ad1b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,11 +78,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.42'; - public const VERSION_ID = 50442; + public const VERSION = '5.4.43'; + public const VERSION_ID = 50443; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 42; + public const RELEASE_VERSION = 43; public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2024'; diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php index e8e00d97b3876..c54290821af89 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport; -use Doctrine\DBAL\Cache\ArrayResult; use Doctrine\DBAL\Cache\ArrayStatement; +use Doctrine\DBAL\Driver\Result as DriverResult; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Query\QueryBuilder; use Doctrine\DBAL\Result; @@ -95,10 +95,13 @@ public function countNotifyCalls() ->method('getNativeConnection') ->willReturn($wrappedConnection); + $driverResult = $this->createMock(DriverResult::class); + $driverResult->method('fetchAssociative') + ->willReturn(false); $driverConnection ->expects(self::any()) ->method('executeQuery') - ->willReturn(new Result(new ArrayResult([]), $driverConnection)); + ->willReturn(new Result($driverResult, $driverConnection)); } $connection = new PostgreSqlConnection(['table_name' => 'queue_table'], $driverConnection); diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php index d24576a9e9743..03b74599b27c6 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php @@ -299,6 +299,9 @@ public function testJsonError() } } + /** + * @group transient-on-windows + */ public function testGetNonBlocking() { $redis = new \Redis(); @@ -314,6 +317,9 @@ public function testGetNonBlocking() } } + /** + * @group transient-on-windows + */ public function testGetAfterReject() { $redis = new \Redis(); @@ -333,6 +339,9 @@ public function testGetAfterReject() } } + /** + * @group transient-on-windows + */ public function testItProperlyHandlesEmptyMessages() { $redisReceiver = new RedisReceiver($this->connection, new Serializer()); diff --git a/src/Symfony/Component/Mime/Tests/AddressTest.php b/src/Symfony/Component/Mime/Tests/AddressTest.php index fe10c73910bde..4c64010d9601e 100644 --- a/src/Symfony/Component/Mime/Tests/AddressTest.php +++ b/src/Symfony/Component/Mime/Tests/AddressTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Exception\InvalidArgumentException; +use Symfony\Component\Mime\Exception\RfcComplianceException; class AddressTest extends TestCase { @@ -33,7 +34,7 @@ public function testConstructor() public function testConstructorWithInvalidAddress() { - $this->expectException(\InvalidArgumentException::class); + $this->expectException(RfcComplianceException::class); new Address('fab pot@symfony.com'); } @@ -44,6 +45,14 @@ public function testCreate() $this->assertEquals($a, Address::create('fabien@symfony.com')); } + public function testCreateWithInvalidFormat() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Could not parse " + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Encoder; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Encoder\QpContentEncoder; + +class QpContentEncoderTest extends TestCase +{ + public function testReplaceLastChar() + { + $encoder = new QpContentEncoder(); + + $this->assertSame('message=09', $encoder->encodeString('message'.chr(0x09))); + $this->assertSame('message=20', $encoder->encodeString('message'.chr(0x20))); + } +} diff --git a/src/Symfony/Component/Mime/Tests/MessageTest.php b/src/Symfony/Component/Mime/Tests/MessageTest.php index 6d981e7eb1f6d..9f5fc1f713ac7 100644 --- a/src/Symfony/Component/Mime/Tests/MessageTest.php +++ b/src/Symfony/Component/Mime/Tests/MessageTest.php @@ -134,6 +134,16 @@ public function testGenerateMessageIdThrowsWhenHasFromButNoAddresses() $message->generateMessageId(); } + public function testGenerateMessageIdThrowsWhenNeitherFromNorSenderIsPresent() + { + $message = new Message(); + + $this->expectException(LogicException::class); + $this->expectExceptionMessage('An email must have a "From" or a "Sender" header.'); + + $message->generateMessageId(); + } + public function testToString() { $message = new Message(); diff --git a/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php b/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php index d86c5f84da131..22e38c5db235e 100644 --- a/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php +++ b/src/Symfony/Component/Mime/Tests/Part/Multipart/FormDataPartTest.php @@ -228,4 +228,12 @@ public function testBoundaryContentTypeHeader() $headers[0] ); } + + public function testConstructThrowsOnUnexpectedFieldType() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('A form field value can only be a string, an array, or an instance of TextPart ("stdClass" given).'); + + new FormDataPart(['foo' => new \stdClass()]); + } } diff --git a/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAddressContainsTest.php b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAddressContainsTest.php new file mode 100644 index 0000000000000..227a51f58a4b7 --- /dev/null +++ b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAddressContainsTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Test\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Header\Headers; +use Symfony\Component\Mime\Test\Constraint\EmailAddressContains; + +class EmailAddressContainsTest extends TestCase +{ + public function testToString() + { + $constraint = new EmailAddressContains('headerName', 'expectedValue'); + + $this->assertSame('contains address "headerName" with value "expectedValue"', $constraint->toString()); + } + + public function testFailureDescription() + { + $mailboxHeader = 'text@example.com'; + $headers = new Headers(); + $headers->addMailboxHeader($mailboxHeader, 'actualValue@example.com'); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Failed asserting that the Email contains address "text@example.com" with value "expectedValue@example.com" (value is actualValue@example.com).'); + + (new EmailAddressContains($mailboxHeader, 'expectedValue@example.com'))->evaluate(new Email($headers)); + } +} diff --git a/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAttachmentCountTest.php b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAttachmentCountTest.php new file mode 100644 index 0000000000000..60976675ab3d5 --- /dev/null +++ b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailAttachmentCountTest.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Test\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Test\Constraint\EmailAttachmentCount; + +class EmailAttachmentCountTest extends TestCase +{ + public function testToString() + { + $constraint = new EmailAttachmentCount(1); + + $this->assertSame('has sent "1" attachment(s)', $constraint->toString()); + } + + public function testFailureDescription() + { + $email = new Email(); + $email->attach('attachment content', 'attachment.txt'); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Failed asserting that the Email has sent "2" attachment(s).'); + + (new EmailAttachmentCount(2))->evaluate($email); + } +} diff --git a/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHasHeaderTest.php b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHasHeaderTest.php new file mode 100644 index 0000000000000..ae5f75fddfb55 --- /dev/null +++ b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHasHeaderTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Test\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Header\Headers; +use Symfony\Component\Mime\Test\Constraint\EmailHasHeader; + +class EmailHasHeaderTest extends TestCase +{ + public function testToString() + { + $constraint = new EmailHasHeader('headerName'); + + $this->assertSame('has header "headerName"', $constraint->toString()); + } + + public function testFailureDescription() + { + $headers = new Headers(); + $headers->addMailboxHeader('headerName', 'test@example.com'); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Failed asserting that the Email has header "not existing header".'); + + (new EmailHasHeader('not existing header'))->evaluate(new Email($headers)); + } +} diff --git a/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHtmlBodyContainsTest.php b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHtmlBodyContainsTest.php new file mode 100644 index 0000000000000..ae994b0959796 --- /dev/null +++ b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailHtmlBodyContainsTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Test\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Test\Constraint\EmailHtmlBodyContains; + +class EmailHtmlBodyContainsTest extends TestCase +{ + public function testToString() + { + $constraint = new EmailHtmlBodyContains('expectedValue'); + + $this->assertSame('contains "expectedValue"', $constraint->toString()); + } + + public function testFailureDescription() + { + $expectedValue = 'expectedValue'; + $email = new Email(); + $email->html('actualValue')->text($expectedValue); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Failed asserting that the Email HTML body contains "expectedValue".'); + + (new EmailHtmlBodyContains($expectedValue))->evaluate($email); + } +} diff --git a/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailTextBodyContainsTest.php b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailTextBodyContainsTest.php new file mode 100644 index 0000000000000..43ba0170ef52c --- /dev/null +++ b/src/Symfony/Component/Mime/Tests/Test/Constraint/EmailTextBodyContainsTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mime\Tests\Test\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Test\Constraint\EmailTextBodyContains; + +class EmailTextBodyContainsTest extends TestCase +{ + public function testToString() + { + $constraint = new EmailTextBodyContains('expectedValue'); + + $this->assertSame('contains "expectedValue"', $constraint->toString()); + } + + public function testFailureDescription() + { + $expectedValue = 'expectedValue'; + $email = new Email(); + $email->html($expectedValue)->text('actualValue'); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Failed asserting that the Email text body contains "expectedValue".'); + + (new EmailTextBodyContains($expectedValue))->evaluate($email); + } +} diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 359aaa701918f..992e260a130a9 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -150,7 +150,7 @@ public function getValue($objectOrArray, $propertyPath) self::VALUE => $objectOrArray, ]; - if (\is_object($objectOrArray) && false === strpbrk((string) $propertyPath, '.[')) { + if (\is_object($objectOrArray) && (false === strpbrk((string) $propertyPath, '.[') || $objectOrArray instanceof \stdClass && property_exists($objectOrArray, $propertyPath))) { return $this->readProperty($zval, $propertyPath, $this->ignoreInvalidProperty)[self::VALUE]; } @@ -166,7 +166,7 @@ public function getValue($objectOrArray, $propertyPath) */ public function setValue(&$objectOrArray, $propertyPath, $value) { - if (\is_object($objectOrArray) && false === strpbrk((string) $propertyPath, '.[')) { + if (\is_object($objectOrArray) && (false === strpbrk((string) $propertyPath, '.[') || $objectOrArray instanceof \stdClass && property_exists($objectOrArray, $propertyPath))) { $zval = [ self::VALUE => $objectOrArray, ]; @@ -293,7 +293,13 @@ public function isReadable($objectOrArray, $propertyPath) $zval = [ self::VALUE => $objectOrArray, ]; - $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices); + + // handle stdClass with properties with a dot in the name + if ($objectOrArray instanceof \stdClass && str_contains($propertyPath, '.') && property_exists($objectOrArray, $propertyPath)) { + $this->readProperty($zval, $propertyPath, $this->ignoreInvalidProperty); + } else { + $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices); + } return true; } catch (AccessException $e) { @@ -314,6 +320,14 @@ public function isWritable($objectOrArray, $propertyPath) $zval = [ self::VALUE => $objectOrArray, ]; + + // handle stdClass with properties with a dot in the name + if ($objectOrArray instanceof \stdClass && str_contains($propertyPath, '.') && property_exists($objectOrArray, $propertyPath)) { + $this->readProperty($zval, $propertyPath, $this->ignoreInvalidProperty); + + return true; + } + $propertyValues = $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength() - 1); for ($i = \count($propertyValues) - 1; 0 <= $i; --$i) { diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 5f1b51e5399fd..f6d5a4bcafa53 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -674,6 +674,7 @@ public static function getValidPropertyPaths() [['firstName' => 'Bernhard'], '[firstName]', 'Bernhard'], [['index' => ['firstName' => 'Bernhard']], '[index][firstName]', 'Bernhard'], [(object) ['firstName' => 'Bernhard'], 'firstName', 'Bernhard'], + [(object) ['first.Name' => 'Bernhard'], 'first.Name', 'Bernhard'], [(object) ['property' => ['firstName' => 'Bernhard']], 'property[firstName]', 'Bernhard'], [['index' => (object) ['firstName' => 'Bernhard']], '[index].firstName', 'Bernhard'], [(object) ['property' => (object) ['firstName' => 'Bernhard']], 'property.firstName', 'Bernhard'], diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index a1d70c0fb8494..e75eac11cfd04 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -87,7 +87,7 @@ protected function findClass(string $file) $tokens = token_get_all(file_get_contents($file)); if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the " true, \T_STRING => true]; diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index 9cc384304cb35..888bb07c5ab91 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -45,7 +45,7 @@ public function testLoadTraitWithClassConstant() public function testLoadFileWithoutStartTag() { $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('Did you forgot to add the "expectExceptionMessage('Did you forget to add the "loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php'); } diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.it.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.it.xlf index ef250923e411c..72eace25e814a 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.it.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.it.xlf @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Troppi tentativi di accesso falliti, riprova tra %minutes% minuti. + Troppi tentativi di login falliti, riprova tra %minutes% minuti. diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.nl.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.nl.xlf index 4549d9f1c34f3..49b7aa78dbf0b 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.nl.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.nl.xlf @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Te veel mislukte inlogpogingen, probeer het over %minutes% minuten opnieuw. + Te veel onjuiste inlogpogingen, probeer het opnieuw over %minutes% minuten. diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Cyrl.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Cyrl.xlf index c4e58def93226..2192fe6e00b0c 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Cyrl.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Cyrl.xlf @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минут.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута. + Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минут.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута. diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Latn.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Latn.xlf index ad0774f9a0bb2..6a925c5b0fbaf 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Latn.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.sr_Latn.xlf @@ -76,7 +76,7 @@ Too many failed login attempts, please try again in %minutes% minutes. - Previše neuspešnih pokušaja prijavljivanja, pokušajte ponovo za %minutes% minut.|Previše neuspešnih pokušaja prijavljivanja, pokušajte ponovo za %minutes% minuta.|Previše neuspešnih pokušaja prijavljivanja, pokušajte ponovo za %minutes% minuta. + Previše neuspešnih pokušaja prijavljivanja, pokušajte ponovo za %minutes% minut.|Previše neuspešnih pokušaja prijavljivanja, pokušajte ponovo za %minutes% minuta. diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index a48ca7e38482e..06f2c3907b2f6 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -95,7 +95,7 @@ public function authenticate(RequestEvent $event) } $request = $event->getRequest(); - $session = !$request->attributes->getBoolean('_stateless') && $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null; + $session = $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null; $request->attributes->set('_security_firewall_run', $this->sessionKey); diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php index 9b1bbfb281672..ae6fb7a2a7df5 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php @@ -158,7 +158,7 @@ public function testEncodeCustomSettings() $this->encoder = new CsvEncoder([ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', ]); @@ -184,7 +184,7 @@ public function testEncodeCustomSettingsPassedInContext() , $this->encoder->encode($value, 'csv', [ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', ])); } @@ -194,7 +194,7 @@ public function testEncodeCustomSettingsPassedInConstructor() $encoder = new CsvEncoder([ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', ]); $value = ['a' => 'he\'llo', 'c' => ['d' => 'foo']]; @@ -583,7 +583,7 @@ public function testDecodeCustomSettings() $this->encoder = new CsvEncoder([ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', ]); @@ -605,7 +605,7 @@ public function testDecodeCustomSettingsPassedInContext() , 'csv', [ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', ])); } @@ -615,7 +615,7 @@ public function testDecodeCustomSettingsPassedInConstructor() $encoder = new CsvEncoder([ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::ESCAPE_CHAR_KEY => \PHP_VERSION_ID < 70400 ? '|' : '', CsvEncoder::KEY_SEPARATOR_KEY => '-', CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 ]); diff --git a/src/Symfony/Component/String/Inflector/EnglishInflector.php b/src/Symfony/Component/String/Inflector/EnglishInflector.php index 77ebc134a436f..9557e3507f258 100644 --- a/src/Symfony/Component/String/Inflector/EnglishInflector.php +++ b/src/Symfony/Component/String/Inflector/EnglishInflector.php @@ -121,6 +121,9 @@ final class EnglishInflector implements InflectorInterface // statuses (status) ['sesutats', 8, true, true, 'status'], + // article (articles), ancle (ancles) + ['sel', 3, true, true, 'le'], + // analyses (analysis), ellipses (ellipsis), fungi (fungus), // neuroses (neurosis), theses (thesis), emphases (emphasis), // oases (oasis), crises (crisis), houses (house), bases (base), diff --git a/src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php b/src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php index fb5d04300305a..47bb5aedb25b7 100644 --- a/src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php +++ b/src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php @@ -28,10 +28,12 @@ public static function singularizeProvider() ['alumnae', 'alumna'], ['alumni', 'alumnus'], ['analyses', ['analys', 'analyse', 'analysis']], + ['ankles', 'ankle'], ['antennae', 'antenna'], ['antennas', 'antenna'], ['appendices', ['appendex', 'appendix', 'appendice']], ['arches', ['arch', 'arche']], + ['articles', 'article'], ['atlases', ['atlas', 'atlase', 'atlasis']], ['axes', ['ax', 'axe', 'axis']], ['babies', 'baby'], @@ -189,9 +191,11 @@ public static function pluralizeProvider() ['album', 'albums'], ['alumnus', 'alumni'], ['analysis', 'analyses'], + ['ankle', 'ankles'], ['antenna', 'antennas'], // antennae ['appendix', ['appendicies', 'appendixes']], ['arch', 'arches'], + ['article', 'articles'], ['atlas', 'atlases'], ['axe', 'axes'], ['axis', 'axes'], diff --git a/src/Symfony/Component/Uid/Tests/UuidTest.php b/src/Symfony/Component/Uid/Tests/UuidTest.php index 1affd73af47f2..00a970dd65cc5 100644 --- a/src/Symfony/Component/Uid/Tests/UuidTest.php +++ b/src/Symfony/Component/Uid/Tests/UuidTest.php @@ -90,6 +90,15 @@ public function testV1() $this->assertSame('3499710062d0', $uuid->getNode()); } + public function testV1IsLowerCase() + { + $uuid = new UuidV1(); + $this->assertSame(strtolower((string) $uuid), (string) $uuid); + + $uuid = new UuidV1('D9E7A184-5D5B-11EA-A62A-3499710062D0'); + $this->assertSame(strtolower((string) $uuid), (string) $uuid); + } + public function testV3() { $uuid = Uuid::v3(new UuidV4(self::A_UUID_V4), 'the name'); diff --git a/src/Symfony/Component/Uid/UuidV1.php b/src/Symfony/Component/Uid/UuidV1.php index 9e92ff0661ba3..6132fd1f239ce 100644 --- a/src/Symfony/Component/Uid/UuidV1.php +++ b/src/Symfony/Component/Uid/UuidV1.php @@ -25,7 +25,7 @@ class UuidV1 extends Uuid public function __construct(?string $uuid = null) { if (null === $uuid) { - $this->uid = uuid_create(static::TYPE); + $this->uid = strtolower(uuid_create(static::TYPE)); } else { parent::__construct($uuid, true); } diff --git a/src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php b/src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php index 692b1176b6e58..b3067e5bef632 100644 --- a/src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php @@ -42,9 +42,11 @@ public function validate($value, Constraint $constraint) continue; } + $context = $this->context; $executionContext = clone $this->context; $executionContext->setNode($value, $this->context->getObject(), $this->context->getMetadata(), $this->context->getPropertyPath()); $violations = $validator->inContext($executionContext)->validate($value, $item, $this->context->getGroup())->getViolations(); + $this->context = $context; if (\count($this->context->getViolations()) === \count($violations)) { return; diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index faef7ec5ba519..9425e9b4f5a99 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -29,65 +29,65 @@ class CardSchemeValidator extends ConstraintValidator protected $schemes = [ // American Express card numbers start with 34 or 37 and have 15 digits. CardScheme::AMEX => [ - '/^3[47][0-9]{13}$/', + '/^3[47][0-9]{13}$/D', ], // China UnionPay cards start with 62 and have between 16 and 19 digits. // Please note that these cards do not follow Luhn Algorithm as a checksum. CardScheme::CHINA_UNIONPAY => [ - '/^62[0-9]{14,17}$/', + '/^62[0-9]{14,17}$/D', ], // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. // There are Diners Club cards that begin with 5 and have 16 digits. // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard. CardScheme::DINERS => [ - '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', + '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/D', ], // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. // All have 16 digits. CardScheme::DISCOVER => [ - '/^6011[0-9]{12}$/', - '/^64[4-9][0-9]{13}$/', - '/^65[0-9]{14}$/', - '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', + '/^6011[0-9]{12}$/D', + '/^64[4-9][0-9]{13}$/D', + '/^65[0-9]{14}$/D', + '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/D', ], // InstaPayment cards begin with 637 through 639 and have 16 digits. CardScheme::INSTAPAYMENT => [ - '/^63[7-9][0-9]{13}$/', + '/^63[7-9][0-9]{13}$/D', ], // JCB cards beginning with 2131 or 1800 have 15 digits. // JCB cards beginning with 35 have 16 digits. CardScheme::JCB => [ - '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', + '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/D', ], // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits. CardScheme::LASER => [ - '/^(6304|670[69]|6771)[0-9]{12,15}$/', + '/^(6304|670[69]|6771)[0-9]{12,15}$/D', ], // Maestro international cards begin with 675900..675999 and have between 12 and 19 digits. // Maestro UK cards begin with either 500000..509999 or 560000..699999 and have between 12 and 19 digits. CardScheme::MAESTRO => [ - '/^(6759[0-9]{2})[0-9]{6,13}$/', - '/^(50[0-9]{4})[0-9]{6,13}$/', - '/^5[6-9][0-9]{10,17}$/', - '/^6[0-9]{11,18}$/', + '/^(6759[0-9]{2})[0-9]{6,13}$/D', + '/^(50[0-9]{4})[0-9]{6,13}$/D', + '/^5[6-9][0-9]{10,17}$/D', + '/^6[0-9]{11,18}$/D', ], // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. // October 2016 MasterCard numbers can also start with 222100 through 272099. CardScheme::MASTERCARD => [ - '/^5[1-5][0-9]{14}$/', - '/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/', + '/^5[1-5][0-9]{14}$/D', + '/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/D', ], // Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then between 12 and 15 digits CardScheme::MIR => [ - '/^220[0-4][0-9]{12,15}$/', + '/^220[0-4][0-9]{12,15}$/D', ], // All UATP card numbers start with a 1 and have a length of 15 digits. CardScheme::UATP => [ - '/^1[0-9]{14}$/', + '/^1[0-9]{14}$/D', ], // All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits. CardScheme::VISA => [ - '/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/', + '/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/D', ], ]; diff --git a/src/Symfony/Component/Validator/Constraints/CssColorValidator.php b/src/Symfony/Component/Validator/Constraints/CssColorValidator.php index b34ef9303fc49..be377d83f4cf9 100644 --- a/src/Symfony/Component/Validator/Constraints/CssColorValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CssColorValidator.php @@ -21,21 +21,21 @@ */ class CssColorValidator extends ConstraintValidator { - private const PATTERN_HEX_LONG = '/^#[0-9a-f]{6}$/i'; - private const PATTERN_HEX_LONG_WITH_ALPHA = '/^#[0-9a-f]{8}$/i'; - private const PATTERN_HEX_SHORT = '/^#[0-9a-f]{3}$/i'; - private const PATTERN_HEX_SHORT_WITH_ALPHA = '/^#[0-9a-f]{4}$/i'; + private const PATTERN_HEX_LONG = '/^#[0-9a-f]{6}$/iD'; + private const PATTERN_HEX_LONG_WITH_ALPHA = '/^#[0-9a-f]{8}$/iD'; + private const PATTERN_HEX_SHORT = '/^#[0-9a-f]{3}$/iD'; + private const PATTERN_HEX_SHORT_WITH_ALPHA = '/^#[0-9a-f]{4}$/iD'; // List comes from https://www.w3.org/wiki/CSS/Properties/color/keywords#Basic_Colors - private const PATTERN_BASIC_NAMED_COLORS = '/^(black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua)$/i'; + private const PATTERN_BASIC_NAMED_COLORS = '/^(black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua)$/iD'; // List comes from https://www.w3.org/wiki/CSS/Properties/color/keywords#Extended_colors - private const PATTERN_EXTENDED_NAMED_COLORS = '/^(aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)$/i'; + private const PATTERN_EXTENDED_NAMED_COLORS = '/^(aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)$/iD'; // List comes from https://drafts.csswg.org/css-color/#css-system-colors - private const PATTERN_SYSTEM_COLORS = '/^(Canvas|CanvasText|LinkText|VisitedText|ActiveText|ButtonFace|ButtonText|ButtonBorder|Field|FieldText|Highlight|HighlightText|SelectedItem|SelectedItemText|Mark|MarkText|GrayText)$/i'; - private const PATTERN_KEYWORDS = '/^(transparent|currentColor)$/i'; - private const PATTERN_RGB = '/^rgb\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d)\s*\)$/i'; - private const PATTERN_RGBA = '/^rgba\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i'; - private const PATTERN_HSL = '/^hsl\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%\s*\)$/i'; - private const PATTERN_HSLA = '/^hsla\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%,\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i'; + private const PATTERN_SYSTEM_COLORS = '/^(Canvas|CanvasText|LinkText|VisitedText|ActiveText|ButtonFace|ButtonText|ButtonBorder|Field|FieldText|Highlight|HighlightText|SelectedItem|SelectedItemText|Mark|MarkText|GrayText)$/iD'; + private const PATTERN_KEYWORDS = '/^(transparent|currentColor)$/iD'; + private const PATTERN_RGB = '/^rgb\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d)\s*\)$/iD'; + private const PATTERN_RGBA = '/^rgba\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|0?\.\d+|1(\.0)?)\s*\)$/iD'; + private const PATTERN_HSL = '/^hsl\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%\s*\)$/iD'; + private const PATTERN_HSLA = '/^hsla\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%,\s*(0|0?\.\d+|1(\.0)?)\s*\)$/iD'; private const COLOR_PATTERNS = [ CssColor::HEX_LONG => self::PATTERN_HEX_LONG, diff --git a/src/Symfony/Component/Validator/Constraints/DateValidator.php b/src/Symfony/Component/Validator/Constraints/DateValidator.php index 5a5f22e4c659d..4a1fb7dd705f6 100644 --- a/src/Symfony/Component/Validator/Constraints/DateValidator.php +++ b/src/Symfony/Component/Validator/Constraints/DateValidator.php @@ -21,7 +21,7 @@ */ class DateValidator extends ConstraintValidator { - public const PATTERN = '/^(?\d{4})-(?\d{2})-(?\d{2})$/'; + public const PATTERN = '/^(?\d{4})-(?\d{2})-(?\d{2})$/D'; /** * Checks whether a date is valid. diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 11fc7be2dd35f..a073ab31ce86d 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -25,8 +25,8 @@ */ class EmailValidator extends ConstraintValidator { - private const PATTERN_HTML5 = '/^[a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/'; - private const PATTERN_LOOSE = '/^.+\@\S+\.\S+$/'; + private const PATTERN_HTML5 = '/^[a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/D'; + private const PATTERN_LOOSE = '/^.+\@\S+\.\S+$/D'; private const EMAIL_PATTERNS = [ Email::VALIDATION_MODE_LOOSE => self::PATTERN_LOOSE, diff --git a/src/Symfony/Component/Validator/Constraints/IbanValidator.php b/src/Symfony/Component/Validator/Constraints/IbanValidator.php index 423e0099d94c5..5581fdb7cca61 100644 --- a/src/Symfony/Component/Validator/Constraints/IbanValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IbanValidator.php @@ -73,6 +73,7 @@ class IbanValidator extends ConstraintValidator 'EG' => 'EG\d{2}\d{4}\d{4}\d{17}', // Egypt 'ES' => 'ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}', // Spain 'FI' => 'FI\d{2}\d{3}\d{11}', // Finland + 'FK' => 'FK\d{2}[A-Z]{2}\d{12}', // Falkland Islands 'FO' => 'FO\d{2}\d{4}\d{9}\d{1}', // Faroe Islands 'FR' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France 'GA' => 'GA\d{2}\d{23}', // Gabon @@ -117,6 +118,7 @@ class IbanValidator extends ConstraintValidator 'MG' => 'MG\d{2}\d{23}', // Madagascar 'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia 'ML' => 'ML\d{2}[\dA-Z]{2}\d{22}', // Mali + 'MN' => 'MN\d{2}\d{4}\d{12}', // Mongolia 'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France 'MR' => 'MR\d{2}\d{5}\d{5}\d{11}\d{2}', // Mauritania 'MT' => 'MT\d{2}[A-Z]{4}\d{5}[\dA-Z]{18}', // Malta @@ -127,6 +129,7 @@ class IbanValidator extends ConstraintValidator 'NI' => 'NI\d{2}[A-Z]{4}\d{24}', // Nicaragua 'NL' => 'NL\d{2}[A-Z]{4}\d{10}', // Netherlands (The) 'NO' => 'NO\d{2}\d{4}\d{6}\d{1}', // Norway + 'OM' => 'OM\d{2}\d{3}[\dA-Z]{16}', // Oman 'PF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France 'PK' => 'PK\d{2}[A-Z]{4}[\dA-Z]{16}', // Pakistan 'PL' => 'PL\d{2}\d{8}\d{16}', // Poland @@ -160,6 +163,7 @@ class IbanValidator extends ConstraintValidator 'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands 'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France 'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Kosovo + 'YE' => 'YE\d{2}[A-Z]{4}\d{4}[\dA-Z]{18}', // Yemen 'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France ]; diff --git a/src/Symfony/Component/Validator/Constraints/TimeValidator.php b/src/Symfony/Component/Validator/Constraints/TimeValidator.php index 855f320a50871..0065fc93f87d5 100644 --- a/src/Symfony/Component/Validator/Constraints/TimeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/TimeValidator.php @@ -21,7 +21,7 @@ */ class TimeValidator extends ConstraintValidator { - public const PATTERN = '/^(\d{2}):(\d{2}):(\d{2})$/'; + public const PATTERN = '/^(\d{2}):(\d{2}):(\d{2})$/D'; /** * Checks whether a time is valid. diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index dff0a99aed940..eb286e7b1b422 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -40,10 +40,10 @@ class UrlValidator extends ConstraintValidator \] # an IPv6 address ) (:[0-9]+)? # a port (optional) - (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path + (?:/ (?:[\pL\pN\pS\pM\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) - $~ixu'; + $~ixuD'; /** * {@inheritdoc} diff --git a/src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php b/src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php index fa7ba520cfa02..6f2a9b049285b 100755 --- a/src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php +++ b/src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php @@ -168,7 +168,7 @@ public function getIbanFormats(): array $formats = []; foreach ($this->readIbanFormatsTable() as $item) { - if (!preg_match('/^([A-Z]{2})/', $item['Example'], $matches)) { + if (!preg_match('/^([A-Z]{2})/', $item['IBAN Fields'], $matches)) { continue; } diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf index e09d3fc06aa70..706f0ca49716b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.af.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf index 94a91d42a71bb..6c684d98df31b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ar.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf index 390e5f869c323..0b149024ca2dd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf index 3ebae4cb6bb2f..3db0ddc20f3d5 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf index dffefdb7d9056..e0792e209561f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf index f5e90aba54a7a..150025d03a6ac 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.bs.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf index 60f747f62f715..fb3c41dbc747b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf index 459d07fd727cc..e99d3236eff40 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf index 7f3357daf5398..667f4a6d453d0 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.cy.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf index d80251b2a7483..5d08a01df77b1 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.da.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 6a9919ddd36ad..301ee496e68e6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + Dieser Wert ist keine Wochenangabe im ISO 8601-Format. + + + This value is not a valid week. + Dieser Wert ist keine gültige Woche. + + + This value should not be before week "{{ min }}". + Dieser Wert darf nicht vor der Woche "{{ min }}" sein. + + + This value should not be after week "{{ max }}". + Dieser Wert darf nicht nach der Woche "{{ max }}" sein. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf index bb0ccb46e92ec..e58dd3d77e7fe 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.el.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index cf08ea281938f..faf549e483512 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index f9b3277229c8a..fa26c72100068 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf index 988bb0aa07203..774445dd02c62 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.et.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf index 362dfa9c0cd34..3e1a544c89053 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf index fb8b629b4d1a3..98486482b239a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf index 6b8902f014dc2..2dac5b5b8af24 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fi.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index f06189712e3a0..2fb4eeac18725 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + Cette valeur ne représente pas une semaine valide au format ISO 8601. + + + This value is not a valid week. + Cette valeur n'est pas une semaine valide. + + + This value should not be before week "{{ min }}". + Cette valeur ne doit pas être antérieure à la semaine "{{ min }}". + + + This value should not be after week "{{ max }}". + Cette valeur ne doit pas être postérieure à la semaine "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf index 7885473fb2e84..1a48093dca758 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.gl.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf index 6e5ab52297777..73ccca53f2acd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index 0ddbeb6f20c81..147f4313c8a5e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf index 0c8002ae1ecc4..185ebf02b57ee 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hu.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf index 29f916fff06d1..24423b0822e68 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hy.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf index 2814599a0fc64..3bffae84d63c7 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf index 1f409315e6dbf..1e77aba17aa79 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf index d94a414e31998..26cb6e5933f04 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf index 3c0a6f200e4f8..8b0b6a244dcff 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index dc28eeba77223..e30f8a6ae3e40 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -450,6 +450,22 @@ 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ų. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf index 9b2b9bd9f4485..fef1c3662df5f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lv.xlf @@ -48,7 +48,7 @@ This value is not a valid datetime. - Šī vērtība ir nederīgs datums un laiks + Šī vērtība ir nederīgs datums un laiks. This value is not a valid email address. @@ -444,11 +444,27 @@ 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. + Šī vērtība ir pārāk īsa. Tai būtu jābūt vismaz vienu vārdu garai.|Šī vērtība ir pārāk īsa. Tai būtu jābūt ne mazāk kā {{ min }} vārdus garai. 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. + Šī vērtība ir pārāk gara. Tai būtu jābūt vienam vārdam.|Šī vērtība ir pārāk gara. Tai būtu jābūt ne vairāk kā {{ max }} vārdus garai. + + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf index b891990799cd3..722c9a7893844 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.mk.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf index 987d73199ac09..0c9f8c84d0d3c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf index b7353e83a4c7d..89bb0906ec187 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.my.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf index 2abe0fb7f0805..d0a0e6509df15 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index 96e1d20d93d0f..fdea10f0e4a80 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -444,11 +444,27 @@ 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. + Deze waarde is te kort. Het moet ten minste één woord bevatten.|Deze waarde is te kort. Het moet ten minste {{ min }} woorden bevatten. 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. + Deze waarde is te lang. Het moet één woord zijn.|Deze waarde is te lang. Het mag maximaal {{ max }} woorden bevatten. + + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf index e825815ced1b6..8ff78c5a08132 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf index 2abe0fb7f0805..d0a0e6509df15 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 337a5949501ce..541a35d73a83a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + Podana wartość nie jest poprawnym oznaczeniem tygodnia w formacie ISO 8601. + + + This value is not a valid week. + Podana wartość nie jest poprawnym oznaczeniem tygodnia. + + + This value should not be before week "{{ min }}". + Podana wartość nie powinna być przed tygodniem "{{ min }}". + + + This value should not be after week "{{ max }}". + Podana wartość nie powinna być po tygodniu "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf index f771faa84f5de..bb3208cfa5190 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + 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 e600bb17ff7f6..c427f95d3e670 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf index 79cf6941acc57..7413619650d94 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index 70cb1144bf899..e8dd0311640ff 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf index 8785adcc18257..aeda9c94b6b4c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sk.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf index 4926c1b4f815e..1a8cb8d57bbaa 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf index 9942b5cf26bc6..debbe5feb9eb6 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf @@ -459,6 +459,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + 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 3aa3be49e8d45..2e601246e3e01 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Ова вредност није валидна IP адреса. + Ова вредност није валидна IP адреса. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Привремени директоријум није конфигурисан у php.ini, или конфигурисани директоријум не постоји. + Привремени директоријум није конфигурисан у php.ini, или конфигурисани директоријум не постоји. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Ова вредност није валидан Међународни број банкарског рачуна (IBAN). + Ова вредност није валидан Међународни број банковног рачуна (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Ова вредност није валидан Код за идентификацију бизниса (BIC). + Ова вредност није валидна Код за идентификацију бизниса (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Ова вредност није валидан UUID. + Ова вредност није валидан UUID. This value should be a multiple of {{ compared_value }}. @@ -440,15 +440,31 @@ 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. + Ова вредност је прекратка. Треба да садржи макар једну реч.|Ова вредност је прекратка. Треба да садржи макар {{ min }} речи. 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. + Ова вредност је предугачка. Треба да садржи само једну реч.|Ова вредност је предугачка. Треба да садржи највише {{ max }} речи. + + + This value does not represent a valid week in the ISO 8601 format. + Ова вредност не представља валидну недељу у ISO 8601 формату. + + + This value is not a valid week. + Ова вредност није валидна недеља. + + + This value should not be before week "{{ min }}". + Ова вредност не би требала да буде пре недеље "{{ min }}". + + + This value should not be after week "{{ max }}". + Ова вредност не би требала да буде после недеље "{{ max }}". 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 ac7d7186dfee7..8e27e114c85fa 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf @@ -136,7 +136,7 @@ This value is not a valid IP address. - Ova vrednost nije validna IP adresa. + Ova vrednost nije validna IP adresa. This value is not a valid language. @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini, or the configured folder does not exist. - Privremeni direktorijum nije konfigurisan u php.ini, ili konfigurisani direktorijum ne postoji. + Privremeni direktorijum nije konfigurisan u php.ini, ili direktorijum koji je konfigurisan ne postoji. Cannot write temporary file to disk. @@ -224,7 +224,7 @@ This value is not a valid International Bank Account Number (IBAN). - Ova vrednost nije validan Međunarodni broj bankovnog računa (IBAN). + Ova vrednost nije validan Međunarodni broj bankovnog računa (IBAN). This value is not a valid ISBN-10. @@ -312,7 +312,7 @@ This value is not a valid Business Identifier Code (BIC). - Ova vrednost nije validan Kod za identifikaciju biznisa (BIC). + Ova vrednost nije validan Kod za identifikaciju biznisa (BIC). Error @@ -320,7 +320,7 @@ This value is not a valid UUID. - Ova vrednost nije validan UUID. + Ova vrednost nije validan UUID. This value should be a multiple of {{ compared_value }}. @@ -436,19 +436,35 @@ This value is not a valid MAC address. - Ova vrednost nije validna MAC adresa. + Ova vrednost nije validna MAC adresa. This URL is missing a top-level domain. - Ovom URL nedostaje domen najvišeg nivoa. + 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. + Ova vrednost je prekratka. Treba da sadrži makar jednu reč.|Ova vrednost je prekratka. Treba da sadrži makar {{ min }} reč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. + Ova vrednost je predugačka. Treba da sadrži samo jednu reč.|Ova vrednost je predugačka. Treba da sadrži najviše {{ max }} reči. + + + This value does not represent a valid week in the ISO 8601 format. + Ova vrednost ne predstavlja validnu nedelju u ISO 8601 formatu. + + + This value is not a valid week. + Ova vrednost nije validna nedelja + + + This value should not be before week "{{ min }}". + Ova vrednost ne bi trebala da bude pre nedelje "{{ min }}". + + + This value should not be after week "{{ max }}". + Ova vrednost ne bi trebala da bude posle nedelje "{{ max }}". diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf index 01668a87d21b3..ac08eff2a931e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf index c6f0b829a6af6..ded3a00868551 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf index 1d831bd8ea0f3..4ac6bb45699ff 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.tl.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf index 685e6ca1a928d..af59485b35d45 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.tr.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf index b67e3e604decc..4775d04f44957 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf index d18604407c71c..a1669de019a0a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ur.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf index d21bc24a3cc5b..d3012c64ef967 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.uz.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf index e1cdb6d09fb91..70a7eedcf24e5 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.vi.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + 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 15b234fb0d4ef..3c078d3f5816c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + 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 3812029fcad81..8c7caa5236713 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.zh_TW.xlf @@ -450,6 +450,22 @@ 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. + + This value does not represent a valid week in the ISO 8601 format. + This value does not represent a valid week in the ISO 8601 format. + + + This value is not a valid week. + This value is not a valid week. + + + This value should not be before week "{{ min }}". + This value should not be before week "{{ min }}". + + + This value should not be after week "{{ max }}". + This value should not be after week "{{ max }}". + diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfValidatorTest.php index 457894b58b418..38d95c5447a0d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfValidatorTest.php @@ -14,6 +14,7 @@ use Symfony\Component\Validator\Constraints\AtLeastOneOf; use Symfony\Component\Validator\Constraints\AtLeastOneOfValidator; use Symfony\Component\Validator\Constraints\Choice; +use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\Count; use Symfony\Component\Validator\Constraints\Country; use Symfony\Component\Validator\Constraints\DivisibleBy; @@ -27,9 +28,11 @@ use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\LessThan; use Symfony\Component\Validator\Constraints\Negative; +use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Regex; +use Symfony\Component\Validator\Constraints\Type; use Symfony\Component\Validator\Constraints\Unique; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\ConstraintViolation; @@ -296,6 +299,35 @@ public function trans(?string $id, array $parameters = [], ?string $domain = nul $this->assertCount(1, $violations); $this->assertSame('Dummy translation: [1] Dummy violation.', $violations->get(0)->getMessage()); } + + public function testValidateNestedAtLeaseOneOfConstraints() + { + $data = [ + 'foo' => [ + 'bar' => 'foo.bar', + 'baz' => 'foo.baz', + ], + ]; + + $constraints = new Collection([ + 'foo' => new AtLeastOneOf([ + new Collection([ + 'bar' => new AtLeastOneOf([ + new Type('int'), + new Choice(['test1', 'test2']) + ]), + ]), + new Collection([ + 'baz' => new Type('int'), + ]), + ]), + ]); + + $validator = Validation::createValidator(); + $violations = $validator->validate($data, $constraints); + + self::assertCount(1, $violations); + } } class ExpressionConstraintNested diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php index dcb40c9e7383b..9a6bc55981577 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -46,6 +46,36 @@ public function testValidNumbers($scheme, $number) $this->assertNoViolation(); } + /** + * @requires PHP 8 + * + * @dataProvider getValidNumbers + */ + public function testValidNumbersWithNewLine($scheme, $number) + { + $this->validator->validate($number."\n", new CardScheme(['schemes' => $scheme, 'message' => 'myMessage'])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$number."\n\"") + ->setCode(CardScheme::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + + /** + * @requires PHP < 8 + * + * @dataProvider getValidNumbers + */ + public function testValidNumbersWithNewLinePriorToPhp8($scheme, $number) + { + $this->validator->validate($number."\n", new CardScheme(['schemes' => $scheme, 'message' => 'myMessage'])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$number."\n\"") + ->setCode(CardScheme::NOT_NUMERIC_ERROR) + ->assertRaised(); + } + public function testValidNumberWithOrderedArguments() { $this->validator->validate( diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php index 6c298f8236791..ce121977c0924 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php @@ -52,6 +52,19 @@ public function testValidAnyColor($cssColor) $this->assertNoViolation(); } + /** + * @dataProvider getValidAnyColor + */ + public function testValidAnyColorWithNewLine($cssColor) + { + $this->validator->validate($cssColor."\n", new CssColor([], 'myMessage')); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$cssColor."\n\"") + ->setCode(CssColor::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + public static function getValidAnyColor(): array { return [ diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php index b2e9fdf5e2f82..23725d5e491e6 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php @@ -53,6 +53,19 @@ public function testValidDates($date) $this->assertNoViolation(); } + /** + * @dataProvider getValidDates + */ + public function testValidDatesWithNewLine(string $date) + { + $this->validator->validate($date."\n", new Date(['message' => 'myMessage'])); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$date."\n\"") + ->setCode(Date::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + public static function getValidDates() { return [ diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index fa829e77b6764..1cd661aab79b6 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -70,6 +70,19 @@ public function testValidEmails($email) $this->assertNoViolation(); } + /** + * @dataProvider getValidEmails + */ + public function testValidEmailsWithNewLine($email) + { + $this->validator->validate($email."\n", new Email()); + + $this->buildViolation('This value is not a valid email address.') + ->setParameter('{{ value }}', '"'.$email."\n\"") + ->setCode(Email::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + public static function getValidEmails() { return [ diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php index 566430079d6b1..becc24f516013 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php @@ -48,6 +48,19 @@ public function testValidIbans($iban) $this->assertNoViolation(); } + /** + * @dataProvider getValidIbans + */ + public function testValidIbansWithNewLine(string $iban) + { + $this->validator->validate($iban."\n", new Iban()); + + $this->buildViolation('This is not a valid International Bank Account Number (IBAN).') + ->setParameter('{{ value }}', '"'.$iban."\n\"") + ->setCode(Iban::INVALID_CHARACTERS_ERROR) + ->assertRaised(); + } + public static function getValidIbans() { return [ @@ -73,6 +86,7 @@ public static function getValidIbans() ['CZ65 0800 0000 1920 0014 5399'], // Czech Republic ['DK50 0040 0440 1162 43'], // Denmark ['EE38 2200 2210 2014 5685'], // Estonia + ['FK12 SC98 7654 3210 98'], // Falkland Islands ['FO97 5432 0388 8999 44'], // Faroe Islands ['FI21 1234 5600 0007 85'], // Finland ['FR14 2004 1010 0505 0001 3M02 606'], // France @@ -96,9 +110,11 @@ public static function getValidIbans() ['MU17 BOMM 0101 1010 3030 0200 000M UR'], // Mauritius ['MD24 AG00 0225 1000 1310 4168'], // Moldova ['MC93 2005 2222 1001 1223 3M44 555'], // Monaco + ['MN14 0005 0051 6384 7716'], // Mongolia ['ME25 5050 0001 2345 6789 51'], // Montenegro ['NL39 RABO 0300 0652 64'], // Netherlands ['NO93 8601 1117 947'], // Norway + ['OM04 0280 0000 1234 5678 901'], // Oman ['PK36 SCBL 0000 0011 2345 6702'], // Pakistan ['PL60 1020 1026 0000 0422 7020 1111'], // Poland ['PT50 0002 0123 1234 5678 9015 4'], // Portugal @@ -115,6 +131,7 @@ public static function getValidIbans() ['TR33 0006 1005 1978 6457 8413 26'], // Turkey ['AE07 0331 2345 6789 0123 456'], // UAE ['GB12 CPBK 0892 9965 0449 91'], // United Kingdom + ['YE09 CBKU 0000 0000 0000 1234 5601 01'], // Yemen ['DJ21 0001 0000 0001 5400 0100 186'], // Djibouti ['EG38 0019 0005 0000 0000 2631 8000 2'], // Egypt diff --git a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php index 80d21d5c28d35..56d8abc151590 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php @@ -53,6 +53,19 @@ public function testValidTimes($time) $this->assertNoViolation(); } + /** + * @dataProvider getValidTimes + */ + public function testValidTimesWithNewLine(string $time) + { + $this->validator->validate($time."\n", new Time()); + + $this->buildViolation('This value is not a valid time.') + ->setParameter('{{ value }}', '"'.$time."\n".'"') + ->setCode(Time::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + public static function getValidTimes() { return [ diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index e7bd83d07d708..900f92afcc4f9 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -60,6 +60,19 @@ public function testValidUrls($url) $this->assertNoViolation(); } + /** + * @dataProvider getValidUrls + */ + public function testValidUrlsWithNewLine($url) + { + $this->validator->validate($url."\n", new Url()); + + $this->buildViolation('This value is not a valid URL.') + ->setParameter('{{ value }}', '"'.$url."\n".'"') + ->setCode(Url::INVALID_URL_ERROR) + ->assertRaised(); + } + /** * @dataProvider getValidUrlsWithWhitespaces */ @@ -85,6 +98,24 @@ public function testValidRelativeUrl($url) $this->assertNoViolation(); } + /** + * @dataProvider getValidRelativeUrls + * @dataProvider getValidUrls + */ + public function testValidRelativeUrlWithNewLine(string $url) + { + $constraint = new Url([ + 'relativeProtocol' => true, + ]); + + $this->validator->validate($url."\n", $constraint); + + $this->buildViolation('This value is not a valid URL.') + ->setParameter('{{ value }}', '"'.$url."\n".'"') + ->setCode(Url::INVALID_URL_ERROR) + ->assertRaised(); + } + public static function getValidRelativeUrls() { return [ @@ -174,6 +205,8 @@ public static function getValidUrls() ['http://symfony.com/#one_more%20test'], ['http://example.com/exploit.html?hello[0]=test'], ['http://বিডিআইএ.বাংলা'], + ['http://www.example.com/คนแซ่ลี้/'], + ['http://www.example.com/か/'], ]; } diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 359171b3b1ca1..da1d5b2d6e34d 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 ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) { + if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) { return false; } diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php index a87fa55c8fa8f..938fb639b456e 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php @@ -592,11 +592,11 @@ public function testGenerator() function: "Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::baz" this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} %s: { - %sGeneratorDemo.php:14 { + %sGeneratorDemo.php:12 { Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() + › + › public function baz() › { - › yield from bar(); - › } } Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {} %A} @@ -617,7 +617,9 @@ function: "Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::baz" %s: { %s%eTests%eFixtures%eGeneratorDemo.php:%d { Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() -%A › yield 1; + › { + › yield 1; + › } %A } %s%eTests%eFixtures%eGeneratorDemo.php:20 { …} %s%eTests%eFixtures%eGeneratorDemo.php:14 { …} @@ -629,9 +631,9 @@ function: "Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo" %s: { %s%eTests%eFixtures%eGeneratorDemo.php:%d { Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() + › { › yield 1; › } - › } %A } closed: false diff --git a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php index 918f5f73d8757..ad49e220b845d 100644 --- a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php @@ -365,7 +365,7 @@ public function testThrowingCaster() #message: "Unexpected Exception thrown from a caster: Foobar" trace: { %sTwig.php:2 { - __TwigTemplate_VarDumperFixture_u75a09->doDisplay(array \$context, array \$blocks = []) + __TwigTemplate_VarDumperFixture_u75a09->doDisplay(array \$context, array \$blocks = []): array › foo bar › twig source › diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/Twig.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/Twig.php index bb6e578d5015c..e26a3925490ac 100644 --- a/src/Symfony/Component/VarDumper/Tests/Fixtures/Twig.php +++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/Twig.php @@ -28,23 +28,23 @@ public function __construct(?Twig\Environment $env = null, $path = null) $this->path = $path; } - protected function doDisplay(array $context, array $blocks = []) + protected function doDisplay(array $context, array $blocks = []): array { // line 2 throw new \Exception('Foobar'); } - public function getTemplateName() + public function getTemplateName(): string { return 'foo.twig'; } - public function getDebugInfo() + public function getDebugInfo(): array { return [33 => 1, 34 => 2]; } - public function getSourceContext() + public function getSourceContext(): Twig\Source { return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__); } diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 36cc404a9c445..94d3a5cd299b0 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -700,8 +700,13 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar): return (float) str_replace('_', '', $scalar); case Parser::preg_match(self::getTimestampRegex(), $scalar): - // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. - $time = new \DateTime($scalar, new \DateTimeZone('UTC')); + try { + // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. + $time = new \DateTime($scalar, new \DateTimeZone('UTC')); + } catch (\Exception $e) { + // Some dates accepted by the regex are not valid dates. + throw new ParseException(\sprintf('The date "%s" could not be parsed as it is an invalid date.', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename, $e); + } if (Yaml::PARSE_DATETIME & $flags) { return $time; diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index d6e02fad0d4a0..4e8d324a1f809 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -579,6 +579,14 @@ public function testParseNestedTimestampListAsDateTimeObject(string $yaml, int $ $this->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME)); } + public function testParseInvalidDate() + { + $this->expectException(ParseException::class); + $this->expectExceptionMessageMatches('/^The date "2024-50-50" could not be parsed as it is an invalid date.*/'); + + Inline::parse('2024-50-50', Yaml::PARSE_DATETIME); + } + /** * @dataProvider getDateTimeDumpTests */