diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f806bdc816901..931fba325e7f0 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -48,7 +48,7 @@ jobs: ports: - 16379:6379 redis-cluster: - image: grokzen/redis-cluster:5.0.4 + image: grokzen/redis-cluster:latest ports: - 7000:7000 - 7001:7001 diff --git a/.github/workflows/package-tests.yml b/.github/workflows/package-tests.yml index 859e1e6328380..f04bacd0170d3 100644 --- a/.github/workflows/package-tests.yml +++ b/.github/workflows/package-tests.yml @@ -21,7 +21,7 @@ jobs: - name: Find packages id: find-packages - run: echo "packages=$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -maxdepth 6 -type f -name composer.json -printf '%h\n' | jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))" >> $GITHUB_OUTPUT + run: echo "packages=$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))" >> $GITHUB_OUTPUT - name: Verify meta files are correct run: | diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 11da174a9476f..a138b2ea2d661 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -93,7 +93,7 @@ jobs: echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV cp composer.json composer.json.orig echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json - php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -maxdepth 6 -type f -name composer.json -printf '%h\n') + php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n') mv composer.json composer.json.phpunit mv composer.json.orig composer.json fi diff --git a/CHANGELOG-6.0.md b/CHANGELOG-6.0.md index d0024faa6a47d..07005e3077334 100644 --- a/CHANGELOG-6.0.md +++ b/CHANGELOG-6.0.md @@ -7,6 +7,72 @@ in 6.0 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.0.0...v6.0.1 +* 6.0.19 (2023-01-24) + + * bug #49078 [Security/Http] Check tokens before loading users from providers (nicolas-grekas) + * bug #49077 [DependencyInjection] Fix named arguments when using ContainerBuilder before compilation (nicolas-grekas) + * bug #49031 [Cache] fix collecting cache stats when nesting computations (nicolas-grekas) + * bug #49046 Fix for Windows when projects are deployed on junctions/symlinks (nerdgod) + * bug #49025 [Notifier] [OvhCloud] handle invalid receiver (seferov) + * bug #48993 [VarDumper] Fix JS to expand / collapse (nicolas-grekas) + * bug #48983 Fix BC user_identifier support after deprecation username (vtsykun) + * bug #48986 [Validator] Fix Email validator logic (fabpot) + * bug #48969 [PropertyInfo] Fixes constructor extractor for mixed type (michael.kubovic) + * bug #48978 [Serializer] use method_exists() instead of catching reflection exceptions (xabbuh) + * bug #48937 [SecurityBundle] Fix using same handler for multiple authenticators (RobertMe) + * bug #48971 [DependencyInjection] Fix dump order of inlined deps (nicolas-grekas) + * bug #48966 [HttpClient] Let curl handle content-length headers (nicolas-grekas) + * bug #48968 [VarExporter] Fix exporting enums (nicolas-grekas) + * bug #48926 [DependencyInjection] Fix support for named arguments on non-autowired services (nicolas-grekas) + * bug #48943 [FrameworkBundle] Fix deprecation when accessing a "container.private" service from the test container (nicolas-grekas) + * bug #48931 [DependencyInjection] Fix dumping inlined withers (nicolas-grekas) + * bug #48898 [HttpClient] Move Http clients data collecting at a late level (pforesi) + * bug #48896 [DoctrineBridge] Fix detecting mapping with one line annotations (franmomu) + * bug #48916 [FrameworkBundle] restore call to addGlobalIgnoredName (alexislefebvre) + * bug #48917 [Config] Fix XML dump when node example is an array (alexandre-daubois) + * bug #48904 [Validator] Allow egulias/email-validator v4 (chalasr) + * bug #48831 [Uid] Fix validating nil and max uuid (fancyweb) + +* 6.0.18 (2022-12-29) + + * bug #48823 [Cache] Fix possibly null value passed to preg_match() in RedisTrait (chalasr) + * bug #48816 [Cache] Fix for RedisAdapter without auth parameter (rikvdh) + +* 6.0.17 (2022-12-28) + + * bug #48787 [PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi) + * bug #48784 [Console] Correctly overwrite progressbars with different line count per step (ncharalampidis) + * bug #48801 [Form] Make `ButtonType` handle `form_attr` option (MatTheCat) + * bug #48791 [DependencyInjection] Fix deduplicating service instances in circular graphs (nicolas-grekas) + * bug #48771 [CssSelector] Fix escape patterns (fancyweb) + * bug #48711 [Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN (evgkord) + * bug #48724 [VarExporter] Fix exporting classes with __unserialize() but not __serialize() (fancyweb) + * bug #48746 [Validator] Fix IBAN format for Tunisia and Mauritania (smelesh) + * bug #48738 [Workflow] Allow spaces in place names so the PUML dump doesn't break (Kamil Musial) + * bug #48718 Compatibility with doctrine/annotations 2 (derrabus) + * bug #48651 [HttpKernel] AbstractSessionListener should not override the cache lifetime for private responses (rodmen) + * bug #48591 [DependencyInjection] Shared private services becomes public after a public service is accessed (alexpott) + * bug #48126 [Mailer] Include all transports' debug messages in RoundRobin transport exception (mixdf) + * bug #48635 [HttpFoundation] Use relative timestamps with MemcachedSessionHandler (tvlooy) + * bug #47979 [Cache] Fix dealing with ext-redis' multi/exec returning a bool (João Nogueira) + * bug #48612 [Messenger] [Amqp] Added missing rpc_timeout option (lyrixx) + * bug #48233 [Serializer] Prevent `GetSetMethodNormalizer` from creating invalid magic method call (klaussilveira) + * bug #48628 [HttpFoundation] Fix dumping array cookies (nicolas-grekas) + * bug #48048 [WebProfilerBundle] Fix dump header not being displayed (HypeMC) + * bug #47836 [HttpClient] TraceableHttpClient: increase decorator's priority (adpeyre) + * bug #48259 [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder (MatTheCat) + * bug #48314 [Mime] Fix MessagePart serialization (Amunak) + * bug #48331 [Yaml] fix dumping top-level tagged values (xabbuh) + * bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas) + * bug #48618 [ErrorHandler] [DebugClassLoader] Fix some new return types support (fancyweb) + * bug #48421 [HttpFoundation] IPv4-mapped IPv6 addresses incorrectly rejected (bonroyage) + * bug #48501 [RateLimiter] Add `int` to `Reservation::wait()` (DaRealFreak) + * bug #48359 [VarDumper] Ignore \Error in __debugInfo() (fancyweb) + * bug #48482 [DependencyInjection] Revert "bug #48027 Don't autoconfigure tag when it's already set with attributes" (nicolas-grekas) + * bug #48335 [TwigBridge] Amend `MoneyType` twig to include a space (mogilvie) + * bug #48046 [WebProfilerBundle] Remove redundant code from logger template (HypeMC) + * bug #48292 [Security] [LoginLink] Throw InvalidLoginLinkException on missing parameter (MatTheCat) + * 6.0.16 (2022-11-28) * bug #48333 [Yaml] parse unquoted digits in tag values as integers (xabbuh) diff --git a/CHANGELOG-6.1.md b/CHANGELOG-6.1.md index 10ba1bca4466b..6d8e5b86edd3d 100644 --- a/CHANGELOG-6.1.md +++ b/CHANGELOG-6.1.md @@ -7,6 +7,88 @@ in 6.1 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.1.0...v6.1.1 +* 6.1.12 (2023-02-01) + + * bug #49141 [HttpFoundation] Fix bad return type in IpUtils::checkIp4() (tristankretzer) + * bug #49126 [DependencyInjection] Fix order of arguments when mixing positional and named ones (nicolas-grekas) + * bug #49104 [HttpClient] Fix collecting data non-late for the profiler (nicolas-grekas) + * bug #49103 [Security/Http] Fix compat of persistent remember-me with legacy tokens (nicolas-grekas) + * security #cve-2022-24895 [Security/Http] Remove CSRF tokens from storage on successful login (nicolas-grekas) + * security #cve-2022-24894 [HttpKernel] Remove private headers before storing responses with HttpCache (nicolas-grekas) + +* 6.1.11 (2023-01-24) + + * bug #49078 [Security/Http] Check tokens before loading users from providers (nicolas-grekas) + * bug #49077 [DependencyInjection] Fix named arguments when using ContainerBuilder before compilation (nicolas-grekas) + * bug #49031 [Cache] fix collecting cache stats when nesting computations (nicolas-grekas) + * bug #49046 Fix for Windows when projects are deployed on junctions/symlinks (nerdgod) + * bug #49025 [Notifier] [OvhCloud] handle invalid receiver (seferov) + * bug #48993 [VarDumper] Fix JS to expand / collapse (nicolas-grekas) + * bug #48983 Fix BC user_identifier support after deprecation username (vtsykun) + * bug #48986 [Validator] Fix Email validator logic (fabpot) + * bug #48969 [PropertyInfo] Fixes constructor extractor for mixed type (michael.kubovic) + * bug #48978 [Serializer] use method_exists() instead of catching reflection exceptions (xabbuh) + * bug #48937 [SecurityBundle] Fix using same handler for multiple authenticators (RobertMe) + * bug #48971 [DependencyInjection] Fix dump order of inlined deps (nicolas-grekas) + * bug #48966 [HttpClient] Let curl handle content-length headers (nicolas-grekas) + * bug #48968 [VarExporter] Fix exporting enums (nicolas-grekas) + * bug #48933 [Validator] Fix bad handling of nulls when the 'fields' option of the Unique constraint is set (plfort) + * bug #48926 [DependencyInjection] Fix support for named arguments on non-autowired services (nicolas-grekas) + * bug #48943 [FrameworkBundle] Fix deprecation when accessing a "container.private" service from the test container (nicolas-grekas) + * bug #48931 [DependencyInjection] Fix dumping inlined withers (nicolas-grekas) + * bug #48898 [HttpClient] Move Http clients data collecting at a late level (pforesi) + * bug #48896 [DoctrineBridge] Fix detecting mapping with one line annotations (franmomu) + * bug #48916 [FrameworkBundle] restore call to addGlobalIgnoredName (alexislefebvre) + * bug #48917 [Config] Fix XML dump when node example is an array (alexandre-daubois) + * bug #48904 [Validator] Allow egulias/email-validator v4 (chalasr) + * bug #48831 [Uid] Fix validating nil and max uuid (fancyweb) + +* 6.1.10 (2022-12-29) + + * bug #48823 [Cache] Fix possibly null value passed to preg_match() in RedisTrait (chalasr) + * bug #48816 [Cache] Fix for RedisAdapter without auth parameter (rikvdh) + +* 6.1.9 (2022-12-28) + + * bug #48787 [PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold (ogizanagi) + * bug #48784 [Console] Correctly overwrite progressbars with different line count per step (ncharalampidis) + * bug #48801 [Form] Make `ButtonType` handle `form_attr` option (MatTheCat) + * bug #48791 [DependencyInjection] Fix deduplicating service instances in circular graphs (nicolas-grekas) + * bug #48771 [CssSelector] Fix escape patterns (fancyweb) + * bug #48711 [Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN (evgkord) + * bug #48724 [VarExporter] Fix exporting classes with __unserialize() but not __serialize() (fancyweb) + * bug #48746 [Validator] Fix IBAN format for Tunisia and Mauritania (smelesh) + * bug #48738 [Workflow] Allow spaces in place names so the PUML dump doesn't break (Kamil Musial) + * bug #48718 Compatibility with doctrine/annotations 2 (derrabus) + * bug #48681 [Console] Revert "bug #48089 Fix clear line with question in section (maxbeckers) (chalasr) + * bug #48651 [HttpKernel] AbstractSessionListener should not override the cache lifetime for private responses (rodmen) + * bug #48591 [DependencyInjection] Shared private services becomes public after a public service is accessed (alexpott) + * bug #48126 [Mailer] Include all transports' debug messages in RoundRobin transport exception (mixdf) + * bug #48089 [Console] Fix clear line with question in section (maxbeckers) + * bug #48602 [HtmlSanitizer] Fix HtmlSanitizer default configuration behavior for allowed schemes (Titouan Galopin) + * bug #48635 [HttpFoundation] Use relative timestamps with MemcachedSessionHandler (tvlooy) + * bug #47979 [Cache] Fix dealing with ext-redis' multi/exec returning a bool (João Nogueira) + * bug #48612 [Messenger] [Amqp] Added missing rpc_timeout option (lyrixx) + * bug #48233 [Serializer] Prevent `GetSetMethodNormalizer` from creating invalid magic method call (klaussilveira) + * bug #48628 [HttpFoundation] Fix dumping array cookies (nicolas-grekas) + * bug #48048 [WebProfilerBundle] Fix dump header not being displayed (HypeMC) + * bug #47836 [HttpClient] TraceableHttpClient: increase decorator's priority (adpeyre) + * bug #48259 [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder (MatTheCat) + * bug #48314 [Mime] Fix MessagePart serialization (Amunak) + * bug #48331 [Yaml] fix dumping top-level tagged values (xabbuh) + * bug #48615 Fix getting the name of closures on PHP 8.1.11+ (nicolas-grekas) + * bug #48624 [ErrorHandler][HttpKernel] Fix reading the SYMFONY_IDE env var (nicolas-grekas) + * bug #48618 [ErrorHandler] [DebugClassLoader] Fix some new return types support (fancyweb) + * bug #48421 [HttpFoundation] IPv4-mapped IPv6 addresses incorrectly rejected (bonroyage) + * bug #48501 [RateLimiter] Add `int` to `Reservation::wait()` (DaRealFreak) + * bug #48359 [VarDumper] Ignore \Error in __debugInfo() (fancyweb) + * bug #48534 [FrameworkBundle] add `kernel.locale_aware` tag to `LocaleSwitcher` (kbond) + * bug #48482 [DependencyInjection] Revert "bug #48027 Don't autoconfigure tag when it's already set with attributes" (nicolas-grekas) + * bug #48346 [HttpKernel] In DateTimeValueResolver, convert previously defined date attribute to the expected class (GromNaN) + * bug #48335 [TwigBridge] Amend `MoneyType` twig to include a space (mogilvie) + * bug #48046 [WebProfilerBundle] Remove redundant code from logger template (HypeMC) + * bug #48292 [Security] [LoginLink] Throw InvalidLoginLinkException on missing parameter (MatTheCat) + * 6.1.8 (2022-11-28) * bug #48333 [Yaml] parse unquoted digits in tag values as integers (xabbuh) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b136e74da6266..016a12f53a9c9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -33,17 +33,17 @@ The Symfony Connect username in parenthesis allows to get more information - Hamza Amrouche (simperfit) - Samuel ROZE (sroze) - Pascal Borreli (pborreli) - - Romain Neutron - Jules Pietri (heah) + - Romain Neutron - Joseph Bielawski (stloyd) - Drak (drak) - Abdellatif Ait boudad (aitboudad) - - Lukas Kahwe Smith (lsmith) - Jan Schädlich (jschaedl) - - Martin Hasoň (hason) + - Lukas Kahwe Smith (lsmith) - Jérôme Tamarelle (gromnan) - - Jeremy Mikola (jmikola) + - Martin Hasoň (hason) - Kevin Bond (kbond) + - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler @@ -57,11 +57,12 @@ The Symfony Connect username in parenthesis allows to get more information - Grégoire Paris (greg0ire) - Gabriel Ostrolucký (gadelat) - Jonathan Wage (jwage) - - David Maicher (dmaicher) + - Alexandre Daubois (alexandre-daubois) - Titouan Galopin (tgalopin) + - David Maicher (dmaicher) + - Alexander Schranz (alexander-schranz) - Alexandre Salomé (alexandresalome) - William DURAND - - Alexander Schranz (alexander-schranz) - ornicar - Dany Maillard (maidmaid) - Mathieu Santostefano (welcomattic) @@ -71,25 +72,25 @@ The Symfony Connect username in parenthesis allows to get more information - Alexander Mols (asm89) - Gábor Egyed (1ed) - Francis Besset (francisbesset) - - Alexandre Daubois (alexandre-daubois) - Vasilij Dusko | CREATION - Bulat Shakirzyanov (avalanche123) - Iltar van der Berg - Miha Vrhovnik (mvrhov) - Mathieu Piot (mpiot) - Saša Stamenković (umpirsky) + - Antoine Lamirault - Alex Pott - - Guilhem N (guilhemn) + - Mathieu Lechat (mat_the_cat) - Vincent Langlet (deviling) + - Guilhem N (guilhemn) - Vladimir Reznichenko (kalessil) - Sarah Khalil (saro0h) - - Konstantin Kudryashov (everzet) - Tomas Norkūnas (norkunas) + - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Eriksen Costa - Florin Patan (florinpatan) - Peter Rehm (rpet) - - Mathieu Lechat (mat_the_cat) - Henrik Bjørnskov (henrikbjorn) - David Buchmann (dbu) - Konstantin Myakshin (koc) @@ -98,15 +99,14 @@ The Symfony Connect username in parenthesis allows to get more information - Massimiliano Arione (garak) - Douglas Greenshields (shieldo) - Christian Raue + - Fran Moreno (franmomu) - Jáchym Toušek (enumag) - Mathias Arlaud (mtarld) - Graham Campbell (graham) - Michel Weimerskirch (mweimerskirch) - Eric Clemmons (ericclemmons) - Issei Murasawa (issei_m) - - Fran Moreno (franmomu) - Malte Schlüter (maltemaltesich) - - Antoine Lamirault - Vasilij Dusko - Denis (yethee) - Arnout Boks (aboks) @@ -136,10 +136,11 @@ The Symfony Connect username in parenthesis allows to get more information - Konstantin.Myakshin - Rokas Mikalkėnas (rokasm) - Arman Hosseini (arman) + - Saif Eddin Gmati (azjezz) - Arnaud Le Blanc (arnaud-lb) - Maxime STEINHAUSSER - Peter Kokot (maastermedia) - - Saif Eddin Gmati (azjezz) + - jeremyFreeAgent (jeremyfreeagent) - Ahmed TAILOULOUTE (ahmedtai) - Simon Berger - Tim Nagel (merk) @@ -158,7 +159,6 @@ The Symfony Connect username in parenthesis allows to get more information - lenar - Jesse Rushlow (geeshoe) - Théo FIDRY - - jeremyFreeAgent (jeremyfreeagent) - Jeroen Spee (jeroens) - Michael Babker (mbabker) - Włodzimierz Gajda (gajdaw) @@ -170,6 +170,7 @@ The Symfony Connect username in parenthesis allows to get more information - Olivier Dolbeau (odolbeau) - Florian Voutzinos (florianv) - zairig imad (zairigimad) + - Hugo Alliaume (kocal) - Colin Frei - Christopher Hertel (chertel) - Javier Spagnoletti (phansys) @@ -193,7 +194,6 @@ The Symfony Connect username in parenthesis allows to get more information - Baptiste Leduc (korbeil) - Marco Pivetta (ocramius) - Robert Schönthal (digitalkaoz) - - Hugo Alliaume (kocal) - Võ Xuân Tiến (tienvx) - fd6130 (fdtvui) - Tigran Azatyan (tigranazatyan) @@ -218,7 +218,9 @@ The Symfony Connect username in parenthesis allows to get more information - Juti Noppornpitak (shiroyuki) - Joe Bennett (kralos) - Nate Wiebe (natewiebe13) + - Farhad Safarov (safarov) - Anthony MARTIN + - Nicolas Philippe (nikophil) - Colin O'Dell (colinodell) - Sebastian Hörl (blogsh) - Ben Davies (bendavies) @@ -229,10 +231,11 @@ The Symfony Connect username in parenthesis allows to get more information - Albert Casademont (acasademont) - Arnaud Kleinpeter (nanocom) - Guilherme Blanco (guilhermeblanco) + - Sergey (upyx) - Michael Voříšek - - Farhad Safarov (safarov) - SpacePossum - Pablo Godel (pgodel) + - Hubert Lenoir (hubert_lenoir) - Denis Brumann (dbrumann) - Romaric Drigon (romaricdrigon) - Andréia Bohner (andreia) @@ -246,9 +249,8 @@ The Symfony Connect username in parenthesis allows to get more information - David Prévot - Vincent Touzet (vincenttouzet) - Fabien Bourigault (fbourigault) + - soyuka - Jérémy Derussé - - Nicolas Philippe (nikophil) - - Hubert Lenoir (hubert_lenoir) - Florent Mata (fmata) - mcfedr (mcfedr) - Maciej Malarz (malarzm) @@ -257,13 +259,13 @@ The Symfony Connect username in parenthesis allows to get more information - Sokolov Evgeniy (ewgraf) - Stadly - Justin Hileman (bobthecow) + - Tom Van Looy (tvlooy) - Niels Keurentjes (curry684) - Vyacheslav Pavlov - Richard Shank (iampersistent) + - Thomas Landauer (thomas-landauer) - Andre Rømcke (andrerom) - Dmitrii Poddubnyi (karser) - - soyuka - - Sergey (upyx) - Rouven Weßling (realityking) - BoShurik - Zmey @@ -275,7 +277,6 @@ The Symfony Connect username in parenthesis allows to get more information - Ben Hakim - Sylvain Fabre (sylfabre) - Filippo Tessarotto (slamdunk) - - Tom Van Looy (tvlooy) - 77web - Bohan Yang (brentybh) - Bastien Jaillot (bastnic) @@ -288,7 +289,6 @@ The Symfony Connect username in parenthesis allows to get more information - Jonathan Ingram - Artur Kotyrba - Tyson Andre - - Thomas Landauer (thomas-landauer) - GDIBass - Samuel NELA (snela) - dFayet @@ -298,6 +298,7 @@ The Symfony Connect username in parenthesis allows to get more information - Yoann RENARD (yrenard) - Thomas Lallement (raziel057) - Timothée Barray (tyx) + - Alexis Lefebvre - James Halsall (jaitsu) - Mikael Pajunen - Warnar Boekkooi (boekkooi) @@ -323,7 +324,9 @@ The Symfony Connect username in parenthesis allows to get more information - D (denderello) - Jonathan Scheiber (jmsche) - DQNEO + - Romain Monteil (ker0x) - Andrii Bodnar + - gnito-org - Artem (artemgenvald) - ivan - Sergey Belyshkin (sbelyshkin) @@ -351,6 +354,7 @@ The Symfony Connect username in parenthesis allows to get more information - Clara van Miert - Martin Auswöger - Alexander Menshchikov + - Marcin Sikoń (marphi) - Stepan Anchugov (kix) - bronze1man - sun (sun) @@ -376,7 +380,6 @@ The Symfony Connect username in parenthesis allows to get more information - Emanuele Panzeri (thepanz) - Matthew Smeets - François Zaninotto (fzaninotto) - - Alexis Lefebvre - Dustin Whittle (dustinwhittle) - jeff - John Kary (johnkary) @@ -387,7 +390,7 @@ The Symfony Connect username in parenthesis allows to get more information - Daniel STANCU - Markus Fasselt (digilist) - Maxime Veber (nek-) - - Marcin Sikoń (marphi) + - Oleksiy (alexndlm) - Sullivan SENECHAL (soullivaneuh) - Rui Marinho (ruimarinho) - Marc Weistroff (futurecat) @@ -409,7 +412,6 @@ The Symfony Connect username in parenthesis allows to get more information - Craig Duncan (duncan3dc) - Mantis Development - Pablo Lozano (arkadis) - - Romain Monteil (ker0x) - quentin neyrat (qneyrat) - Antonio Jose Cerezo (ajcerezo) - Marcin Szepczynski (czepol) @@ -480,6 +482,7 @@ The Symfony Connect username in parenthesis allows to get more information - Quynh Xuan Nguyen (seriquynh) - Ray - Philipp Cordes (corphi) + - Yannick Ihmels (ihmels) - Andrii Dembitskyi - Chekote - bhavin (bhavin4u) @@ -497,6 +500,7 @@ The Symfony Connect username in parenthesis allows to get more information - Thomas Schulz (king2500) - Benjamin Morel - Bernd Stellwag + - Philippe SEGATORI (tigitz) - Frank de Jonge - Chris Tanaskoski - julien57 @@ -508,6 +512,7 @@ The Symfony Connect username in parenthesis allows to get more information - Josip Kruslin (jkruslin) - Giorgio Premi - renanbr + - Maxim Dovydenok (shiftby) - Sébastien Lavoie (lavoiesl) - Alex Rock (pierstoval) - Wodor Wodorski @@ -559,11 +564,11 @@ The Symfony Connect username in parenthesis allows to get more information - Gabor Toth (tgabi333) - realmfoo - Thomas Tourlourat (armetiz) + - Gasan Guseynov (gassan) - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) - Jerzy Zawadzki (jzawadzki) - Ismael Ambrosi (iambrosi) - - Yannick Ihmels (ihmels) - Saif Eddin G - Emmanuel BORGES (eborges78) - siganushka (siganushka) @@ -616,13 +621,13 @@ The Symfony Connect username in parenthesis allows to get more information - Jérôme Tamarelle (jtamarelle-prismamedia) - Emil Masiakowski - Alexandre Parent + - Angelov Dejan (angelov) - DT Inier (gam6itko) - Matthew Lewinski (lewinski) - Magnus Nordlander (magnusnordlander) - Ricard Clau (ricardclau) - Dmitrii Tarasov (dtarasov) - Philipp Kolesnikov - - Maxim Dovydenok (shiftby) - Carlos Pereira De Amorim (epitre) - Rodrigo Aguilera - Roumen Damianoff @@ -668,6 +673,7 @@ The Symfony Connect username in parenthesis allows to get more information - mondrake (mondrake) - Yaroslav Kiliba - “Filip + - FORT Pierre-Louis (plfort) - Simon Watiau (simonwatiau) - Ruben Jacobs (rubenj) - Arkadius Stefanski (arkadius) @@ -679,7 +685,6 @@ The Symfony Connect username in parenthesis allows to get more information - Tomasz Kusy - Jakub Kucharovic (jkucharovic) - Kristen Gilden - - Oleksiy (alexndlm) - Robbert Klarenbeek (robbertkl) - Eric Masoero (eric-masoero) - Michael Lutz @@ -827,6 +832,7 @@ The Symfony Connect username in parenthesis allows to get more information - Steffen Roßkamp - Alexandru Furculita (afurculita) - Michel Salib (michelsalib) + - Quentin Dequippe (qdequippe) - Valentin Jonovs - geoffrey - Bastien DURAND (deamon) @@ -839,12 +845,12 @@ The Symfony Connect username in parenthesis allows to get more information - Tobias Bönner - Berny Cantos (xphere81) - Mátyás Somfai (smatyas) + - Simon Leblanc (leblanc_simon) - Jan Schumann - Matheo Daninos (mathdns) - Niklas Fiekas - Mark Challoner (markchalloner) - Markus Bachmann (baachi) - - Philippe SEGATORI (tigitz) - Roger Guasch (rogerguasch) - Luis Tacón (lutacon) - Alex Hofbauer (alexhofbauer) @@ -865,14 +871,15 @@ The Symfony Connect username in parenthesis allows to get more information - Restless-ET - Vlad Gregurco (vgregurco) - Boris Vujicic (boris.vujicic) + - Vladimir Tsykun (vtsykun) - Chris Sedlmayr (catchamonkey) - Kamil Kokot (pamil) - Seb Koelen - - FORT Pierre-Louis (plfort) - Christoph Mewes (xrstf) - Vitaliy Tverdokhlib (vitaliytv) - Ariel Ferrandini (aferrandini) - Niklas Keller + - BASAK Semih (itsemih) - Dirk Pahl (dirkaholic) - Cédric Lombardot (cedriclombardot) - Jonas Flodén (flojon) @@ -900,7 +907,9 @@ The Symfony Connect username in parenthesis allows to get more information - ReenExe - Fabian Lange (codingfabian) - Yoshio HANAWA + - Sergey Melesh (sergex) - Toon Verwerft (veewee) + - Jiri Barous - Gert de Pagter - Sebastian Bergmann - Miroslav Šustek (sustmi) @@ -977,7 +986,6 @@ The Symfony Connect username in parenthesis allows to get more information - Rodrigo Borrego Bernabé (rodrigobb) - John Bafford (jbafford) - Emanuele Iannone - - Gasan Guseynov (gassan) - Ondrej Machulda (ondram) - Denis Gorbachev (starfall) - Martin Morávek (keeo) @@ -1003,6 +1011,7 @@ The Symfony Connect username in parenthesis allows to get more information - Zach Badgett (zachbadgett) - Loïc Faugeron - Aurélien Fredouelle + - Jordane VASPARD (elementaire) - Pavel Campr (pcampr) - Forfarle (forfarle) - Johnny Robeson (johnny) @@ -1019,6 +1028,7 @@ The Symfony Connect username in parenthesis allows to get more information - Jannik Zschiesche - Jan Ole Behrens (deegital) - Mantas Var (mvar) + - Florent Morselli (spomky_) - Yann LUCAS (drixs6o9) - Sebastian Krebs - Htun Htun Htet (ryanhhh91) @@ -1040,7 +1050,6 @@ The Symfony Connect username in parenthesis allows to get more information - Aurélien MARTIN - Malte Schlüter - Jules Matsounga (hyoa) - - Quentin Dequippe (qdequippe) - Yewhen Khoptynskyi (khoptynskyi) - Jérôme Nadaud (jnadaud) - wuchen90 @@ -1067,6 +1076,7 @@ The Symfony Connect username in parenthesis allows to get more information - Arnaud Frézet - Nicolas Martin (cocorambo) - luffy1727 + - Allison Guilhem (a_guilhem) - LHommet Nicolas (nicolaslh) - Sebastian Blum - Amirreza Shafaat (amirrezashafaat) @@ -1132,10 +1142,10 @@ The Symfony Connect username in parenthesis allows to get more information - Javier López (loalf) - tamar peled - Reinier Kip + - Robert Meijers - Geoffrey Brier (geoffrey-brier) - Sofien Naas - Christophe Meneses (c77men) - - Vladimir Tsykun - Andrei O - Dustin Dobervich (dustin10) - Alejandro Diaz Torres @@ -1160,6 +1170,7 @@ The Symfony Connect username in parenthesis allows to get more information - RevZer0 (rav) - remieuronews - Marek Binkowski + - Benjamin Schoch (bschoch) - Rostyslav Kinash - Andrey Lebedev (alebedev) - Cristoforo Cervino (cristoforocervino) @@ -1180,7 +1191,6 @@ The Symfony Connect username in parenthesis allows to get more information - Quentin Moreau (sheitak) - Stefan Warman (warmans) - Bert Ramakers - - Angelov Dejan (angelov) - Tristan Maindron (tmaindron) - Behnoush Norouzali (behnoush) - Marc Duboc (icemad) @@ -1222,7 +1232,6 @@ The Symfony Connect username in parenthesis allows to get more information - Evgeny Efimov (edefimov) - John VanDeWeghe - Oleg Mifle - - gnito-org - Michael Devery (mickadoo) - Loïc Ovigne (oviglo) - Antoine Corcy @@ -1250,6 +1259,7 @@ The Symfony Connect username in parenthesis allows to get more information - Benjamin Zikarsky (bzikarsky) - Jason Schilling (chapterjason) - Nathan PAGE (nathix) + - Rodrigo Méndez (rodmen) - sl_toto (sl_toto) - Marek Pietrzak (mheki) - Dmitrii Lozhkin @@ -1291,6 +1301,7 @@ The Symfony Connect username in parenthesis allows to get more information - Konstantin Bogomolov - Mark Spink - Cesar Scur (cesarscur) + - Maximilian Beckers (maxbeckers) - Kevin (oxfouzer) - Paweł Wacławczyk (pwc) - Sagrario Meneses @@ -1314,7 +1325,6 @@ The Symfony Connect username in parenthesis allows to get more information - rtek - Maxime AILLOUD (mailloud) - Richard van den Brand (ricbra) - - Sergey Melesh (sergex) - mohammadreza honarkhah - develop - flip111 @@ -1359,6 +1369,7 @@ The Symfony Connect username in parenthesis allows to get more information - Harald Tollefsen - Arend-Jan Tetteroo - Mbechezi Nawo + - Klaus Silveira (klaussilveira) - Andre Eckardt (korve) - Michael Piecko (michael.piecko) - Osayawe Ogbemudia Terry (terdia) @@ -1391,7 +1402,6 @@ The Symfony Connect username in parenthesis allows to get more information - Serhiy Lunak (slunak) - Wojciech Błoszyk (wbloszyk) - Jeroen van den Enden (endroid) - - Jiri Barous - abunch - tamcy - Mikko Pesari @@ -1571,6 +1581,7 @@ The Symfony Connect username in parenthesis allows to get more information - Stefano Degenkamp (steef) - James Michael DuPont - kor3k kor3k (kor3k) + - Rustam Bakeev (nommyde) - Eric Schildkamp - agaktr - Vincent CHALAMON @@ -1594,6 +1605,7 @@ The Symfony Connect username in parenthesis allows to get more information - Patrick Dawkins (pjcdawkins) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) + - Reyo Stallenberg (reyostallenberg) - Rémi Faivre (rfv) - Nguyen Xuan Quynh - Reen Lokum @@ -1774,7 +1786,6 @@ The Symfony Connect username in parenthesis allows to get more information - Shin Ohno (ganchiku) - Jaap van Otterdijk (jaapio) - Kubicki Kamil (kubik) - - Simon Leblanc (leblanc_simon) - Vladislav Nikolayev (luxemate) - Martin Mandl (m2mtech) - Maxime Pinot (maximepinot) @@ -1919,7 +1930,6 @@ The Symfony Connect username in parenthesis allows to get more information - Ronny (big-r) - Anton (bonio) - Alexandre Fiocre (demos77) - - Jordane VASPARD (elementaire) - Erwan Nader (ernadoo) - Faizan Akram Dar (faizanakram) - Greg Szczotka (greg606) @@ -1971,7 +1981,6 @@ The Symfony Connect username in parenthesis allows to get more information - Daniel Alejandro Castro Arellano (lexcast) - Aleksandar Dimitrov (netbull) - Gary Houbre (thegarious) - - Florent Morselli - Thomas Jarrand - Baptiste Leduc (bleduc) - Antoine Bluchet (soyuka) @@ -1993,6 +2002,7 @@ The Symfony Connect username in parenthesis allows to get more information - The Whole Life to Learn - Mikkel Paulson - ergiegonzaga + - kurozumi (kurozumi) - Liverbool (liverbool) - Dalibor Karlović - Sam Malone @@ -2045,6 +2055,7 @@ The Symfony Connect username in parenthesis allows to get more information - Zachary Tong (polyfractal) - Ashura - Hryhorii Hrebiniuk + - Alex Plekhanov - johnstevenson - hamza - dantleech @@ -2081,6 +2092,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ole Rößner (basster) - Faton (notaf) - Tom Houdmont + - mark burdett - Per Sandström (per) - Goran Juric - Laurent G. (laurentg) @@ -2091,6 +2103,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mert Simsek (mrtsmsk0) - Lin Clark - Jeremy David (jeremy.david) + - Michał Marcin Brzuchalski (brzuchal) - Jordi Rejas - Troy McCabe - Ville Mattila @@ -2106,6 +2119,7 @@ The Symfony Connect username in parenthesis allows to get more information - Norbert Schultheisz - Maximilian Berghoff (electricmaxxx) - SOEDJEDE Felix (fsoedjede) + - otsch - Piotr Antosik (antek88) - Nacho Martin (nacmartin) - Sergey Novikov (s12v) @@ -2115,6 +2129,7 @@ The Symfony Connect username in parenthesis allows to get more information - MARYNICH Mikhail (mmarynich-ext) - Viktor Novikov (nowiko) - Paul Mitchum (paul-m) + - Phil E. Taylor (philetaylor) - Angel Koilov (po_taka) - Dan Finnie - Ken Marfilla (marfillaster) @@ -2130,6 +2145,7 @@ The Symfony Connect username in parenthesis allows to get more information - Martijn Evers - Benjamin Paap (benjaminpaap) - Christian + - ju1ius - Denis Golubovskiy (bukashk0zzz) - Serge (nfx) - Mikkel Paulson @@ -2137,6 +2153,7 @@ The Symfony Connect username in parenthesis allows to get more information - Hugo Fonseca (fonsecas72) - Martynas Narbutas - Bailey Parker + - curlycarla2004 - Antanas Arvasevicius - Kris Kelly - Eddie Abou-Jaoude (eddiejaoude) @@ -2156,6 +2173,7 @@ The Symfony Connect username in parenthesis allows to get more information - HellFirePvP - Maximilian Ruta (deltachaos) - Jakub Sacha + - Kamil Musial - Olaf Klischat - orlovv - Claude Dioudonnat @@ -2173,6 +2191,7 @@ The Symfony Connect username in parenthesis allows to get more information - Rodrigo Díez Villamuera (rodrigodiez) - Stephen Clouse - e-ivanov + - Abderrahman DAIF (death_maker) - Yann Rabiller (einenlum) - Jochen Bayer (jocl) - Patrick Carlo-Hickman @@ -2182,6 +2201,7 @@ The Symfony Connect username in parenthesis allows to get more information - Gordienko Vladislav - Ener-Getick - Viacheslav Sychov + - Nicolas Sauveur (baishu) - Helmut Hummel (helhum) - Matt Brunt - Carlos Ortega Huetos @@ -2199,6 +2219,7 @@ The Symfony Connect username in parenthesis allows to get more information - Artem Kolesnikov (tyomo4ka) - Gustavo Adrian - Yannick + - Kuzia - Vladimir Luchaninov (luchaninov) - spdionis - rchoquet @@ -2206,6 +2227,7 @@ The Symfony Connect username in parenthesis allows to get more information - gitlost - Taras Girnyk - Sergio + - Mehrdad - Eduardo García Sanz (coma) - fduch (fduch) - David de Boer (ddeboer) @@ -2271,6 +2293,8 @@ The Symfony Connect username in parenthesis allows to get more information - AlbinoDrought - Jay Klehr - Sergey Yuferev + - Monet Emilien + - voodooism - Tobias Stöckler - Mario Young - martkop26 @@ -2279,7 +2303,7 @@ The Symfony Connect username in parenthesis allows to get more information - cilefen (cilefen) - Mo Di (modi) - Pablo Schläpfer - - Robert Meijers + - Nikos Charalampidis - Xavier RENAUDIN - Christian Wahler (christian) - Jelte Steijaert (jelte) @@ -2327,7 +2351,6 @@ The Symfony Connect username in parenthesis allows to get more information - Balázs Benyó (duplabe) - Erika Heidi Reinaldo (erikaheidi) - Marc J. Schmidt (marcjs) - - Maximilian Beckers (maxbeckers) - Sebastian Schwarz - karolsojko - Marco Jantke @@ -2397,6 +2420,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ilya Biryukov (ibiryukov) - Roma (memphys) - Giorgio Premi + - Matthias Bilger - Krzysztof Pyrkosz - ncou - Ian Carroll @@ -2442,6 +2466,7 @@ The Symfony Connect username in parenthesis allows to get more information - Nicolas Eeckeloo (neeckeloo) - Andriy Prokopenko (sleepyboy) - Dariusz Ruminski + - Thomas Hanke - Daniel Tschinder - Arnaud CHASSEUX - Wojciech Gorczyca @@ -2453,6 +2478,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mara Blaga - Rick Prent - skalpa + - Pierre Foresi - Pieter Jordaan - Tournoud (damientournoud) - Michael Dowling (mtdowling) @@ -2472,7 +2498,6 @@ The Symfony Connect username in parenthesis allows to get more information - Nouhail AL FIDI (alfidi) - Fabian Steiner (fabstei) - Felipy Amorim (felipyamorim) - - Klaus Silveira (klaussilveira) - Michael Lively (mlivelyjr) - Abderrahim (phydev) - Attila Bukor (r1pp3rj4ck) @@ -2487,7 +2512,6 @@ The Symfony Connect username in parenthesis allows to get more information - AnrDaemon - Charly Terrier (charlypoppins) - Emre Akinci (emre) - - Rustam Bakeev (nommyde) - psampaz (psampaz) - Maxwell Vandervelde - kaywalker @@ -2529,6 +2553,7 @@ The Symfony Connect username in parenthesis allows to get more information - Cédric Anne - LubenZA - Flavian Sierk + - Rik van der Heijden - Michael Bessolov - Zdeněk Drahoš - Dan Harper @@ -2560,6 +2585,7 @@ The Symfony Connect username in parenthesis allows to get more information - Tiago Garcia (tiagojsag) - Artiom - Jakub Simon + - Brandon Antonio Lorenzo - Bouke Haarsma - mlievertz - Enrico Schultz @@ -2577,6 +2603,7 @@ The Symfony Connect username in parenthesis allows to get more information - Anton Sukhachev (mrsuh) - Marcel Siegert - ryunosuke + - Roy de Vos Burchart - Francisco Facioni (fran6co) - Iwan van Staveren (istaveren) - Povilas S. (povilas) @@ -2605,7 +2632,6 @@ The Symfony Connect username in parenthesis allows to get more information - Jakub Janata (janatjak) - Jibé Barth (jibbarth) - Matthew Foster (mfoster) - - Reyo Stallenberg (reyostallenberg) - Paul Seiffert (seiffert) - Vasily Khayrulin (sirian) - Stas Soroka (stasyan) @@ -2659,6 +2685,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mike Francis - Nil Borodulia - Almog Baku (almogbaku) + - Arrakis (arrakis) - Benjamin Schultz (bschultz) - Gerd Christian Kunze (derdu) - Ionel Scutelnicu (ionelscutelnicu) @@ -2668,6 +2695,7 @@ The Symfony Connect username in parenthesis allows to get more information - Radek Wionczek (rwionczek) - Nick Stemerdink - David Stone + - Vincent Bouzeran - Grayson Koonce - Wissame MEKHILEF - Romain Dorgueil @@ -2735,6 +2763,7 @@ The Symfony Connect username in parenthesis allows to get more information - Steeve Titeca (stiteca) - Artem Lopata (bumz) - alex + - evgkord - Roman Orlov - Andreas Allacher - VolCh @@ -2754,6 +2783,7 @@ The Symfony Connect username in parenthesis allows to get more information - Julien Moulin (lizjulien) - Raito Akehanareru (raito) - Mauro Foti (skler) + - skmedix (skmedix) - Yannick Warnier (ywarnier) - Jörn Lang - Kevin Decherf @@ -2769,9 +2799,11 @@ The Symfony Connect username in parenthesis allows to get more information - Sam Ward - Hans N. Hjort - Walther Lalk + - victor-prdh - Adam - Ivo - Sören Bernstein + - michael.kubovic - devel - taiiiraaa - gedrox @@ -2855,6 +2887,7 @@ The Symfony Connect username in parenthesis allows to get more information - Omar Yepez (oyepez003) - Jonny Schmid (schmidjon) - Götz Gottwald + - Adrien Peyre - Christoph Krapp - Nick Chiu - Robert Campbell @@ -2961,6 +2994,7 @@ The Symfony Connect username in parenthesis allows to get more information - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) - Mokhtar Tlili (sf-djuba) + - Gregor Nathanael Meyer (spackmat) - Marcin Szepczynski (szepczynski) - Simone Di Maulo (toretto460) - Cyrille Jouineau (tuxosaurus) @@ -2983,6 +3017,7 @@ The Symfony Connect username in parenthesis allows to get more information - Gabriel Moreira - Alexey Popkov - ChS + - Jannik Zschiesche - Alexis MARQUIS - Joseph Deray - Damian Sromek @@ -3032,6 +3067,7 @@ The Symfony Connect username in parenthesis allows to get more information - znerol - Christian Eikermann - Sergei Shitikov + - Steffen Keuper - Antonio Angelino - Pavel Golovin - Matt Fields @@ -3077,6 +3113,7 @@ The Symfony Connect username in parenthesis allows to get more information - Alexis BOYER - Kaipi Yann - adam-mospan + - nerdgod - Sam Williams - Guillaume Aveline - Adrian Philipp @@ -3161,6 +3198,7 @@ The Symfony Connect username in parenthesis allows to get more information - Sam Anthony - Christian Stocker - Oussama Elgoumri + - Gert de Pagter - David Lima - Dawid Nowak - Lesnykh Ilia @@ -3237,6 +3275,7 @@ The Symfony Connect username in parenthesis allows to get more information - Moritz Borgmann (mborgmann) - Matt Drollette (mdrollette) - Adam Monsen (meonkeys) + - Steffen Persch (n3o77) - Ala Eddine Khefifi (nayzo) - emilienbouard (neime) - Nicholas Byfleet (nickbyfleet) @@ -3264,6 +3303,7 @@ The Symfony Connect username in parenthesis allows to get more information - Schuyler Jager (sjager) - Volker (skydiablo) - Julien Sanchez (sumbobyboys) + - Sylvain BEISSIER (sylvain-beissier) - Ron Gähler (t-ronx) - Guillermo Gisinger (t3chn0r) - Tom Newby (tomnewbyau) @@ -3302,6 +3342,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mark Topper - Romain - Xavier REN + - Kevin Meijer - max - Ahmad Mayahi (ahmadmayahi) - Mohamed Karnichi (amiral) diff --git a/LICENSE b/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/composer.json b/composer.json index d574f9dae52bb..c3e263eb0752b 100644 --- a/composer.json +++ b/composer.json @@ -135,7 +135,7 @@ "predis/predis": "~1.1", "psr/http-client": "^1.0", "psr/simple-cache": "^1.0|^2.0|^3.0", - "egulias/email-validator": "^2.1.10|^3.1", + "egulias/email-validator": "^2.1.10|^3.1|^4", "symfony/mercure-bundle": "^0.3", "symfony/phpunit-bridge": "^5.4|^6.0", "symfony/runtime": "self.version", @@ -199,15 +199,6 @@ { "type": "path", "url": "src/Symfony/Component/Runtime" - }, - { - "type": "path", - "url": "src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock", - "options": { - "versions": { - "stella-maris/clock": "0.1.x-dev" - } - } } ], "minimum-stability": "dev" diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index ebcf2c06f8d4f..cd5fc91cb32b7 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -301,8 +301,8 @@ private function detectMappingType(string $directory, ContainerBuilder $containe break; } if ( - preg_match('/^ \* @.*'.$quotedMappingObjectName.'\b/m', $content) || - preg_match('/^ \* @.*Embeddable\b/m', $content) + preg_match('/^(?: \*|\/\*\*) @.*'.$quotedMappingObjectName.'\b/m', $content) || + preg_match('/^(?: \*|\/\*\*) @.*Embeddable\b/m', $content) ) { $type = 'annotation'; break; diff --git a/src/Symfony/Bridge/Doctrine/LICENSE b/src/Symfony/Bridge/Doctrine/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bridge/Doctrine/LICENSE +++ b/src/Symfony/Bridge/Doctrine/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index b481ab9569c2c..2ca6eda3e74b8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -276,6 +276,7 @@ public function testUnrecognizedCacheDriverException() public function providerBundles() { yield ['AnnotationsBundle', 'annotation', '/Entity']; + yield ['AnnotationsOneLineBundle', 'annotation', '/Entity']; yield ['FullEmbeddableAnnotationsBundle', 'annotation', '/Entity']; yield ['AttributesBundle', 'attribute', '/Entity']; yield ['FullEmbeddableAttributesBundle', 'attribute', '/Entity']; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/AnnotationsOneLineBundle.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/AnnotationsOneLineBundle.php new file mode 100644 index 0000000000000..6d401bae4f987 --- /dev/null +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/AnnotationsOneLineBundle.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Fixtures\Bundles\AnnotationsOneLineBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +class AnnotationsOneLineBundle extends Bundle +{ +} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/Entity/Person.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/Entity/Person.php new file mode 100644 index 0000000000000..b55fe6f86503b --- /dev/null +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Bundles/AnnotationsOneLineBundle/Entity/Person.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Fixtures\Bundles\AnnotationsOneLineBundle\Entity; + +use Doctrine\ORM\Mapping\Column; +use Doctrine\ORM\Mapping\Entity; +use Doctrine\ORM\Mapping\Id; + +/** @Entity */ +class Person +{ + /** @Id @Column(type="integer") */ + protected $id; + + /** @Column(type="string") */ + public $name; + + public function __construct($id, $name) + { + $this->id = $id; + $this->name = $name; + } + + public function __toString(): string + { + return (string) $this->name; + } +} diff --git a/src/Symfony/Bridge/Monolog/LICENSE b/src/Symfony/Bridge/Monolog/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bridge/Monolog/LICENSE +++ b/src/Symfony/Bridge/Monolog/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 00bb25a585fd2..36c0960868dad 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -203,7 +203,7 @@ public function shutdown() // store failing status $isFailing = !$configuration->tolerates($this->deprecationGroups); - $this->displayDeprecations($groups, $configuration, $isFailing); + $this->displayDeprecations($groups, $configuration); $this->resetDeprecationGroups(); @@ -216,7 +216,7 @@ public function shutdown() } $isFailingAtShutdown = !$configuration->tolerates($this->deprecationGroups); - $this->displayDeprecations($groups, $configuration, $isFailingAtShutdown); + $this->displayDeprecations($groups, $configuration); if ($configuration->isGeneratingBaseline()) { $configuration->writeBaseline(); @@ -292,11 +292,10 @@ private static function colorize($str, $red) /** * @param string[] $groups * @param Configuration $configuration - * @param bool $isFailing * * @throws \InvalidArgumentException */ - private function displayDeprecations($groups, $configuration, $isFailing) + private function displayDeprecations($groups, $configuration) { $cmp = function ($a, $b) { return $b->count() - $a->count(); @@ -323,7 +322,8 @@ private function displayDeprecations($groups, $configuration, $isFailing) fwrite($handle, "\n".self::colorize($deprecationGroupMessage, 'legacy' !== $group && 'indirect' !== $group)."\n"); } - if ('legacy' !== $group && !$configuration->verboseOutput($group) && !$isFailing) { + // Skip the verbose output if the group is quiet and not failing according to its threshold: + if ('legacy' !== $group && !$configuration->verboseOutput($group) && $configuration->toleratesForGroup($group, $this->deprecationGroups)) { continue; } $notices = $this->deprecationGroups[$group]->notices(); diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php index a432c31183669..45d1ed7ce9940 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php @@ -203,6 +203,32 @@ public function isIgnoredDeprecation(Deprecation $deprecation): bool return (bool) $result; } + /** + * @param array $deprecationGroups + * + * @return bool true if the threshold is not reached for the deprecation type nor for the total + */ + public function toleratesForGroup(string $groupName, array $deprecationGroups): bool + { + $grandTotal = 0; + + foreach ($deprecationGroups as $type => $group) { + if ('legacy' !== $type) { + $grandTotal += $group->count(); + } + } + + if ($grandTotal > $this->thresholds['total']) { + return false; + } + + if (\in_array($groupName, ['self', 'direct', 'indirect'], true) && $deprecationGroups[$groupName]->count() > $this->thresholds[$groupName]) { + return false; + } + + return true; + } + /** * @return bool */ diff --git a/src/Symfony/Bridge/PhpUnit/LICENSE b/src/Symfony/Bridge/PhpUnit/LICENSE index a843ec124ea70..72412a62b2029 100644 --- a/src/Symfony/Bridge/PhpUnit/LICENSE +++ b/src/Symfony/Bridge/PhpUnit/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2022 Fabien Potencier +Copyright (c) 2014-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php index 2f59ae5b91e2e..496a1b5fa8170 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php @@ -234,6 +234,103 @@ public function testOutputIsNotVerboseInWeakMode() $this->assertFalse($configuration->verboseOutput('other')); } + /** + * @dataProvider provideDataForToleratesForGroup + */ + public function testToleratesForIndividualGroups(string $deprecationsHelper, array $deprecationsPerType, array $expected) + { + $configuration = Configuration::fromUrlEncodedString($deprecationsHelper); + + $groups = $this->buildGroups($deprecationsPerType); + + foreach ($expected as $groupName => $tolerates) { + $this->assertSame($tolerates, $configuration->toleratesForGroup($groupName, $groups), sprintf('Deprecation type "%s" is %s', $groupName, $tolerates ? 'tolerated' : 'not tolerated')); + } + } + + public function provideDataForToleratesForGroup() { + + yield 'total threshold not reached' => ['max[total]=1', [ + 'unsilenced' => 0, + 'self' => 0, + 'legacy' => 1, // Legacy group is ignored in total threshold + 'other' => 0, + 'direct' => 1, + 'indirect' => 0, + ], [ + 'unsilenced' => true, + 'self' => true, + 'legacy' => true, + 'other' => true, + 'direct' => true, + 'indirect' => true, + ]]; + + yield 'total threshold reached' => ['max[total]=1', [ + 'unsilenced' => 0, + 'self' => 0, + 'legacy' => 1, + 'other' => 0, + 'direct' => 1, + 'indirect' => 1, + ], [ + 'unsilenced' => false, + 'self' => false, + 'legacy' => false, + 'other' => false, + 'direct' => false, + 'indirect' => false, + ]]; + + yield 'direct threshold reached' => ['max[total]=99&max[direct]=0', [ + 'unsilenced' => 0, + 'self' => 0, + 'legacy' => 1, + 'other' => 0, + 'direct' => 1, + 'indirect' => 1, + ], [ + 'unsilenced' => true, + 'self' => true, + 'legacy' => true, + 'other' => true, + 'direct' => false, + 'indirect' => true, + ]]; + + yield 'indirect & self threshold reached' => ['max[total]=99&max[direct]=0&max[self]=0', [ + 'unsilenced' => 0, + 'self' => 1, + 'legacy' => 1, + 'other' => 1, + 'direct' => 1, + 'indirect' => 1, + ], [ + 'unsilenced' => true, + 'self' => false, + 'legacy' => true, + 'other' => true, + 'direct' => false, + 'indirect' => true, + ]]; + + yield 'indirect & self threshold not reached' => ['max[total]=99&max[direct]=2&max[self]=2', [ + 'unsilenced' => 0, + 'self' => 1, + 'legacy' => 1, + 'other' => 1, + 'direct' => 1, + 'indirect' => 1, + ], [ + 'unsilenced' => true, + 'self' => true, + 'legacy' => true, + 'other' => true, + 'direct' => true, + 'indirect' => true, + ]]; + } + private function buildGroups($counts) { $groups = []; diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/partially_quiet2.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/partially_quiet2.phpt new file mode 100644 index 0000000000000..4d0d6c3d55794 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/partially_quiet2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test DeprecationErrorHandler quiet on everything but self/direct deprecations +--FILE-- + +--EXPECTF-- +Unsilenced deprecation notices (3) + +Remaining direct deprecation notices (2) + + 1x: root deprecation + + 1x: silenced bar deprecation + 1x in FooTestCase::testNonLegacyBar + +Remaining indirect deprecation notices (1) + +Legacy deprecation notices (2) diff --git a/src/Symfony/Bridge/ProxyManager/LICENSE b/src/Symfony/Bridge/ProxyManager/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bridge/ProxyManager/LICENSE +++ b/src/Symfony/Bridge/ProxyManager/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Twig/LICENSE b/src/Symfony/Bridge/Twig/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bridge/Twig/LICENSE +++ b/src/Symfony/Bridge/Twig/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 7c0bdf7288169..974e2f3cd891a 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "doctrine/annotations": "^1.12|^2", - "egulias/email-validator": "^2.1.10|^3", + "egulias/email-validator": "^2.1.10|^3|^4", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "symfony/asset": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", diff --git a/src/Symfony/Bundle/DebugBundle/LICENSE b/src/Symfony/Bundle/DebugBundle/LICENSE index a843ec124ea70..72412a62b2029 100644 --- a/src/Symfony/Bundle/DebugBundle/LICENSE +++ b/src/Symfony/Bundle/DebugBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2022 Fabien Potencier +Copyright (c) 2014-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php index 222b5c7b75af0..942eb635b26f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TestServiceContainerRealRefPass.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; @@ -38,6 +39,16 @@ public function process(ContainerBuilder $container) } } + foreach ($container->getAliases() as $id => $target) { + while ($container->hasAlias($target = (string) $target)) { + $target = $container->getAlias($target); + } + + if ($definitions[$target]->hasTag('container.private')) { + $privateServices[$id] = new ServiceClosureArgument(new Reference($target)); + } + } + $privateContainer->replaceArgument(0, $privateServices); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 06137d9508c45..7a62507f5fd53 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1645,11 +1645,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde $loader->load('annotations.php'); + // registerUniqueLoader exists since doctrine/annotations v1.6 if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) { + // registerLoader exists only in doctrine/annotations v1 if (method_exists(AnnotationRegistry::class, 'registerLoader')) { $container->getDefinition('annotations.dummy_registry') ->setMethodCalls([['registerLoader', ['class_exists']]]); } else { + // remove the dummy registry when doctrine/annotations v2 is used $container->removeDefinition('annotations.dummy_registry'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/LICENSE b/src/Symfony/Bundle/FrameworkBundle/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/LICENSE +++ b/src/Symfony/Bundle/FrameworkBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php index 65a3f4e8ffd90..ec86fed495498 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php @@ -25,7 +25,7 @@ ->set('annotations.reader', AnnotationReader::class) ->call('addGlobalIgnoredName', [ 'required', - service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required + service('annotations.dummy_registry')->nullOnInvalid(), // dummy arg to register class_exists as annotation loader only when required ]) ->set('annotations.dummy_registry', AnnotationRegistry::class) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/TestServiceContainerRefPassesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/TestServiceContainerRefPassesTest.php index 7dc9e6f59ec99..355b1527d64bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/TestServiceContainerRefPassesTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/TestServiceContainerRefPassesTest.php @@ -43,6 +43,13 @@ public function testProcess() ->setPublic(true) ->addTag('container.private', ['package' => 'foo/bar', 'version' => '1.42']) ; + $container->register('Test\soon_private_service_decorated') + ->setPublic(true) + ->addTag('container.private', ['package' => 'foo/bar', 'version' => '1.42']) + ; + $container->register('Test\soon_private_service_decorator') + ->setDecoratedService('Test\soon_private_service_decorated') + ->setArguments(['Test\soon_private_service_decorator.inner']); $container->register('Test\private_used_shared_service'); $container->register('Test\private_unused_shared_service'); @@ -55,6 +62,8 @@ public function testProcess() 'Test\private_used_shared_service' => new ServiceClosureArgument(new Reference('Test\private_used_shared_service')), 'Test\private_used_non_shared_service' => new ServiceClosureArgument(new Reference('Test\private_used_non_shared_service')), 'Test\soon_private_service' => new ServiceClosureArgument(new Reference('.container.private.Test\soon_private_service')), + 'Test\soon_private_service_decorator' => new ServiceClosureArgument(new Reference('.container.private.Test\soon_private_service_decorated')), + 'Test\soon_private_service_decorated' => new ServiceClosureArgument(new Reference('.container.private.Test\soon_private_service_decorated')), ]; $privateServices = $container->getDefinition('test.private_services_locator')->getArgument(0); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php index b0c6b5c0ecb79..6a34fe7efb703 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -80,7 +80,7 @@ protected function createAuthenticationSuccessHandler(ContainerBuilder $containe if (isset($config['success_handler'])) { $successHandler = $container->setDefinition($successHandlerId, new ChildDefinition('security.authentication.custom_success_handler')); - $successHandler->replaceArgument(0, new Reference($config['success_handler'])); + $successHandler->replaceArgument(0, new ChildDefinition($config['success_handler'])); $successHandler->replaceArgument(1, $options); $successHandler->replaceArgument(2, $id); } else { @@ -99,7 +99,7 @@ protected function createAuthenticationFailureHandler(ContainerBuilder $containe if (isset($config['failure_handler'])) { $failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.custom_failure_handler')); - $failureHandler->replaceArgument(0, new Reference($config['failure_handler'])); + $failureHandler->replaceArgument(0, new ChildDefinition($config['failure_handler'])); $failureHandler->replaceArgument(1, $options); } else { $failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.failure_handler')); diff --git a/src/Symfony/Bundle/SecurityBundle/LICENSE b/src/Symfony/Bundle/SecurityBundle/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bundle/SecurityBundle/LICENSE +++ b/src/Symfony/Bundle/SecurityBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php index e655520b0e745..04d6501952649 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php @@ -92,7 +92,10 @@ ->set('security.authentication.trust_resolver', AuthenticationTrustResolver::class) ->set('security.authentication.session_strategy', SessionAuthenticationStrategy::class) - ->args([param('security.authentication.session_strategy.strategy')]) + ->args([ + param('security.authentication.session_strategy.strategy'), + service('security.csrf.token_storage')->ignoreOnInvalid(), + ]) ->alias(SessionAuthenticationStrategyInterface::class, 'security.authentication.session_strategy') ->set('security.authentication.session_strategy_noop', SessionAuthenticationStrategy::class) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php index ff4108d25cdc9..a0d9353b70483 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; class AbstractFactoryTest extends TestCase @@ -43,12 +44,19 @@ public function testDefaultFailureHandler($serviceId, $defaultHandlerInjection) $failureHandler = $this->container->getDefinition('security.authentication.failure_handler.foo.stub'); + $expectedFailureHandlerOptions = ['login_path' => '/bar']; $methodCalls = $failureHandler->getMethodCalls(); if ($defaultHandlerInjection) { $this->assertEquals('setOptions', $methodCalls[0][0]); - $this->assertEquals(['login_path' => '/bar'], $methodCalls[0][1][0]); + $this->assertEquals($expectedFailureHandlerOptions, $methodCalls[0][1][0]); } else { $this->assertCount(0, $methodCalls); + $this->assertInstanceOf(ChildDefinition::class, $failureHandler); + $this->assertEquals('security.authentication.custom_failure_handler', $failureHandler->getParent()); + $failureHandlerArguments = $failureHandler->getArguments(); + $this->assertInstanceOf(ChildDefinition::class, $failureHandlerArguments['index_0']); + $this->assertEquals($serviceId, $failureHandlerArguments['index_0']->getParent()); + $this->assertEquals($expectedFailureHandlerOptions, $failureHandlerArguments['index_1']); } } @@ -80,13 +88,22 @@ public function testDefaultSuccessHandler($serviceId, $defaultHandlerInjection) $successHandler = $this->container->getDefinition('security.authentication.success_handler.foo.stub'); $methodCalls = $successHandler->getMethodCalls(); + $expectedSuccessHandlerOptions = ['default_target_path' => '/bar']; + $expectedFirewallName = 'foo'; if ($defaultHandlerInjection) { $this->assertEquals('setOptions', $methodCalls[0][0]); - $this->assertEquals(['default_target_path' => '/bar'], $methodCalls[0][1][0]); + $this->assertEquals($expectedSuccessHandlerOptions, $methodCalls[0][1][0]); $this->assertEquals('setFirewallName', $methodCalls[1][0]); - $this->assertEquals(['foo'], $methodCalls[1][1]); + $this->assertEquals($expectedFirewallName, $methodCalls[1][1][0]); } else { $this->assertCount(0, $methodCalls); + $this->assertInstanceOf(ChildDefinition::class, $successHandler); + $this->assertEquals('security.authentication.custom_success_handler', $successHandler->getParent()); + $successHandlerArguments = $successHandler->getArguments(); + $this->assertInstanceOf(ChildDefinition::class, $successHandlerArguments['index_0']); + $this->assertEquals($serviceId, $successHandlerArguments['index_0']->getParent()); + $this->assertEquals($expectedSuccessHandlerOptions, $successHandlerArguments['index_1']); + $this->assertEquals($expectedFirewallName, $successHandlerArguments['index_2']); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticatorTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticatorTest.php index 10eeb39ca8c5e..970a9dc9ae746 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticatorTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticatorTest.php @@ -102,4 +102,38 @@ public function testMultipleFirewalls() $client->request('GET', '/firewall2/profile'); $this->assertResponseRedirects('http://localhost/login'); } + + public function testCustomSuccessHandler() + { + $client = $this->createClient(['test_case' => 'Authenticator', 'root_config' => 'custom_handlers.yml']); + + $client->request('POST', '/firewall1/login', [ + '_username' => 'jane@example.org', + '_password' => 'test', + ]); + $this->assertResponseRedirects('http://localhost/firewall1/test'); + + $client->request('POST', '/firewall1/dummy_login', [ + '_username' => 'jane@example.org', + '_password' => 'test', + ]); + $this->assertResponseRedirects('http://localhost/firewall1/dummy'); + } + + public function testCustomFailureHandler() + { + $client = $this->createClient(['test_case' => 'Authenticator', 'root_config' => 'custom_handlers.yml']); + + $client->request('POST', '/firewall1/login', [ + '_username' => 'jane@example.org', + '_password' => '', + ]); + $this->assertResponseRedirects('http://localhost/firewall1/login'); + + $client->request('POST', '/firewall1/dummy_login', [ + '_username' => 'jane@example.org', + '_password' => '', + ]); + $this->assertResponseRedirects('http://localhost/firewall1/dummy_login'); + } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/AuthenticatorBundle.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/AuthenticatorBundle.php new file mode 100644 index 0000000000000..730974f17f169 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/AuthenticatorBundle.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle; + +use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\Bundle; + +class AuthenticatorBundle extends Bundle +{ + public function build(ContainerBuilder $container) + { + parent::build($container); + + $this->configureSecurityExtension($container); + } + + private function configureSecurityExtension(ContainerBuilder $container): void + { + /** @var SecurityExtension $extension */ + $extension = $container->getExtension('security'); + + $extension->addAuthenticatorFactory(new DummyFormLoginFactory()); + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/DummyFormLoginFactory.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/DummyFormLoginFactory.php new file mode 100644 index 0000000000000..fc728fe5c6f4e --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/DummyFormLoginFactory.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle; + +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginFactory; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +class DummyFormLoginFactory extends FormLoginFactory +{ + public function getKey(): string + { + return 'dummy_form_login'; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + $authenticatorId = 'security.authenticator.dummy_form_login.'.$firewallName; + $options = array_intersect_key($config, $this->options); + $authenticator = $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.form_login')) + ->replaceArgument(1, new Reference($userProviderId)) + ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config))) + ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config))) + ->replaceArgument(4, $options); + + if ($options['use_forward'] ?? false) { + $authenticator->addMethodCall('setHttpKernel', [new Reference('http_kernel')]); + } + + return $authenticatorId; + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php index ad2fc0c63d1e0..72a4b7bb1502b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php @@ -11,6 +11,12 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; +use Symfony\Bundle\FrameworkBundle\KernelBrowser; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\KernelEvents; + class CsrfFormLoginTest extends AbstractWebTestCase { /** @@ -20,6 +26,10 @@ public function testFormLoginAndLogoutWithCsrfTokens($options) { $client = $this->createClient($options); + $this->callInRequestContext($client, function () { + static::getContainer()->get('security.csrf.token_storage')->setToken('foo', 'bar'); + }); + $form = $client->request('GET', '/login')->selectButton('login')->form(); $form['user_login[username]'] = 'johannes'; $form['user_login[password]'] = 'test'; @@ -40,6 +50,10 @@ public function testFormLoginAndLogoutWithCsrfTokens($options) $client->click($logoutLinks[0]); $this->assertRedirect($client->getResponse(), '/'); + + $this->callInRequestContext($client, function () { + $this->assertFalse(static::getContainer()->get('security.csrf.token_storage')->hasToken('foo')); + }); } /** @@ -49,6 +63,10 @@ public function testFormLoginWithInvalidCsrfToken($options) { $client = $this->createClient($options); + $this->callInRequestContext($client, function () { + static::getContainer()->get('security.csrf.token_storage')->setToken('foo', 'bar'); + }); + $form = $client->request('GET', '/login')->selectButton('login')->form(); $form['user_login[_token]'] = ''; $client->submit($form); @@ -57,6 +75,10 @@ public function testFormLoginWithInvalidCsrfToken($options) $text = $client->followRedirect()->text(null, true); $this->assertStringContainsString('Invalid CSRF token.', $text); + + $this->callInRequestContext($client, function () { + $this->assertTrue(static::getContainer()->get('security.csrf.token_storage')->hasToken('foo')); + }); } /** @@ -105,4 +127,22 @@ public function provideClientOptions() yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'config.yml']]; yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'routes_as_path.yml']]; } + + private function callInRequestContext(KernelBrowser $client, callable $callable): void + { + /** @var EventDispatcherInterface $eventDispatcher */ + $eventDispatcher = static::getContainer()->get(EventDispatcherInterface::class); + $wrappedCallable = function (RequestEvent $event) use (&$callable) { + $callable(); + $event->setResponse(new Response('')); + $event->stopPropagation(); + }; + + $eventDispatcher->addListener(KernelEvents::REQUEST, $wrappedCallable); + try { + $client->request('GET', '/'.uniqid('', true)); + } finally { + $eventDispatcher->removeListener(KernelEvents::REQUEST, $wrappedCallable); + } + } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php index 5da52d9602a49..3da73f20fccc5 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php @@ -24,9 +24,6 @@ public function testCsrfTokensAreClearedOnLogout() { $client = $this->createClient(['test_case' => 'LogoutWithoutSessionInvalidation', 'root_config' => 'config.yml']); $client->disableReboot(); - $this->callInRequestContext($client, function () { - static::getContainer()->get('security.csrf.token_storage')->setToken('foo', 'bar'); - }); $client->request('POST', '/login', [ '_username' => 'johannes', @@ -34,8 +31,7 @@ public function testCsrfTokensAreClearedOnLogout() ]); $this->callInRequestContext($client, function () { - $this->assertTrue(static::getContainer()->get('security.csrf.token_storage')->hasToken('foo')); - $this->assertSame('bar', static::getContainer()->get('security.csrf.token_storage')->getToken('foo')); + static::getContainer()->get('security.csrf.token_storage')->setToken('foo', 'bar'); }); $client->request('GET', '/logout'); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/bundles.php index d1e9eb7e0d36a..372700495208f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/bundles.php @@ -12,4 +12,5 @@ return [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), + new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle\AuthenticatorBundle(), ]; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/custom_handlers.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/custom_handlers.yml new file mode 100644 index 0000000000000..96e9762d96833 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/custom_handlers.yml @@ -0,0 +1,34 @@ +imports: + - { resource: ./config.yml } + - { resource: ./security.yml } + +security: + enable_authenticator_manager: true + firewalls: + firewall1: + pattern: /firewall1 + provider: in_memory + entry_point: form_login + form_login: + check_path: /firewall1/login + success_handler: success_handler + failure_handler: failure_handler + default_target_path: /firewall1/test + login_path: /firewall1/login + dummy_form_login: + check_path: /firewall1/dummy_login + success_handler: success_handler + failure_handler: failure_handler + default_target_path: /firewall1/dummy + login_path: /firewall1/dummy_login + +services: + success_handler: + class: Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler + arguments: + - '@security.http_utils' + failure_handler: + class: Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler + arguments: + - '@http_kernel' + - '@security.http_utils' diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/routing.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/routing.yml index 4796a3f6bc00c..76d894d9de904 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/routing.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Authenticator/routing.yml @@ -22,6 +22,9 @@ security_custom_profile: firewall1_login: path: /firewall1/login +firewall_dummy_login: + path: /firewall1/dummy_login + firewall2_profile: path: /firewall2/profile defaults: diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 76fe1e4efc770..17cb992d4c31b 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -27,7 +27,7 @@ "symfony/password-hasher": "^5.4|^6.0", "symfony/security-core": "^5.4|^6.0", "symfony/security-csrf": "^5.4|^6.0", - "symfony/security-http": "^5.4|^6.0" + "symfony/security-http": "^5.4.20|~6.0.20|~6.1.12|^6.2.6" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", diff --git a/src/Symfony/Bundle/TwigBundle/LICENSE b/src/Symfony/Bundle/TwigBundle/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bundle/TwigBundle/LICENSE +++ b/src/Symfony/Bundle/TwigBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/WebProfilerBundle/LICENSE b/src/Symfony/Bundle/WebProfilerBundle/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/LICENSE +++ b/src/Symfony/Bundle/WebProfilerBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Asset/LICENSE b/src/Symfony/Component/Asset/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Asset/LICENSE +++ b/src/Symfony/Component/Asset/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/BrowserKit/LICENSE b/src/Symfony/Component/BrowserKit/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/BrowserKit/LICENSE +++ b/src/Symfony/Component/BrowserKit/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php index 4fb700bb66fd3..dc3c687ed48fc 100644 --- a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php +++ b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php @@ -112,7 +112,7 @@ private function calculateStatistics(): array /** @var TraceableAdapterEvent $call */ foreach ($calls as $call) { ++$statistics[$name]['calls']; - $statistics[$name]['time'] += $call->end - $call->start; + $statistics[$name]['time'] += ($call->end ?? microtime(true)) - $call->start; if ('get' === $call->name) { ++$statistics[$name]['reads']; if ($call->hits) { @@ -134,10 +134,8 @@ private function calculateStatistics(): array $statistics[$name]['misses'] += $call->misses; } elseif ('hasItem' === $call->name) { ++$statistics[$name]['reads']; - if (false === $call->result) { - ++$statistics[$name]['misses']; - } else { - ++$statistics[$name]['hits']; + foreach ($call->result ?? [] as $result) { + ++$statistics[$name][$result ? 'hits' : 'misses']; } } elseif ('save' === $call->name) { ++$statistics[$name]['writes']; diff --git a/src/Symfony/Component/Cache/LICENSE b/src/Symfony/Component/Cache/LICENSE index 7fa9539054928..f2345234aa9ea 100644 --- a/src/Symfony/Component/Cache/LICENSE +++ b/src/Symfony/Component/Cache/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2022 Fabien Potencier +Copyright (c) 2016-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Cache/Tests/DataCollector/CacheDataCollectorTest.php b/src/Symfony/Component/Cache/Tests/DataCollector/CacheDataCollectorTest.php index 6aa94c2c63383..a00954b6cb828 100644 --- a/src/Symfony/Component/Cache/Tests/DataCollector/CacheDataCollectorTest.php +++ b/src/Symfony/Component/Cache/Tests/DataCollector/CacheDataCollectorTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\DataCollector; use PHPUnit\Framework\TestCase; +use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Adapter\TraceableAdapter; use Symfony\Component\Cache\DataCollector\CacheDataCollector; use Symfony\Component\HttpFoundation\Request; @@ -55,7 +56,7 @@ public function testHitedEventDataCollector() $traceableAdapterEvent->name = 'hasItem'; $traceableAdapterEvent->start = 0; $traceableAdapterEvent->end = 0; - $traceableAdapterEvent->hits = 1; + $traceableAdapterEvent->hits = 0; $traceableAdapterEvent->misses = 0; $traceableAdapterEvent->result = ['foo' => false]; @@ -63,8 +64,8 @@ public function testHitedEventDataCollector() $this->assertEquals($statistics[self::INSTANCE_NAME]['calls'], 1, 'calls'); $this->assertEquals($statistics[self::INSTANCE_NAME]['reads'], 1, 'reads'); - $this->assertEquals($statistics[self::INSTANCE_NAME]['hits'], 1, 'hits'); - $this->assertEquals($statistics[self::INSTANCE_NAME]['misses'], 0, 'misses'); + $this->assertEquals($statistics[self::INSTANCE_NAME]['hits'], 0, 'hits'); + $this->assertEquals($statistics[self::INSTANCE_NAME]['misses'], 1, 'misses'); $this->assertEquals($statistics[self::INSTANCE_NAME]['writes'], 0, 'writes'); } @@ -84,6 +85,25 @@ public function testSavedEventDataCollector() $this->assertEquals($statistics[self::INSTANCE_NAME]['writes'], 1, 'writes'); } + public function testCollectBeforeEnd() + { + $adapter = new TraceableAdapter(new NullAdapter()); + + $collector = new CacheDataCollector(); + $collector->addInstance(self::INSTANCE_NAME, $adapter); + + $adapter->get('foo', function () use ($collector) { + $collector->collect(new Request(), new Response()); + + return 123; + }); + + $stats = $collector->getStatistics(); + $this->assertGreaterThan(0, $stats[self::INSTANCE_NAME]['time']); + $this->assertEquals($stats[self::INSTANCE_NAME]['hits'], 0, 'hits'); + $this->assertEquals($stats[self::INSTANCE_NAME]['misses'], 1, 'misses'); + } + private function getCacheDataCollectorStatisticsFromEvents(array $traceableAdapterEvents) { $traceableAdapterMock = $this->createMock(TraceableAdapter::class); diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 5ada2d0e15b34..49640ac0a6e0f 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -201,8 +201,11 @@ public static function createConnection(string $dsn, array $options = []): \Redi if (!isset($params['redis_sentinel'])) { break; } - - $sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']); + $extra = []; + if (\defined('Redis::OPT_NULL_MULTIBULK_AS_NULL') && isset($params['auth'])) { + $extra = [$params['auth']]; + } + $sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra); if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) { [$host, $port] = $address; @@ -214,7 +217,13 @@ public static function createConnection(string $dsn, array $options = []): \Redi } try { - @$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []); + $extra = [ + 'stream' => $params['ssl'] ?? null, + ]; + if (isset($params['auth'])) { + $extra['auth'] = $params['auth']; + } + @$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [$extra] : []); set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); try { @@ -223,7 +232,7 @@ public static function createConnection(string $dsn, array $options = []): \Redi restore_error_handler(); } if (!$isConnected) { - $error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : ''; + $error = preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? '', $error) ? sprintf(' (%s)', $error[1]) : ''; throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.'); } diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php index 1ad8522e00d4d..13fe88877d5c8 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php @@ -138,7 +138,7 @@ private function writeNode(NodeInterface $node, int $depth = 0, bool $root = fal } if ($child instanceof BaseNode && $example = $child->getExample()) { - $comments[] = 'Example: '.$example; + $comments[] = 'Example: '.(\is_array($example) ? implode(', ', $example) : $example); } if ($child->isRequired()) { diff --git a/src/Symfony/Component/Config/LICENSE b/src/Symfony/Component/Config/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Config/LICENSE +++ b/src/Symfony/Component/Config/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php b/src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php index 8d84ae50babee..520d25666a1c0 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php @@ -42,6 +42,7 @@ private function getConfigurationAsString() + diff --git a/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php b/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php index 88340d1afbada..7d8c2d951897f 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php @@ -114,6 +114,11 @@ enum: ~ # One of "this"; "that" # which should be indented child3: ~ # Example: 'example setting' scalar_prototyped: [] + variable: + + # Examples: + - foo + - bar parameters: # Prototype: Parameter name diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php index 919240f1f7acd..126008831796a 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php @@ -58,6 +58,9 @@ public function getConfigTreeBuilder(): TreeBuilder ->arrayNode('scalar_prototyped') ->prototype('scalar')->end() ->end() + ->variableNode('variable') + ->example(['foo', 'bar']) + ->end() ->arrayNode('parameters') ->useAttributeAsKey('name') ->prototype('scalar')->info('Parameter name')->end() diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php index 670e07d555fd0..0ec2a14f1447a 100644 --- a/src/Symfony/Component/Console/Helper/ProgressBar.php +++ b/src/Symfony/Component/Console/Helper/ProgressBar.php @@ -53,7 +53,6 @@ final class ProgressBar private int $startTime; private int $stepWidth; private float $percent = 0.0; - private int $formatLineCount; private array $messages = []; private bool $overwrite = true; private Terminal $terminal; @@ -438,8 +437,6 @@ private function setRealFormat(string $format) } else { $this->format = $format; } - - $this->formatLineCount = substr_count($this->format, "\n"); } /** @@ -456,7 +453,7 @@ private function overwrite(string $message): void if ($this->overwrite) { if (null !== $this->previousMessage) { if ($this->output instanceof ConsoleSectionOutput) { - $messageLines = explode("\n", $message); + $messageLines = explode("\n", $this->previousMessage); $lineCount = \count($messageLines); foreach ($messageLines as $messageLine) { $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine)); @@ -466,13 +463,11 @@ private function overwrite(string $message): void } $this->output->clear($lineCount); } else { - if ('' !== $this->previousMessage) { - // only clear upper lines when last call was not a clear - for ($i = 0; $i < $this->formatLineCount; ++$i) { - $this->cursor->moveToColumn(1); - $this->cursor->clearLine(); - $this->cursor->moveUp(); - } + $lineCount = substr_count($this->previousMessage, "\n"); + for ($i = 0; $i < $lineCount; ++$i) { + $this->cursor->moveToColumn(1); + $this->cursor->clearLine(); + $this->cursor->moveUp(); } $this->cursor->moveToColumn(1); diff --git a/src/Symfony/Component/Console/LICENSE b/src/Symfony/Component/Console/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Console/LICENSE +++ b/src/Symfony/Component/Console/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php index 17401b887ec5f..c9b9c9d535956 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php @@ -361,8 +361,8 @@ public function testOverwriteWithAnsiSectionOutput() rewind($output->getStream()); $this->assertSame( " \033[44;37m 0/50\033[0m [>---------------------------] 0%".\PHP_EOL. - "\x1b[1A\x1b[0J"." \033[44;37m 1/50\033[0m [>---------------------------] 2%".\PHP_EOL. - "\x1b[1A\x1b[0J"." \033[44;37m 2/50\033[0m [=>--------------------------] 4%".\PHP_EOL, + "\x1b[1A\x1b[0J \033[44;37m 1/50\033[0m [>---------------------------] 2%".\PHP_EOL. + "\x1b[1A\x1b[0J \033[44;37m 2/50\033[0m [=>--------------------------] 4%".\PHP_EOL, stream_get_contents($output->getStream()) ); putenv('COLUMNS=120'); @@ -397,6 +397,28 @@ public function testOverwriteMultipleProgressBarsWithSectionOutputs() ); } + public function testOverwritWithNewlinesInMessage() + { + ProgressBar::setFormatDefinition('test', '%current%/%max% [%bar%] %percent:3s%% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.'); + + $bar = new ProgressBar($output = $this->getOutputStream(), 50, 0); + $bar->setFormat('test'); + $bar->start(); + $bar->display(); + $bar->setMessage("Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.\nBeware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!"); + $bar->advance(); + $bar->setMessage("He took his vorpal sword in hand; Long time the manxome foe he sought— So rested he by the Tumtum tree And stood awhile in thought.\nAnd, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came!"); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + " 0/50 [>] 0% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.\x1b[1G\x1b[2K 1/50 [>] 2% Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. +Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.\x1b[1G\x1b[2K\x1b[1A\x1b[1G\x1b[2K 2/50 [>] 4% He took his vorpal sword in hand; Long time the manxome foe he sought— So rested he by the Tumtum tree And stood awhile in thought. +And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.", + stream_get_contents($output->getStream()) + ); + } + public function testOverwriteWithSectionOutputWithNewlinesInMessage() { $sections = []; @@ -417,7 +439,7 @@ public function testOverwriteWithSectionOutputWithNewlinesInMessage() rewind($output->getStream()); $this->assertEquals( ' 0/50 [>] 0% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.'.\PHP_EOL. - "\x1b[6A\x1b[0J 1/50 [>] 2% Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. + "\x1b[3A\x1b[0J 1/50 [>] 2% Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL. "\x1b[6A\x1b[0J 2/50 [>] 4% He took his vorpal sword in hand; Long time the manxome foe he sought— So rested he by the Tumtum tree And stood awhile in thought. And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL, diff --git a/src/Symfony/Component/CssSelector/LICENSE b/src/Symfony/Component/CssSelector/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/CssSelector/LICENSE +++ b/src/Symfony/Component/CssSelector/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php index 0b2767a8e8088..3c77cf091c6fd 100644 --- a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php +++ b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php @@ -49,22 +49,22 @@ public function __construct() $this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*'; $this->hashPattern = '#((?:'.$this->nmCharPattern.')+)'; $this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)'; - $this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*'; + $this->quotedStringPattern = '([^\n\r\f\\\\%s]|'.$this->stringEscapePattern.')*'; } public function getNewLineEscapePattern(): string { - return '~^'.$this->newLineEscapePattern.'~'; + return '~'.$this->newLineEscapePattern.'~'; } public function getSimpleEscapePattern(): string { - return '~^'.$this->simpleEscapePattern.'~'; + return '~'.$this->simpleEscapePattern.'~'; } public function getUnicodeEscapePattern(): string { - return '~^'.$this->unicodeEscapePattern.'~i'; + return '~'.$this->unicodeEscapePattern.'~i'; } public function getIdentifierPattern(): string diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php index 48a67f5ab6678..77ce5d58258a2 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php @@ -138,6 +138,16 @@ public function getParserTestData() ['div:not(div.foo)', ['Negation[Element[div]:not(Class[Element[div].foo])]']], ['td ~ th', ['CombinedSelector[Element[td] ~ Element[th]]']], ['.foo[data-bar][data-baz=0]', ["Attribute[Attribute[Class[Element[*].foo][data-bar]][data-baz = '0']]"]], + ['div#foo\.bar', ['Hash[Element[div]#foo.bar]']], + ['div.w-1\/3', ['Class[Element[div].w-1/3]']], + ['#test\:colon', ['Hash[Element[*]#test:colon]']], + [".a\xc1b", ["Class[Element[*].a\xc1b]"]], + // unicode escape: \22 == " + ['*[aval="\'\22\'"]', ['Attribute[Element[*][aval = \'\'"\'\']]']], + ['*[aval="\'\22 2\'"]', ['Attribute[Element[*][aval = \'\'"2\'\']]']], + // unicode escape: \20 == (space) + ['*[aval="\'\20 \'"]', ['Attribute[Element[*][aval = \'\' \'\']]']], + ["*[aval=\"'\\20\r\n '\"]", ['Attribute[Element[*][aval = \'\' \'\']]']], ]; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 9fde89d142f9a..35848d11c1b61 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -241,6 +241,10 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a foreach ($parameters as $index => $parameter) { $this->defaultArgument->names[$index] = $parameter->name; + if (\array_key_exists($parameter->name, $arguments)) { + $arguments[$index] = $arguments[$parameter->name]; + unset($arguments[$parameter->name]); + } if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) { continue; } @@ -362,7 +366,7 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a // it's possible index 1 was set, then index 0, then 2, etc // make sure that we re-order so they're injected as expected - ksort($arguments); + ksort($arguments, \SORT_NATURAL); return $arguments; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php index 2efb12b04894c..ed677777b2c24 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php @@ -177,10 +177,17 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed } } + $names = []; + foreach ($reflectionMethod->getParameters() as $key => $parameter) { + $names[$key] = $parameter->name; + if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) { continue; } + if (\array_key_exists($parameter->name, $arguments) && '' !== $arguments[$parameter->name]) { + continue; + } $typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter); $name = Target::parseName($parameter); @@ -210,8 +217,15 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed } } + foreach ($names as $key => $name) { + if (\array_key_exists($name, $arguments) && (0 === $key || \array_key_exists($key - 1, $arguments))) { + $arguments[$key] = $arguments[$name]; + unset($arguments[$name]); + } + } + if ($arguments !== $call[1]) { - ksort($arguments); + ksort($arguments, \SORT_NATURAL); $calls[$i][1] = $arguments; } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php index b4f38b4273479..d2df9a80f8321 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php @@ -43,6 +43,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed foreach ($calls as $i => $call) { [$method, $arguments] = $call; $parameters = null; + $resolvedKeys = []; $resolvedArguments = []; foreach ($arguments as $key => $argument) { @@ -51,6 +52,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed } if (\is_int($key)) { + $resolvedKeys[$key] = $key; $resolvedArguments[$key] = $argument; continue; } @@ -71,9 +73,11 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed if ($key === '$'.$p->name) { if ($p->isVariadic() && \is_array($argument)) { foreach ($argument as $variadicArgument) { + $resolvedKeys[$j] = $j; $resolvedArguments[$j++] = $variadicArgument; } } else { + $resolvedKeys[$j] = $p->name; $resolvedArguments[$j] = $argument; } @@ -91,6 +95,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed $typeFound = false; foreach ($parameters as $j => $p) { if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) { + $resolvedKeys[$j] = $p->name; $resolvedArguments[$j] = $argument; $typeFound = true; } @@ -103,6 +108,12 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed if ($resolvedArguments !== $call[1]) { ksort($resolvedArguments); + + if (!$value->isAutowired() && !array_is_list($resolvedArguments)) { + ksort($resolvedKeys); + $resolvedArguments = array_combine($resolvedKeys, $resolvedArguments); + } + $calls[$i][1] = $resolvedArguments; } } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 849e8a8404d80..a78d7cde66de3 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -1029,6 +1029,10 @@ private function createService(Definition $definition, array &$inlineServices, b return $this->services[$id] ?? $this->privates[$id]; } + if (!array_is_list($arguments)) { + $arguments = array_combine(array_map(function ($k) { return preg_replace('/^.*\\$/', '', $k); }, array_keys($arguments)), $arguments); + } + if (null !== $factory) { $service = $factory(...$arguments); @@ -1042,7 +1046,7 @@ private function createService(Definition $definition, array &$inlineServices, b } else { $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); - $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs(array_values($arguments)); + $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) { trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index d3c8ebdb98873..cbb99a4556bdc 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -32,7 +32,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\ExpressionLanguage; -use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper; +use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; use Symfony\Component\DependencyInjection\Loader\FileLoader; use Symfony\Component\DependencyInjection\Parameter; @@ -90,7 +90,8 @@ class PhpDumper extends Dumper private string $serviceLocatorTag; private array $exportedVariables = []; private string $baseClass; - private ProxyDumper $proxyDumper; + private DumperInterface $proxyDumper; + private bool $hasProxyDumper = false; /** * {@inheritdoc} @@ -107,9 +108,10 @@ public function __construct(ContainerBuilder $container) /** * Sets the dumper to be used when dumping proxies in the generated container. */ - public function setProxyDumper(ProxyDumper $proxyDumper) + public function setProxyDumper(DumperInterface $proxyDumper) { $this->proxyDumper = $proxyDumper; + $this->hasProxyDumper = !$proxyDumper instanceof NullDumper; } /** @@ -167,7 +169,7 @@ public function dump(array $options = []): string|array $this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass); - if ($this->getProxyDumper() instanceof NullDumper) { + if (!$this->hasProxyDumper) { (new AnalyzeServiceReferencesPass(true, false))->process($this->container); try { (new CheckCircularReferencesPass())->process($this->container); @@ -400,14 +402,14 @@ class %s extends {$options['class']} /** * Retrieves the currently set proxy dumper or instantiates one. */ - private function getProxyDumper(): ProxyDumper + private function getProxyDumper(): DumperInterface { return $this->proxyDumper ??= new NullDumper(); } private function analyzeReferences() { - (new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); + (new AnalyzeServiceReferencesPass(false, $this->hasProxyDumper))->process($this->container); $checkedNodes = []; $this->circularReferences = []; $this->singleUsePrivateIds = []; @@ -434,13 +436,13 @@ private function collectCircularReferences(string $sourceId, array $edges, array foreach ($edges as $edge) { $node = $edge->getDestNode(); $id = $node->getId(); - if ($sourceId === $id || !$node->getValue() instanceof Definition || $edge->isLazy() || $edge->isWeak()) { + if ($sourceId === $id || !$node->getValue() instanceof Definition || $edge->isWeak()) { continue; } if (isset($path[$id])) { $loop = null; - $loopByConstructor = $edge->isReferencedByConstructor(); + $loopByConstructor = $edge->isReferencedByConstructor() && !$edge->isLazy(); $pathInLoop = [$id, []]; foreach ($path as $k => $pathByConstructor) { if (null !== $loop) { @@ -454,7 +456,7 @@ private function collectCircularReferences(string $sourceId, array $edges, array } $this->addCircularReferences($id, $loop, $loopByConstructor); } elseif (!isset($checkedNodes[$id])) { - $this->collectCircularReferences($id, $node->getOutEdges(), $checkedNodes, $loops, $path, $edge->isReferencedByConstructor()); + $this->collectCircularReferences($id, $node->getOutEdges(), $checkedNodes, $loops, $path, $edge->isReferencedByConstructor() && !$edge->isLazy()); } elseif (isset($loops[$id])) { // we already had detected loops for this edge // let's check if we have a common ancestor in one of the detected loops @@ -475,7 +477,7 @@ private function collectCircularReferences(string $sourceId, array $edges, array // we can now build the loop $loop = null; - $loopByConstructor = $edge->isReferencedByConstructor(); + $loopByConstructor = $edge->isReferencedByConstructor() && !$edge->isLazy(); foreach ($fillPath as $k => $pathByConstructor) { if (null !== $loop) { $loop[] = $k; @@ -484,7 +486,7 @@ private function collectCircularReferences(string $sourceId, array $edges, array $loop = []; } } - $this->addCircularReferences($first, $loop, true); + $this->addCircularReferences($first, $loop, $loopByConstructor); break; } } @@ -741,7 +743,7 @@ private function addServiceMethodCalls(Definition $definition, string $variableN $witherAssignation = ''; if ($call[2] ?? false) { - if (null !== $sharedNonLazyId && $lastWitherIndex === $k) { + if (null !== $sharedNonLazyId && $lastWitherIndex === $k && 'instance' === $variableName) { $witherAssignation = sprintf('$this->%s[\'%s\'] = ', $definition->isPublic() ? 'services' : 'privates', $sharedNonLazyId); } $witherAssignation .= sprintf('$%s = ', $variableName); @@ -975,7 +977,7 @@ private function addInlineReference(string $id, Definition $definition, string $ return ''; } - $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && !isset($this->definitionVariables[$definition]); + $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && !isset($this->definitionVariables[$definition]) && !($this->hasProxyDumper && $definition->isLazy()); if ($hasSelfRef && !$forConstructor && !$forConstructor = !$this->circularReferences[$id][$targetId]) { $code = $this->addInlineService($id, $definition, $definition); @@ -1018,7 +1020,7 @@ private function addInlineService(string $id, Definition $definition, Definition if ($isSimpleInstance = $isRootInstance = null === $inlineDef) { foreach ($this->serviceCalls as $targetId => [$callCount, $behavior, $byConstructor]) { - if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId]) { + if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId] && !($this->hasProxyDumper && $definition->isLazy())) { $code .= $this->addInlineReference($id, $definition, $targetId, $forConstructor); } } diff --git a/src/Symfony/Component/DependencyInjection/LICENSE b/src/Symfony/Component/DependencyInjection/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/DependencyInjection/LICENSE +++ b/src/Symfony/Component/DependencyInjection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index 5371e338639c3..c0c097017b9f3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -1162,6 +1162,21 @@ public function testDecorationWithServiceAndAliasedInterface() static::assertInstanceOf(DecoratedDecorator::class, $container->get(DecoratorImpl::class)); } + public function testAutowireWithNamedArgs() + { + $container = new ContainerBuilder(); + + $container->register('foo', MultipleArgumentsOptionalScalar::class) + ->setArguments(['foo' => 'abc']) + ->setAutowired(true) + ->setPublic(true); + $container->register(A::class, A::class); + + (new AutowirePass())->process($container); + + $this->assertEquals([new TypedReference(A::class, A::class), 'abc'], $container->getDefinition('foo')->getArguments()); + } + public function testAutowireAttribute() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php index d6e9b344da349..497acee2f779c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveBindingsPassTest.php @@ -243,4 +243,24 @@ public function testBindWithTarget() $this->assertSame('bar', (string) $container->getDefinition('with_target')->getArgument(0)); } + + public function testBindWithNamedArgs() + { + $container = new ContainerBuilder(); + + $bindings = [ + '$apiKey' => new BoundArgument('K'), + ]; + + $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); + $definition->setArguments(['c' => 'C', 'hostName' => 'H']); + $definition->setBindings($bindings); + + $container->register('foo', CaseSensitiveClass::class); + + $pass = new ResolveBindingsPass(); + $pass->process($container); + + $this->assertEquals(['C', 'K', 'H'], $definition->getArguments()); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php index 4e9973bb30e9c..2c28949486f24 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveNamedArgumentsPassTest.php @@ -165,7 +165,7 @@ public function testInterfaceTypedArgument() $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertSame($expected, $definition->getArgument(3)); + $this->assertSame($expected, $definition->getArgument('container')); } public function testResolvesMultipleArgumentsOfTheSameType() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php index 08ff5c797e185..3563a313814db 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -51,7 +51,7 @@ public function testIsFresh(callable $mockContainer, $expected) $this->assertSame($expected, $this->resourceChecker->isFresh($this->resource, time())); } - public function isFreshProvider() + public static function isFreshProvider() { yield 'not fresh on missing parameter' => [function (MockObject $container) { $container->method('hasParameter')->with('locales')->willReturn(false); @@ -62,11 +62,11 @@ public function isFreshProvider() }, false]; yield 'fresh on every identical parameters' => [function (MockObject $container) { - $container->expects($this->exactly(2))->method('hasParameter')->willReturn(true); - $container->expects($this->exactly(2))->method('getParameter') + $container->expects(self::exactly(2))->method('hasParameter')->willReturn(true); + $container->expects(self::exactly(2))->method('getParameter') ->withConsecutive( - [$this->equalTo('locales')], - [$this->equalTo('default_locale')] + [self::equalTo('locales')], + [self::equalTo('default_locale')] ) ->willReturnMap([ ['locales', ['fr', 'en']], diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 8da51e30a616c..bc7b07be2f9e8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1762,6 +1762,33 @@ public function testFindTags() $this->assertSame(['tag1', 'tag2', 'tag3'], $container->findTags()); } + + public function testNamedArgumentAfterCompile() + { + $container = new ContainerBuilder(); + $container->register(E::class) + ->setPublic(true) + ->setArguments(['$second' => 2]); + + $container->compile(); + + $e = $container->get(E::class); + + $this->assertSame('', $e->first); + $this->assertSame(2, $e->second); + } + + public function testNamedArgumentBeforeCompile() + { + $container = new ContainerBuilder(); + $container->register(E::class, E::class) + ->setPublic(true) + ->setArguments(['$first' => 1]); + + $e = $container->get(E::class); + + $this->assertSame(1, $e->first); + } } class FooClass @@ -1790,3 +1817,15 @@ class C implements X class D implements X { } + +class E +{ + public $first; + public $second; + + public function __construct($first = '', $second = '') + { + $this->first = $first; + $this->second = $second; + } +} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 1ce97fc4d8990..2483dfb0f16f5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -1404,7 +1404,8 @@ public function testAliasCanBeFoundInTheDumpedContainerWhenBothTheAliasAndTheSer public function testWither() { $container = new ContainerBuilder(); - $container->register(Foo::class); + $container->register(Foo::class) + ->setAutowired(true); $container ->register('wither', Wither::class) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php index 4c81725bc824f..87f5ab65a1277 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php @@ -13,6 +13,13 @@ class Foo { + /** + * @required + */ + public function cloneFoo(): static + { + return clone $this; + } } class Bar diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php index 651ab180577ea..bf83db6dc1f84 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php @@ -419,17 +419,16 @@ protected function getMonologInline_LoggerService() */ protected function getPAService() { - $a = new \stdClass(); - - $b = ($this->privates['pC'] ?? $this->getPCService()); + $a = ($this->privates['pC'] ?? $this->getPCService()); if (isset($this->services['pA'])) { return $this->services['pA']; } + $b = new \stdClass(); - $this->services['pA'] = $instance = new \stdClass($a, $b); + $this->services['pA'] = $instance = new \stdClass($b, $a); - $a->d = ($this->privates['pD'] ?? $this->getPDService()); + $b->d = ($this->privates['pD'] ?? $this->getPDService()); return $instance; } @@ -489,7 +488,13 @@ protected function getBar6Service() */ protected function getDoctrine_ListenerService() { - return $this->privates['doctrine.listener'] = new \stdClass(($this->services['doctrine.entity_manager'] ?? $this->getDoctrine_EntityManagerService())); + $a = ($this->services['doctrine.entity_manager'] ?? $this->getDoctrine_EntityManagerService()); + + if (isset($this->privates['doctrine.listener'])) { + return $this->privates['doctrine.listener']; + } + + return $this->privates['doctrine.listener'] = new \stdClass($a); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php index 57df70800e11a..bf1cd8b1dd661 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php @@ -283,11 +283,16 @@ protected function getDoctrine_EntityListenerResolverService() */ protected function getDoctrine_EntityManagerService() { - $a = new \stdClass(); - $a->resolver = ($this->services['doctrine.entity_listener_resolver'] ?? $this->getDoctrine_EntityListenerResolverService()); - $a->flag = 'ok'; + $a = ($this->services['doctrine.entity_listener_resolver'] ?? $this->getDoctrine_EntityListenerResolverService()); + + if (isset($this->services['doctrine.entity_manager'])) { + return $this->services['doctrine.entity_manager']; + } + $b = new \stdClass(); + $b->resolver = $a; + $b->flag = 'ok'; - return $this->services['doctrine.entity_manager'] = \FactoryChecker::create($a); + return $this->services['doctrine.entity_manager'] = \FactoryChecker::create($b); } /** @@ -297,7 +302,13 @@ protected function getDoctrine_EntityManagerService() */ protected function getDoctrine_ListenerService() { - return $this->services['doctrine.listener'] = new \stdClass(($this->services['doctrine.entity_manager'] ?? $this->getDoctrine_EntityManagerService())); + $a = ($this->services['doctrine.entity_manager'] ?? $this->getDoctrine_EntityManagerService()); + + if (isset($this->services['doctrine.listener'])) { + return $this->services['doctrine.listener']; + } + + return $this->services['doctrine.listener'] = new \stdClass($a); } /** @@ -493,7 +504,13 @@ protected function getLoggerService() */ protected function getMailer_TransportService() { - return $this->services['mailer.transport'] = ($this->services['mailer.transport_factory'] ?? $this->getMailer_TransportFactoryService())->create(); + $a = ($this->services['mailer.transport_factory'] ?? $this->getMailer_TransportFactoryService()); + + if (isset($this->services['mailer.transport'])) { + return $this->services['mailer.transport']; + } + + return $this->services['mailer.transport'] = $a->create(); } /** @@ -516,7 +533,13 @@ protected function getMailer_TransportFactoryService() */ protected function getMailer_TransportFactory_AmazonService() { - return $this->services['mailer.transport_factory.amazon'] = new \stdClass(($this->services['monolog.logger_2'] ?? $this->getMonolog_Logger2Service())); + $a = ($this->services['monolog.logger_2'] ?? $this->getMonolog_Logger2Service()); + + if (isset($this->services['mailer.transport_factory.amazon'])) { + return $this->services['mailer.transport_factory.amazon']; + } + + return $this->services['mailer.transport_factory.amazon'] = new \stdClass($a); } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_wither.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_wither.php index 869e6af975d10..7d9a32a567538 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_wither.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_wither.php @@ -53,6 +53,7 @@ protected function getWitherService() $instance = new \Symfony\Component\DependencyInjection\Tests\Compiler\Wither(); $a = new \Symfony\Component\DependencyInjection\Tests\Compiler\Foo(); + $a = $a->cloneFoo(); $instance = $instance->withFoo1($a); $this->services['wither'] = $instance = $instance->withFoo2($a); diff --git a/src/Symfony/Component/DomCrawler/LICENSE b/src/Symfony/Component/DomCrawler/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/DomCrawler/LICENSE +++ b/src/Symfony/Component/DomCrawler/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php index 737d682207628..0fbd9196ff556 100644 --- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php @@ -19,7 +19,7 @@ abstract class AbstractCrawlerTest extends TestCase { - abstract public function getDoctype(): string; + abstract public static function getDoctype(): string; protected function createCrawler($node = null, string $uri = null, string $baseHref = null) { diff --git a/src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php index 374c3ca9493df..05a1e79b7fcbf 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php @@ -13,7 +13,7 @@ class Html5ParserCrawlerTest extends AbstractCrawlerTest { - public function getDoctype(): string + public static function getDoctype(): string { return ''; } @@ -48,7 +48,7 @@ public function testHtml5ParserWithInvalidHeadedContent(string $content) public function validHtml5Provider(): iterable { - $html = $this->getDoctype().'

Foo

'; + $html = static::getDoctype().'

Foo

'; $BOM = \chr(0xEF).\chr(0xBB).\chr(0xBF); yield 'BOM first' => [$BOM.$html]; @@ -56,12 +56,12 @@ public function validHtml5Provider(): iterable yield 'Multiline comment' => ["".$html]; yield 'Several comments' => [' '.$html]; yield 'Whitespaces' => [' '.$html]; - yield 'All together' => [$BOM.' '.''.$html]; + yield 'All together' => [$BOM.' '.$html]; } public function invalidHtml5Provider(): iterable { - $html = $this->getDoctype().'

Foo

'; + $html = static::getDoctype().'

Foo

'; yield 'Text' => ['hello world'.$html]; yield 'Text between comments' => [' test '.$html]; diff --git a/src/Symfony/Component/DomCrawler/Tests/NativeParserCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/NativeParserCrawlerTest.php index a17562f735580..c0cac9e8b603f 100644 --- a/src/Symfony/Component/DomCrawler/Tests/NativeParserCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/NativeParserCrawlerTest.php @@ -13,7 +13,7 @@ class NativeParserCrawlerTest extends AbstractCrawlerTest { - public function getDoctype(): string + public static function getDoctype(): string { return ''; } diff --git a/src/Symfony/Component/Dotenv/LICENSE b/src/Symfony/Component/Dotenv/LICENSE index 7fa9539054928..f2345234aa9ea 100644 --- a/src/Symfony/Component/Dotenv/LICENSE +++ b/src/Symfony/Component/Dotenv/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2022 Fabien Potencier +Copyright (c) 2016-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/ErrorHandler/LICENSE b/src/Symfony/Component/ErrorHandler/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/ErrorHandler/LICENSE +++ b/src/Symfony/Component/ErrorHandler/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/EventDispatcher/LICENSE b/src/Symfony/Component/EventDispatcher/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/EventDispatcher/LICENSE +++ b/src/Symfony/Component/EventDispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/ExpressionLanguage/LICENSE b/src/Symfony/Component/ExpressionLanguage/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/ExpressionLanguage/LICENSE +++ b/src/Symfony/Component/ExpressionLanguage/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 2c66d52927e58..32d7497c7a9c1 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -121,8 +121,19 @@ public function testParseThrowsInsteadOfNotice() public function shortCircuitProviderEvaluate() { - $object = $this->getMockBuilder(\stdClass::class)->setMethods(['foo'])->getMock(); - $object->expects($this->never())->method('foo'); + $object = new class(\Closure::fromCallable([static::class, 'fail'])) { + private $fail; + + public function __construct(callable $fail) + { + $this->fail = $fail; + } + + public function foo() + { + ($this->fail)(); + } + }; return [ ['false and object.foo()', ['object' => $object], false], diff --git a/src/Symfony/Component/Filesystem/LICENSE b/src/Symfony/Component/Filesystem/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Filesystem/LICENSE +++ b/src/Symfony/Component/Filesystem/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Filesystem/Tests/PathTest.php b/src/Symfony/Component/Filesystem/Tests/PathTest.php index 2f04c790c396a..3d0f2beb11087 100644 --- a/src/Symfony/Component/Filesystem/Tests/PathTest.php +++ b/src/Symfony/Component/Filesystem/Tests/PathTest.php @@ -458,11 +458,30 @@ public function providePathTests(): \Generator yield ['..', '/webmozart/symfony', '/webmozart']; } + private static function getPathTests(): \Generator + { + yield from [ + // relative to absolute path + ['css/style.css', '/webmozart/symfony', '/webmozart/symfony/css/style.css'], + ['../css/style.css', '/webmozart/symfony', '/webmozart/css/style.css'], + ['../../css/style.css', '/webmozart/symfony', '/css/style.css'], + + // relative to root + ['css/style.css', '/', '/css/style.css'], + ['css/style.css', 'C:', 'C:/css/style.css'], + ['css/style.css', 'C:/', 'C:/css/style.css'], + + // same sub directories in different base directories + ['../../symfony/css/style.css', '/webmozart/css', '/symfony/css/style.css'], + + ['', '/webmozart/symfony', '/webmozart/symfony'], + ['..', '/webmozart/symfony', '/webmozart'], + ]; + } + public function provideMakeAbsoluteTests(): \Generator { - foreach ($this->providePathTests() as $set) { - yield $set; - } + yield from static::getPathTests(); // collapse dots yield ['css/./style.css', '/webmozart/symfony', '/webmozart/symfony/css/style.css']; @@ -589,7 +608,7 @@ public function testMakeAbsoluteDoesNotFailIfDifferentRoot(string $basePath, str public function provideMakeRelativeTests(): \Generator { - foreach ($this->providePathTests() as $set) { + foreach (static::getPathTests() as $set) { yield [$set[2], $set[1], $set[0]]; } diff --git a/src/Symfony/Component/Finder/LICENSE b/src/Symfony/Component/Finder/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Finder/LICENSE +++ b/src/Symfony/Component/Finder/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Finder/Tests/GitignoreTest.php b/src/Symfony/Component/Finder/Tests/GitignoreTest.php index 63f3b76cd5f75..65b52057937b9 100644 --- a/src/Symfony/Component/Finder/Tests/GitignoreTest.php +++ b/src/Symfony/Component/Finder/Tests/GitignoreTest.php @@ -55,7 +55,7 @@ public function testToRegex(array $gitignoreLines, array $matchingCases, array $ } } - public function provider(): array + public static function provider(): array { $cases = [ [ @@ -394,7 +394,7 @@ public function provider(): array public function providerExtended(): array { - $basicCases = $this->provider(); + $basicCases = self::provider(); $cases = []; foreach ($basicCases as $case) { diff --git a/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php index b2a5303b58d30..a66e50287e74f 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php @@ -93,11 +93,11 @@ public function getAcceptData() ]; return [ - [0, 0, $this->toAbsolute($lessThan1)], - [0, 1, $this->toAbsolute($lessThanOrEqualTo1)], + [0, 0, static::toAbsolute($lessThan1)], + [0, 1, static::toAbsolute($lessThanOrEqualTo1)], [2, \PHP_INT_MAX, []], - [1, \PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)], - [1, 1, $this->toAbsolute($equalTo1)], + [1, \PHP_INT_MAX, static::toAbsolute($graterThanOrEqualTo1)], + [1, 1, static::toAbsolute($equalTo1)], ]; } } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php index 1729766fe4bd0..572029a17f8fa 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php @@ -99,9 +99,9 @@ public function getAcceptData() ]; return [ - [['foo'], $this->toAbsolute($foo)], - [['fo'], $this->toAbsolute($fo)], - [['toto/'], $this->toAbsolute($toto)], + [['foo'], static::toAbsolute($foo)], + [['fo'], static::toAbsolute($fo)], + [['toto/'], static::toAbsolute($toto)], ]; } } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php index e15c03521af90..be7beb1d146ad 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php @@ -57,8 +57,8 @@ public function getAcceptData() ]; return [ - [FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)], - [FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)], + [FileTypeFilterIterator::ONLY_FILES, static::toAbsolute($onlyFiles)], + [FileTypeFilterIterator::ONLY_DIRECTORIES, static::toAbsolute($onlyDirectories)], ]; } } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php index 129d565d55b8c..25a6b8a2d75a2 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php @@ -41,7 +41,7 @@ public function getAcceptData() ]; return [ - [[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], $this->toAbsolute($lessThan1KGreaterThan05K)], + [[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], self::toAbsolute($lessThan1KGreaterThan05K)], ]; } } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php index 098cd75674f3f..049961452b183 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php @@ -247,13 +247,13 @@ public function getAcceptData() ]; return [ - [SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)], - [SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)], - [SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)], - [SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)], - [SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)], - [SortableIterator::SORT_BY_NAME_NATURAL, $this->toAbsolute($sortByNameNatural)], - [function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)], + [SortableIterator::SORT_BY_NAME, static::toAbsolute($sortByName)], + [SortableIterator::SORT_BY_TYPE, static::toAbsolute($sortByType)], + [SortableIterator::SORT_BY_ACCESSED_TIME, static::toAbsolute($sortByAccessedTime)], + [SortableIterator::SORT_BY_CHANGED_TIME, static::toAbsolute($sortByChangedTime)], + [SortableIterator::SORT_BY_MODIFIED_TIME, static::toAbsolute($sortByModifiedTime)], + [SortableIterator::SORT_BY_NAME_NATURAL, static::toAbsolute($sortByNameNatural)], + [function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, static::toAbsolute($customComparison)], ]; } } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php index 4ac58bd2acd05..55efb652daec7 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractRendererEngine; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -70,8 +71,16 @@ public function buildView(FormView $view, FormInterface $form, array $options) if (!$labelFormat) { $labelFormat = $view->parent->vars['label_format']; } + + $rootFormAttrOption = $form->getRoot()->getConfig()->getOption('form_attr'); + if ($options['form_attr'] || $rootFormAttrOption) { + $options['attr']['form'] = \is_string($rootFormAttrOption) ? $rootFormAttrOption : $form->getRoot()->getName(); + if (empty($options['attr']['form'])) { + throw new LogicException('"form_attr" option must be a string identifier on root form when it has no id.'); + } + } } else { - $id = $name; + $id = \is_string($options['form_attr']) ? $options['form_attr'] : $name; $fullName = $name; $uniqueBlockPrefix = '_'.$blockName; @@ -137,6 +146,7 @@ public function configureOptions(OptionsResolver $resolver) 'translation_domain' => null, 'auto_initialize' => true, 'priority' => 0, + 'form_attr' => false, ]); $resolver->setAllowedTypes('block_prefix', ['null', 'string']); @@ -144,6 +154,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('row_attr', 'array'); $resolver->setAllowedTypes('label_html', 'bool'); $resolver->setAllowedTypes('priority', 'int'); + $resolver->setAllowedTypes('form_attr', ['bool', 'string']); $resolver->setInfo('priority', 'The form rendering priority (higher priorities will be rendered first)'); } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index b2ad2062363f9..a14f9b13f7f03 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -90,16 +90,6 @@ public function buildView(FormView $view, FormInterface $form, array $options) } $helpTranslationParameters = array_merge($view->parent->vars['help_translation_parameters'], $helpTranslationParameters); - - $rootFormAttrOption = $form->getRoot()->getConfig()->getOption('form_attr'); - if ($options['form_attr'] || $rootFormAttrOption) { - $view->vars['attr']['form'] = \is_string($rootFormAttrOption) ? $rootFormAttrOption : $form->getRoot()->getName(); - if (empty($view->vars['attr']['form'])) { - throw new LogicException('"form_attr" option must be a string identifier on root form when it has no id.'); - } - } - } elseif (\is_string($options['form_attr'])) { - $view->vars['id'] = $options['form_attr']; } $formConfig = $form->getConfig(); @@ -214,7 +204,6 @@ public function configureOptions(OptionsResolver $resolver) 'is_empty_callback' => null, 'getter' => null, 'setter' => null, - 'form_attr' => false, ]); $resolver->setAllowedTypes('label_attr', 'array'); @@ -226,7 +215,6 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('is_empty_callback', ['null', 'callable']); $resolver->setAllowedTypes('getter', ['null', 'callable']); $resolver->setAllowedTypes('setter', ['null', 'callable']); - $resolver->setAllowedTypes('form_attr', ['bool', 'string']); $resolver->setInfo('getter', 'A callable that accepts two arguments (the view data and the current form field) and must return a value.'); $resolver->setInfo('setter', 'A callable that accepts three arguments (a reference to the view data, the submitted value and the current form field).'); diff --git a/src/Symfony/Component/Form/LICENSE b/src/Symfony/Component/Form/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Form/LICENSE +++ b/src/Symfony/Component/Form/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php index 61b8dc379148a..1d33451d45293 100644 --- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php @@ -65,7 +65,7 @@ public function getNormalizedIniPostMaxSize(): string $this->request = null; } - public function methodExceptGetProvider() + public static function methodExceptGetProvider() { return [ ['POST'], @@ -79,7 +79,7 @@ public function methodProvider() { return array_merge([ ['GET'], - ], $this->methodExceptGetProvider()); + ], self::methodExceptGetProvider()); } /** diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php index 6a4c8552befed..bb2d75b2f3974 100644 --- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php @@ -206,7 +206,7 @@ public function provideCompletionSuggestions(): iterable yield 'form_type' => [ [''], - $this->getCoreTypes(), + self::getCoreTypes(), ]; yield 'option for FQCN' => [ @@ -225,6 +225,7 @@ public function provideCompletionSuggestions(): iterable 'translation_domain', 'auto_initialize', 'priority', + 'form_attr', ], ]; @@ -244,6 +245,7 @@ public function provideCompletionSuggestions(): iterable 'translation_domain', 'auto_initialize', 'priority', + 'form_attr', ], ]; @@ -258,7 +260,7 @@ public function provideCompletionSuggestions(): iterable ]; } - private function getCoreTypes(): array + private static function getCoreTypes(): array { $coreExtension = new CoreExtension(); $loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes'); diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php index af94dd7e32487..6c73abe370d7e 100644 --- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php +++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php @@ -285,15 +285,15 @@ public function privateTaggedServicesProvider() function (ContainerBuilder $container) { $formTypes = $container->getDefinition('form.extension')->getArgument(0); - $this->assertInstanceOf(Reference::class, $formTypes); + self::assertInstanceOf(Reference::class, $formTypes); $locator = $container->getDefinition((string) $formTypes); $expectedLocatorMap = [ 'stdClass' => new ServiceClosureArgument(new Reference('my.type')), ]; - $this->assertInstanceOf(Definition::class, $locator); - $this->assertEquals($expectedLocatorMap, $locator->getArgument(0)); + self::assertInstanceOf(Definition::class, $locator); + self::assertEquals($expectedLocatorMap, $locator->getArgument(0)); }, ], [ @@ -301,7 +301,7 @@ function (ContainerBuilder $container) { Type1TypeExtension::class, 'form.type_extension', function (ContainerBuilder $container) { - $this->assertEquals( + self::assertEquals( ['Symfony\Component\Form\Extension\Core\Type\FormType' => new IteratorArgument([new Reference('my.type_extension')])], $container->getDefinition('form.extension')->getArgument(1) ); @@ -309,7 +309,7 @@ function (ContainerBuilder $container) { ['extended_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType'], ], ['my.guesser', 'stdClass', 'form.type_guesser', function (ContainerBuilder $container) { - $this->assertEquals(new IteratorArgument([new Reference('my.guesser')]), $container->getDefinition('form.extension')->getArgument(2)); + self::assertEquals(new IteratorArgument([new Reference('my.guesser')]), $container->getDefinition('form.extension')->getArgument(2)); }], ]; } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index eccaa22a136f3..0412dc321a0f6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -37,7 +37,7 @@ protected function tearDown(): void $this->dateTimeWithoutSeconds = null; } - public function allProvider() + public static function allProvider() { return [ ['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'], @@ -51,12 +51,12 @@ public function allProvider() public function transformProvider() { - return $this->allProvider(); + return self::allProvider(); } public function reverseTransformProvider() { - return array_merge($this->allProvider(), [ + return array_merge(self::allProvider(), [ // format without seconds, as appears in some browsers ['UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'], ['America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php index 654e04649e9f1..dcff028026482 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php @@ -13,6 +13,8 @@ use Symfony\Component\Form\Button; use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\Type\FormType; /** * @author Bernhard Schussek @@ -36,4 +38,65 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $this->expectExceptionMessage('Buttons do not support empty data.'); parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData); } + + public function testFormAttrOnRoot() + { + $view = $this->factory + ->createNamedBuilder('parent', FormType::class, null, [ + 'form_attr' => true, + ]) + ->add('child1', $this->getTestedType()) + ->add('child2', $this->getTestedType()) + ->getForm() + ->createView(); + $this->assertArrayNotHasKey('form', $view->vars['attr']); + $this->assertSame($view->vars['id'], $view['child1']->vars['attr']['form']); + $this->assertSame($view->vars['id'], $view['child2']->vars['attr']['form']); + } + + public function testFormAttrOnChild() + { + $view = $this->factory + ->createNamedBuilder('parent') + ->add('child1', $this->getTestedType(), [ + 'form_attr' => true, + ]) + ->add('child2', $this->getTestedType()) + ->getForm() + ->createView(); + $this->assertArrayNotHasKey('form', $view->vars['attr']); + $this->assertSame($view->vars['id'], $view['child1']->vars['attr']['form']); + $this->assertArrayNotHasKey('form', $view['child2']->vars['attr']); + } + + public function testFormAttrAsBoolWithNoId() + { + $this->expectException(LogicException::class); + $this->expectErrorMessage('form_attr'); + $this->factory + ->createNamedBuilder('', FormType::class, null, [ + 'form_attr' => true, + ]) + ->add('child1', $this->getTestedType()) + ->add('child2', $this->getTestedType()) + ->getForm() + ->createView(); + } + + public function testFormAttrAsStringWithNoId() + { + $stringId = 'custom-identifier'; + $view = $this->factory + ->createNamedBuilder('', FormType::class, null, [ + 'form_attr' => $stringId, + ]) + ->add('child1', $this->getTestedType()) + ->add('child2', $this->getTestedType()) + ->getForm() + ->createView(); + $this->assertArrayNotHasKey('form', $view->vars['attr']); + $this->assertSame($stringId, $view->vars['id']); + $this->assertSame($view->vars['id'], $view['child1']->vars['attr']['form']); + $this->assertSame($view->vars['id'], $view['child2']->vars['attr']['form']); + } } diff --git a/src/Symfony/Component/HtmlSanitizer/LICENSE b/src/Symfony/Component/HtmlSanitizer/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/HtmlSanitizer/LICENSE +++ b/src/Symfony/Component/HtmlSanitizer/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index e963a08212de2..fee4589ca3a71 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -199,8 +199,14 @@ public function request(string $method, string $url, array $options = []): Respo if (\extension_loaded('zlib') && !isset($options['normalized_headers']['accept-encoding'])) { $options['headers'][] = 'Accept-Encoding: gzip'; // Expose only one encoding, some servers mess up when more are provided } + $body = $options['body']; - foreach ($options['headers'] as $header) { + foreach ($options['headers'] as $i => $header) { + if (\is_string($body) && '' !== $body && 0 === stripos($header, 'Content-Length: ')) { + // Let curl handle Content-Length headers + unset($options['headers'][$i]); + continue; + } if (':' === $header[-2] && \strlen($header) - 2 === strpos($header, ': ')) { // curl requires a special syntax to send empty headers $curlopts[\CURLOPT_HTTPHEADER][] = substr_replace($header, ';', -2); @@ -216,7 +222,7 @@ public function request(string $method, string $url, array $options = []): Respo } } - if (!\is_string($body = $options['body'])) { + if (!\is_string($body)) { if (\is_resource($body)) { $curlopts[\CURLOPT_INFILE] = $body; } else { @@ -228,15 +234,16 @@ public function request(string $method, string $url, array $options = []): Respo } if (isset($options['normalized_headers']['content-length'][0])) { - $curlopts[\CURLOPT_INFILESIZE] = substr($options['normalized_headers']['content-length'][0], \strlen('Content-Length: ')); - } elseif (!isset($options['normalized_headers']['transfer-encoding'])) { - $curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding: chunked'; // Enable chunked request bodies + $curlopts[\CURLOPT_INFILESIZE] = (int) substr($options['normalized_headers']['content-length'][0], \strlen('Content-Length: ')); + } + if (!isset($options['normalized_headers']['transfer-encoding'])) { + $curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding:'.(isset($curlopts[\CURLOPT_INFILESIZE]) ? '' : ' chunked'); } if ('POST' !== $method) { $curlopts[\CURLOPT_UPLOAD] = true; - if (!isset($options['normalized_headers']['content-type'])) { + if (!isset($options['normalized_headers']['content-type']) && 0 !== ($curlopts[\CURLOPT_INFILESIZE] ?? null)) { $curlopts[\CURLOPT_HTTPHEADER][] = 'Content-Type: application/x-www-form-urlencoded'; } } diff --git a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php index de7251b004461..4a93d018a18e6 100644 --- a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php +++ b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php @@ -41,24 +41,29 @@ public function registerClient(string $name, TraceableHttpClient $client) */ public function collect(Request $request, Response $response, \Throwable $exception = null) { - $this->reset(); + $this->lateCollect(); + } + + public function lateCollect() + { + $this->data['request_count'] = 0; + $this->data['error_count'] = 0; + $this->data += ['clients' => []]; foreach ($this->clients as $name => $client) { [$errorCount, $traces] = $this->collectOnClient($client); - $this->data['clients'][$name] = [ - 'traces' => $traces, - 'error_count' => $errorCount, + $this->data['clients'] += [ + $name => [ + 'traces' => [], + 'error_count' => 0, + ], ]; + $this->data['clients'][$name]['traces'] = array_merge($this->data['clients'][$name]['traces'], $traces); $this->data['request_count'] += \count($traces); - $this->data['error_count'] += $errorCount; - } - } + $this->data['error_count'] += $this->data['clients'][$name]['error_count'] += $errorCount; - public function lateCollect() - { - foreach ($this->clients as $client) { $client->reset(); } } diff --git a/src/Symfony/Component/HttpClient/LICENSE b/src/Symfony/Component/HttpClient/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/HttpClient/LICENSE +++ b/src/Symfony/Component/HttpClient/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php b/src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php index 46a1177befeaa..f84c043fdcc80 100755 --- a/src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php +++ b/src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php @@ -15,8 +15,6 @@ use Symfony\Component\HttpClient\DataCollector\HttpClientDataCollector; use Symfony\Component\HttpClient\NativeHttpClient; use Symfony\Component\HttpClient\TraceableHttpClient; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\HttpClient\Test\TestHttpServer; class HttpClientDataCollectorTest extends TestCase @@ -50,7 +48,7 @@ public function testItCollectsRequestCount() $sut->registerClient('http_client2', $httpClient2); $sut->registerClient('http_client3', $httpClient3); $this->assertEquals(0, $sut->getRequestCount()); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $this->assertEquals(3, $sut->getRequestCount()); } @@ -79,7 +77,7 @@ public function testItCollectsErrorCount() $sut->registerClient('http_client2', $httpClient2); $sut->registerClient('http_client3', $httpClient3); $this->assertEquals(0, $sut->getErrorCount()); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $this->assertEquals(1, $sut->getErrorCount()); } @@ -108,7 +106,7 @@ public function testItCollectsErrorCountByClient() $sut->registerClient('http_client2', $httpClient2); $sut->registerClient('http_client3', $httpClient3); $this->assertEquals([], $sut->getClients()); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); $this->assertEquals(0, $collectedData['http_client1']['error_count']); $this->assertEquals(1, $collectedData['http_client2']['error_count']); @@ -140,7 +138,7 @@ public function testItCollectsTracesByClient() $sut->registerClient('http_client2', $httpClient2); $sut->registerClient('http_client3', $httpClient3); $this->assertEquals([], $sut->getClients()); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); $this->assertCount(2, $collectedData['http_client1']['traces']); $this->assertCount(1, $collectedData['http_client2']['traces']); @@ -157,7 +155,7 @@ public function testItIsEmptyAfterReset() ]); $sut = new HttpClientDataCollector(); $sut->registerClient('http_client1', $httpClient1); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); $this->assertCount(1, $collectedData['http_client1']['traces']); $sut->reset(); @@ -174,7 +172,7 @@ public function testItGeneratesCurlCommandsAsExpected(array $request, string $ex { $sut = new HttpClientDataCollector(); $sut->registerClient('http_client', $this->httpClientThatHasTracedRequests([$request])); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); self::assertCount(1, $collectedData['http_client']['traces']); $curlCommand = $collectedData['http_client']['traces'][0]['curlCommand']; @@ -358,7 +356,7 @@ public function testItDoesNotFollowRedirectionsWhenGeneratingCurlCommands() ], ], ])); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); self::assertCount(1, $collectedData['http_client']['traces']); $curlCommand = $collectedData['http_client']['traces'][0]['curlCommand']; @@ -388,7 +386,7 @@ public function testItDoesNotGeneratesCurlCommandsForUnsupportedBodyType() ], ], ])); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); self::assertCount(1, $collectedData['http_client']['traces']); $curlCommand = $collectedData['http_client']['traces'][0]['curlCommand']; @@ -410,7 +408,7 @@ public function testItDoesNotGeneratesCurlCommandsForNotEncodableBody() ], ], ])); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); self::assertCount(1, $collectedData['http_client']['traces']); $curlCommand = $collectedData['http_client']['traces'][0]['curlCommand']; @@ -432,7 +430,7 @@ public function testItDoesNotGeneratesCurlCommandsForTooBigData() ], ], ])); - $sut->collect(new Request(), new Response()); + $sut->lateCollect(); $collectedData = $sut->getClients(); self::assertCount(1, $collectedData['http_client']['traces']); $curlCommand = $collectedData['http_client']['traces'][0]['curlCommand']; diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index 746720ea78ea2..8f78d1b1d629a 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -72,7 +72,7 @@ public static function checkIp4(string $requestIp, string $ip): bool [$address, $netmask] = explode('/', $ip, 2); if ('0' === $netmask) { - return self::$checkedIps[$cacheKey] = filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4); + return self::$checkedIps[$cacheKey] = false !== filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4); } if ($netmask < 0 || $netmask > 32) { diff --git a/src/Symfony/Component/HttpFoundation/LICENSE b/src/Symfony/Component/HttpFoundation/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/HttpFoundation/LICENSE +++ b/src/Symfony/Component/HttpFoundation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php index 6085331b28bf3..5669f188a1e86 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php @@ -137,4 +137,21 @@ public function anonymizedIpData() ['::123.234.235.236', '::123.234.235.0'], // deprecated IPv4-compatible IPv6 address ]; } + + /** + * @dataProvider getIp4SubnetMaskZeroData + */ + public function testIp4SubnetMaskZero($matches, $remoteAddr, $cidr) + { + $this->assertSame($matches, IpUtils::checkIp4($remoteAddr, $cidr)); + } + + public function getIp4SubnetMaskZeroData() + { + return [ + [true, '1.2.3.4', '0.0.0.0/0'], + [true, '1.2.3.4', '192.168.1.0/0'], + [false, '1.2.3.4', '256.256.256/0'], // invalid CIDR notation + ]; + } } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index c3c662c11d2fd..e57afbfef5240 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -29,17 +29,28 @@ class Store implements StoreInterface private \SplObjectStorage $keyCache; /** @var array */ private array $locks = []; + private array $options; /** + * Constructor. + * + * The available options are: + * + * * private_headers Set of response headers that should not be stored + * when a response is cached. (default: Set-Cookie) + * * @throws \RuntimeException */ - public function __construct(string $root) + public function __construct(string $root, array $options = []) { $this->root = $root; if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) { throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); } $this->keyCache = new \SplObjectStorage(); + $this->options = array_merge([ + 'private_headers' => ['Set-Cookie'], + ], $options); } /** @@ -212,6 +223,10 @@ public function write(Request $request, Response $response): string $headers = $this->persistResponse($response); unset($headers['age']); + foreach ($this->options['private_headers'] as $h) { + unset($headers[strtolower($h)]); + } + array_unshift($entries, [$storedEnv, $headers]); if (!$this->save($key, serialize($entries))) { diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 946ca05ad8533..8d415b41f53e3 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.1.9-DEV'; - public const VERSION_ID = 60109; + public const VERSION = '6.1.12'; + public const VERSION_ID = 60112; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 1; - public const RELEASE_VERSION = 9; - public const EXTRA_VERSION = 'DEV'; + public const RELEASE_VERSION = 12; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '01/2023'; public const END_OF_LIFE = '01/2023'; diff --git a/src/Symfony/Component/HttpKernel/LICENSE b/src/Symfony/Component/HttpKernel/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/HttpKernel/LICENSE +++ b/src/Symfony/Component/HttpKernel/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php index ac10dfc1a5ea7..9f53f44d7a8dc 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php @@ -35,8 +35,8 @@ protected function tearDown(): void public static function getTimeZones() { yield ['UTC']; - yield ['Etc/GMT+9']; - yield ['Etc/GMT-14']; + yield ['Pacific/Honolulu']; + yield ['America/Toronto']; } public static function getClasses() diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php index dc2ef3055eb39..7c7cbba035c18 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php @@ -207,7 +207,7 @@ public function controllerProvider() }]; yield [function ($exception) { - $this->assertInstanceOf(FlattenException::class, $exception); + static::assertInstanceOf(FlattenException::class, $exception); return new Response('OK: '.$exception->getMessage()); }]; diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index 151b32bdd0deb..118cbc6f34b87 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -12,8 +12,10 @@ namespace Symfony\Component\HttpKernel\Tests\HttpCache; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpKernel\HttpCache\Store; class StoreTest extends TestCase @@ -317,6 +319,17 @@ public function testPurgeHttpAndHttps() $this->assertEmpty($this->getStoreMetadata($requestHttps)); } + public function testDoesNotStorePrivateHeaders() + { + $request = Request::create('https://example.com/foo'); + $response = new Response('foo'); + $response->headers->setCookie(Cookie::fromString('foo=bar')); + + $this->store->write($request, $response); + $this->assertArrayNotHasKey('set-cookie', $this->getStoreMetadata($request)[0][1]); + $this->assertNotEmpty($response->headers->getCookies()); + } + protected function storeSimpleEntry($path = null, $headers = []) { if (null === $path) { diff --git a/src/Symfony/Component/Intl/LICENSE b/src/Symfony/Component/Intl/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Intl/LICENSE +++ b/src/Symfony/Component/Intl/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Ldap/LICENSE b/src/Symfony/Component/Ldap/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Ldap/LICENSE +++ b/src/Symfony/Component/Ldap/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Lock/LICENSE b/src/Symfony/Component/Lock/LICENSE index 7fa9539054928..f2345234aa9ea 100644 --- a/src/Symfony/Component/Lock/LICENSE +++ b/src/Symfony/Component/Lock/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2022 Fabien Potencier +Copyright (c) 2016-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/LICENSE b/src/Symfony/Component/Mailer/Bridge/Amazon/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Amazon/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Amazon/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Google/LICENSE b/src/Symfony/Component/Mailer/Bridge/Google/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Google/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Google/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/LICENSE b/src/Symfony/Component/Mailer/Bridge/Mailchimp/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/LICENSE b/src/Symfony/Component/Mailer/Bridge/Mailgun/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Mailjet/LICENSE b/src/Symfony/Component/Mailer/Bridge/Mailjet/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailjet/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Mailjet/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/LICENSE b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Mailer/Bridge/OhMySmtp/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/OhMySmtp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/LICENSE b/src/Symfony/Component/Mailer/Bridge/Postmark/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Sendgrid/LICENSE b/src/Symfony/Component/Mailer/Bridge/Sendgrid/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendgrid/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Sendgrid/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE b/src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE +++ b/src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/LICENSE b/src/Symfony/Component/Mailer/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Mailer/LICENSE +++ b/src/Symfony/Component/Mailer/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mailer/composer.json b/src/Symfony/Component/Mailer/composer.json index 71ddc374c7a3c..b0ac164961978 100644 --- a/src/Symfony/Component/Mailer/composer.json +++ b/src/Symfony/Component/Mailer/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.1", - "egulias/email-validator": "^2.1.10|^3", + "egulias/email-validator": "^2.1.10|^3|^4", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", "symfony/event-dispatcher": "^5.4|^6.0", diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/LICENSE b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/LICENSE +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/LICENSE b/src/Symfony/Component/Messenger/Bridge/Amqp/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/LICENSE +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/LICENSE b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/LICENSE +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/LICENSE b/src/Symfony/Component/Messenger/Bridge/Doctrine/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/LICENSE +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/LICENSE b/src/Symfony/Component/Messenger/Bridge/Redis/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/LICENSE +++ b/src/Symfony/Component/Messenger/Bridge/Redis/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/LICENSE b/src/Symfony/Component/Messenger/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/Messenger/LICENSE +++ b/src/Symfony/Component/Messenger/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php index 34b84596c67d7..eb0beaa8a5848 100644 --- a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php +++ b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php @@ -69,16 +69,28 @@ public function testItAddsHandledStamps(array $handlers, array $expectedStamps, public function itAddsHandledStampsProvider(): iterable { - $first = $this->createPartialMock(HandleMessageMiddlewareTestCallable::class, ['__invoke']); - $first->method('__invoke')->willReturn('first result'); + $first = new class() extends HandleMessageMiddlewareTestCallable { + public function __invoke() + { + return 'first result'; + } + }; $firstClass = \get_class($first); - $second = $this->createPartialMock(HandleMessageMiddlewareTestCallable::class, ['__invoke']); - $second->method('__invoke')->willReturn(null); + $second = new class() extends HandleMessageMiddlewareTestCallable { + public function __invoke() + { + return null; + } + }; $secondClass = \get_class($second); - $failing = $this->createPartialMock(HandleMessageMiddlewareTestCallable::class, ['__invoke']); - $failing->method('__invoke')->will($this->throwException(new \Exception('handler failed.'))); + $failing = new class() extends HandleMessageMiddlewareTestCallable { + public function __invoke() + { + throw new \Exception('handler failed.'); + } + }; yield 'A stamp is added' => [ [$first], diff --git a/src/Symfony/Component/Mime/LICENSE b/src/Symfony/Component/Mime/LICENSE index 298be14166c20..58b42bc8a98fe 100644 --- a/src/Symfony/Component/Mime/LICENSE +++ b/src/Symfony/Component/Mime/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2010-2022 Fabien Potencier +Copyright (c) 2010-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Mime/composer.json b/src/Symfony/Component/Mime/composer.json index 8c6e0c0075825..ebca0af2ce4e9 100644 --- a/src/Symfony/Component/Mime/composer.json +++ b/src/Symfony/Component/Mime/composer.json @@ -21,7 +21,7 @@ "symfony/polyfill-mbstring": "^1.0" }, "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", + "egulias/email-validator": "^2.1.10|^3.1|^4", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/property-access": "^5.4|^6.0", diff --git a/src/Symfony/Component/Notifier/Bridge/AllMySms/LICENSE b/src/Symfony/Component/Notifier/Bridge/AllMySms/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/AllMySms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/AllMySms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/AmazonSns/LICENSE b/src/Symfony/Component/Notifier/Bridge/AmazonSns/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/AmazonSns/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/AmazonSns/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Clickatell/LICENSE b/src/Symfony/Component/Notifier/Bridge/Clickatell/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Clickatell/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Clickatell/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/LICENSE b/src/Symfony/Component/Notifier/Bridge/Discord/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Discord/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Engagespot/LICENSE b/src/Symfony/Component/Notifier/Bridge/Engagespot/LICENSE index 0ece8964f767d..074eb2b39259e 100644 --- a/src/Symfony/Component/Notifier/Bridge/Engagespot/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Engagespot/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Fabien Potencier +Copyright (c) 2022-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Esendex/LICENSE b/src/Symfony/Component/Notifier/Bridge/Esendex/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Esendex/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Esendex/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Expo/LICENSE b/src/Symfony/Component/Notifier/Bridge/Expo/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Expo/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Expo/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/FakeChat/LICENSE b/src/Symfony/Component/Notifier/Bridge/FakeChat/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/FakeChat/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/FakeChat/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/FakeSms/LICENSE b/src/Symfony/Component/Notifier/Bridge/FakeSms/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/FakeSms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/FakeSms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Firebase/LICENSE b/src/Symfony/Component/Notifier/Bridge/Firebase/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Firebase/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Firebase/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/FortySixElks/LICENSE b/src/Symfony/Component/Notifier/Bridge/FortySixElks/LICENSE index 0ece8964f767d..074eb2b39259e 100644 --- a/src/Symfony/Component/Notifier/Bridge/FortySixElks/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/FortySixElks/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Fabien Potencier +Copyright (c) 2022-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/FreeMobile/LICENSE b/src/Symfony/Component/Notifier/Bridge/FreeMobile/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/FreeMobile/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/FreeMobile/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/GatewayApi/LICENSE b/src/Symfony/Component/Notifier/Bridge/GatewayApi/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/GatewayApi/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/GatewayApi/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Gitter/LICENSE b/src/Symfony/Component/Notifier/Bridge/Gitter/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Gitter/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Gitter/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/GoogleChat/LICENSE b/src/Symfony/Component/Notifier/Bridge/GoogleChat/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/GoogleChat/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/GoogleChat/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Infobip/LICENSE b/src/Symfony/Component/Notifier/Bridge/Infobip/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Infobip/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Infobip/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Iqsms/LICENSE b/src/Symfony/Component/Notifier/Bridge/Iqsms/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Iqsms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Iqsms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/LICENSE b/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/LightSms/LICENSE b/src/Symfony/Component/Notifier/Bridge/LightSms/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/LightSms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/LightSms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/LinkedIn/LICENSE b/src/Symfony/Component/Notifier/Bridge/LinkedIn/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/LinkedIn/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/LinkedIn/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Mailjet/LICENSE b/src/Symfony/Component/Notifier/Bridge/Mailjet/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mailjet/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Mailjet/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/LICENSE b/src/Symfony/Component/Notifier/Bridge/Mattermost/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mattermost/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/LICENSE b/src/Symfony/Component/Notifier/Bridge/Mercure/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Mercure/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/ClockInterface.php b/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/ClockInterface.php deleted file mode 100644 index d8b2e86692260..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/ClockInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - and ClockInterfaceContributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - */ - -namespace StellaMaris\Clock; - -use DateTimeImmutable; - -interface ClockInterface -{ - /** - * Return the current point in time as a DateTimeImmutable object - */ - public function now() : DateTimeImmutable; -} diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/composer.json b/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/composer.json deleted file mode 100644 index fb838caed6e88..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/Tests/stella-maris-clock/composer.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "stella-maris/clock", - "description": "A local fork to workaround gitlab failing to serve the package reliably", - "homepage": "https://gitlab.com/stella-maris/clock", - "license": "MIT", - "authors": [ - { - "name": "Andreas Heigl", - "role": "Maintainer" - } - ], - "autoload": { - "psr-4": { - "StellaMaris\\Clock\\": "" - } - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json b/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json index 117bab34320e3..39e67cc7b05a8 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Mercure/composer.json @@ -28,16 +28,5 @@ "/Tests/" ] }, - "repositories": [ - { - "type": "path", - "url": "Tests/stella-maris-clock", - "options": { - "versions": { - "stella-maris/clock": "0.1.x-dev" - } - } - } - ], "minimum-stability": "dev" } diff --git a/src/Symfony/Component/Notifier/Bridge/MessageBird/LICENSE b/src/Symfony/Component/Notifier/Bridge/MessageBird/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/MessageBird/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/MessageBird/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/MessageMedia/LICENSE b/src/Symfony/Component/Notifier/Bridge/MessageMedia/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/MessageMedia/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/MessageMedia/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/LICENSE b/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/MicrosoftTeams/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Mobyt/LICENSE b/src/Symfony/Component/Notifier/Bridge/Mobyt/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mobyt/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Mobyt/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Octopush/LICENSE b/src/Symfony/Component/Notifier/Bridge/Octopush/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Octopush/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Octopush/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/OneSignal/LICENSE b/src/Symfony/Component/Notifier/Bridge/OneSignal/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/OneSignal/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/OneSignal/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/OrangeSms/LICENSE b/src/Symfony/Component/Notifier/Bridge/OrangeSms/LICENSE index 0ece8964f767d..074eb2b39259e 100644 --- a/src/Symfony/Component/Notifier/Bridge/OrangeSms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/OrangeSms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Fabien Potencier +Copyright (c) 2022-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/OvhCloud/LICENSE b/src/Symfony/Component/Notifier/Bridge/OvhCloud/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/OvhCloud/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/OvhCloud/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php b/src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php index 7f419d33e2bde..09de4712795d2 100644 --- a/src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php @@ -132,6 +132,10 @@ protected function doSend(MessageInterface $message): SentMessage $success = $response->toArray(false); + if (!isset($success['ids'][0])) { + throw new TransportException(sprintf('Attempt to send the SMS to invalid receivers: "%s".', implode(',', $success['invalidReceivers'])), $response); + } + $sentMessage = new SentMessage($message, (string) $this); $sentMessage->setMessageId($success['ids'][0]); diff --git a/src/Symfony/Component/Notifier/Bridge/OvhCloud/Tests/OvhCloudTransportTest.php b/src/Symfony/Component/Notifier/Bridge/OvhCloud/Tests/OvhCloudTransportTest.php index f0678323788fa..f5e1a01aab159 100644 --- a/src/Symfony/Component/Notifier/Bridge/OvhCloud/Tests/OvhCloudTransportTest.php +++ b/src/Symfony/Component/Notifier/Bridge/OvhCloud/Tests/OvhCloudTransportTest.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Component\Notifier\Bridge\OvhCloud\OvhCloudTransport; +use Symfony\Component\Notifier\Exception\TransportException; use Symfony\Component\Notifier\Message\ChatMessage; use Symfony\Component\Notifier\Message\MessageInterface; use Symfony\Component\Notifier\Message\SmsMessage; @@ -89,4 +90,26 @@ public function testValidSignature(string $message) $toSign = 'applicationSecret+consumerKey+POST+'.$endpoint.'+'.$body.'+'.$time; $this->assertSame('$1$'.sha1($toSign), $signature); } + + public function testInvalidReceiver() + { + $smsMessage = new SmsMessage('invalid_receiver', 'lorem ipsum'); + + $data = json_encode([ + 'totalCreditsRemoved' => '1', + 'invalidReceivers' => ['invalid_receiver'], + 'ids' => [], + 'validReceivers' => [], + ]); + $responses = [ + new MockResponse((string) time()), + new MockResponse($data), + ]; + + $transport = $this->createTransport(new MockHttpClient($responses)); + + $this->expectException(TransportException::class); + $this->expectExceptionMessage('Attempt to send the SMS to invalid receivers: "invalid_receiver"'); + $transport->send($smsMessage); + } } diff --git a/src/Symfony/Component/Notifier/Bridge/RocketChat/LICENSE b/src/Symfony/Component/Notifier/Bridge/RocketChat/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/RocketChat/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/RocketChat/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Sendberry/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sendberry/LICENSE index 0ece8964f767d..074eb2b39259e 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendberry/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Sendberry/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Fabien Potencier +Copyright (c) 2022-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Sinch/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sinch/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sinch/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Sinch/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/LICENSE b/src/Symfony/Component/Notifier/Bridge/Slack/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Slack/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Slack/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Sms77/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/SmsBiuras/LICENSE b/src/Symfony/Component/Notifier/Bridge/SmsBiuras/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/SmsBiuras/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/SmsBiuras/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Smsapi/LICENSE b/src/Symfony/Component/Notifier/Bridge/Smsapi/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Smsapi/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Smsapi/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Smsc/LICENSE b/src/Symfony/Component/Notifier/Bridge/Smsc/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Smsc/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Smsc/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/SpotHit/LICENSE b/src/Symfony/Component/Notifier/Bridge/SpotHit/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/SpotHit/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/SpotHit/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/LICENSE b/src/Symfony/Component/Notifier/Bridge/Telegram/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Telnyx/LICENSE b/src/Symfony/Component/Notifier/Bridge/Telnyx/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telnyx/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Telnyx/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/TurboSms/LICENSE b/src/Symfony/Component/Notifier/Bridge/TurboSms/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/TurboSms/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/TurboSms/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Twilio/LICENSE b/src/Symfony/Component/Notifier/Bridge/Twilio/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/Bridge/Twilio/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Twilio/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Vonage/LICENSE b/src/Symfony/Component/Notifier/Bridge/Vonage/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Vonage/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Vonage/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Yunpian/LICENSE b/src/Symfony/Component/Notifier/Bridge/Yunpian/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Notifier/Bridge/Yunpian/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Yunpian/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/Bridge/Zulip/LICENSE b/src/Symfony/Component/Notifier/Bridge/Zulip/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Zulip/LICENSE +++ b/src/Symfony/Component/Notifier/Bridge/Zulip/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Notifier/LICENSE b/src/Symfony/Component/Notifier/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/Notifier/LICENSE +++ b/src/Symfony/Component/Notifier/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/OptionsResolver/LICENSE b/src/Symfony/Component/OptionsResolver/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/OptionsResolver/LICENSE +++ b/src/Symfony/Component/OptionsResolver/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/PasswordHasher/LICENSE b/src/Symfony/Component/PasswordHasher/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/PasswordHasher/LICENSE +++ b/src/Symfony/Component/PasswordHasher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Process/LICENSE b/src/Symfony/Component/Process/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Process/LICENSE +++ b/src/Symfony/Component/Process/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/PropertyAccess/LICENSE b/src/Symfony/Component/PropertyAccess/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/PropertyAccess/LICENSE +++ b/src/Symfony/Component/PropertyAccess/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index 0579169135547..cb93ed864a1c0 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -192,7 +192,7 @@ public function getTypesFromConstructor(string $class, string $property): ?array } } - if (!isset($types[0])) { + if (!isset($types[0]) || [] === $types[0]) { return null; } diff --git a/src/Symfony/Component/PropertyInfo/LICENSE b/src/Symfony/Component/PropertyInfo/LICENSE index 4e90b1b5ae4df..63af57a7115e5 100644 --- a/src/Symfony/Component/PropertyInfo/LICENSE +++ b/src/Symfony/Component/PropertyInfo/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2022 Fabien Potencier +Copyright (c) 2015-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php index fc8b6890f8441..0491846a0445e 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php @@ -406,6 +406,7 @@ public function constructorTypesProvider() ['dateObject', [new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTimeInterface')]], ['dateTime', null], ['ddd', null], + ['mixed', null], ]; } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php index 1c50c67e73ed6..94173ba5fe4a2 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php @@ -29,8 +29,9 @@ class ConstructorDummy * @param \DateTimeZone $timezone * @param int $date Timestamp * @param \DateTimeInterface $dateObject + * @param mixed $mixed */ - public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTime $dateTime) + public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTime $dateTime, $mixed) { $this->timezone = $timezone->getName(); $this->date = \DateTime::createFromFormat('U', $date); diff --git a/src/Symfony/Component/RateLimiter/LICENSE b/src/Symfony/Component/RateLimiter/LICENSE index 7fa9539054928..f2345234aa9ea 100644 --- a/src/Symfony/Component/RateLimiter/LICENSE +++ b/src/Symfony/Component/RateLimiter/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2022 Fabien Potencier +Copyright (c) 2016-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Routing/LICENSE b/src/Symfony/Component/Routing/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Routing/LICENSE +++ b/src/Symfony/Component/Routing/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php b/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php index 6e2220acfdb34..a48ff46ff00b1 100644 --- a/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php +++ b/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php @@ -58,7 +58,7 @@ public function uninstall(Composer $composer, IOInterface $io): void public function updateAutoloadFile(): void { - $vendorDir = $this->composer->getConfig()->get('vendor-dir'); + $vendorDir = realpath($this->composer->getConfig()->get('vendor-dir')); if (!is_file($autoloadFile = $vendorDir.'/autoload.php') || false === $extra = $this->composer->getPackage()->getExtra()['runtime'] ?? [] diff --git a/src/Symfony/Component/Runtime/LICENSE b/src/Symfony/Component/Runtime/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Runtime/LICENSE +++ b/src/Symfony/Component/Runtime/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Security/Core/LICENSE b/src/Symfony/Component/Security/Core/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Security/Core/LICENSE +++ b/src/Symfony/Component/Security/Core/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Security/Core/Signature/SignatureHasher.php b/src/Symfony/Component/Security/Core/Signature/SignatureHasher.php index d38e1a4153a49..962c527f39a39 100644 --- a/src/Symfony/Component/Security/Core/Signature/SignatureHasher.php +++ b/src/Symfony/Component/Security/Core/Signature/SignatureHasher.php @@ -45,7 +45,9 @@ public function __construct(PropertyAccessorInterface $propertyAccessor, array $ } /** - * Verifies the hash using the provided user and expire time. + * Verifies the hash using the provided user identifier and expire time. + * + * This method must be called before the user object is loaded from a provider. * * @param int $expires The expiry time as a unix timestamp * @param string $hash The plaintext hash provided by the request @@ -53,16 +55,38 @@ public function __construct(PropertyAccessorInterface $propertyAccessor, array $ * @throws InvalidSignatureException If the signature does not match the provided parameters * @throws ExpiredSignatureException If the signature is no longer valid */ - public function verifySignatureHash(UserInterface $user, int $expires, string $hash): void + public function acceptSignatureHash(string $userIdentifier, int $expires, string $hash): void { - if (!hash_equals($hash, $this->computeSignatureHash($user, $expires))) { + if ($expires < time()) { + throw new ExpiredSignatureException('Signature has expired.'); + } + $hmac = substr($hash, 0, 44); + $payload = substr($hash, 44).':'.$expires.':'.$userIdentifier; + + if (!hash_equals($hmac, $this->generateHash($payload))) { throw new InvalidSignatureException('Invalid or expired signature.'); } + } + /** + * Verifies the hash using the provided user and expire time. + * + * @param int $expires The expiry time as a unix timestamp + * @param string $hash The plaintext hash provided by the request + * + * @throws InvalidSignatureException If the signature does not match the provided parameters + * @throws ExpiredSignatureException If the signature is no longer valid + */ + public function verifySignatureHash(UserInterface $user, int $expires, string $hash): void + { if ($expires < time()) { throw new ExpiredSignatureException('Signature has expired.'); } + if (!hash_equals($hash, $this->computeSignatureHash($user, $expires))) { + throw new InvalidSignatureException('Invalid or expired signature.'); + } + if ($this->expiredSignaturesStorage && $this->maxUses) { if ($this->expiredSignaturesStorage->countUsages($hash) >= $this->maxUses) { throw new ExpiredSignatureException(sprintf('Signature can only be used "%d" times.', $this->maxUses)); @@ -79,7 +103,8 @@ public function verifySignatureHash(UserInterface $user, int $expires, string $h */ public function computeSignatureHash(UserInterface $user, int $expires): string { - $signatureFields = [base64_encode($user->getUserIdentifier()), $expires]; + $userIdentifier = $user->getUserIdentifier(); + $fieldsHash = hash_init('sha256'); foreach ($this->signatureProperties as $property) { $value = $this->propertyAccessor->getValue($user, $property) ?? ''; @@ -90,9 +115,16 @@ public function computeSignatureHash(UserInterface $user, int $expires): string if (!\is_scalar($value) && !$value instanceof \Stringable) { throw new \InvalidArgumentException(sprintf('The property path "%s" on the user object "%s" must return a value that can be cast to a string, but "%s" was returned.', $property, \get_class($user), get_debug_type($value))); } - $signatureFields[] = base64_encode($value); + hash_update($fieldsHash, ':'.base64_encode($value)); } - return base64_encode(hash_hmac('sha256', implode(':', $signatureFields), $this->secret)); + $fieldsHash = strtr(base64_encode(hash_final($fieldsHash, true)), '+/=', '-_~'); + + return $this->generateHash($fieldsHash.':'.$expires.':'.$userIdentifier).$fieldsHash; + } + + private function generateHash(string $tokenValue): string + { + return strtr(base64_encode(hash_hmac('sha256', $tokenValue, $this->secret, true)), '+/=', '-_~'); } } diff --git a/src/Symfony/Component/Security/Csrf/LICENSE b/src/Symfony/Component/Security/Csrf/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Security/Csrf/LICENSE +++ b/src/Symfony/Component/Security/Csrf/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Security/Http/LICENSE b/src/Symfony/Component/Security/Http/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Security/Http/LICENSE +++ b/src/Symfony/Component/Security/Http/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Security/Http/LoginLink/LoginLinkHandler.php b/src/Symfony/Component/Security/Http/LoginLink/LoginLinkHandler.php index 9b898319a998c..9109ef3248345 100644 --- a/src/Symfony/Component/Security/Http/LoginLink/LoginLinkHandler.php +++ b/src/Symfony/Component/Security/Http/LoginLink/LoginLinkHandler.php @@ -83,12 +83,6 @@ public function consumeLoginLink(Request $request): UserInterface { $userIdentifier = $request->get('user'); - try { - $user = $this->userProvider->loadUserByIdentifier($userIdentifier); - } catch (UserNotFoundException $exception) { - throw new InvalidLoginLinkException('User not found.', 0, $exception); - } - if (!$hash = $request->get('hash')) { throw new InvalidLoginLinkException('Missing "hash" parameter.'); } @@ -97,7 +91,13 @@ public function consumeLoginLink(Request $request): UserInterface } try { + $this->signatureHasher->acceptSignatureHash($userIdentifier, $expires, $hash); + + $user = $this->userProvider->loadUserByIdentifier($userIdentifier); + $this->signatureHasher->verifySignatureHash($user, $expires, $hash); + } catch (UserNotFoundException $e) { + throw new InvalidLoginLinkException('User not found.', 0, $e); } catch (ExpiredSignatureException $e) { throw new ExpiredLoginLinkException(ucfirst(str_ireplace('signature', 'login link', $e->getMessage())), 0, $e); } catch (InvalidSignatureException $e) { diff --git a/src/Symfony/Component/Security/Http/RememberMe/PersistentRememberMeHandler.php b/src/Symfony/Component/Security/Http/RememberMe/PersistentRememberMeHandler.php index 632fe4217c030..f5e648ac73207 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/PersistentRememberMeHandler.php +++ b/src/Symfony/Component/Security/Http/RememberMe/PersistentRememberMeHandler.php @@ -34,7 +34,6 @@ final class PersistentRememberMeHandler extends AbstractRememberMeHandler { private TokenProviderInterface $tokenProvider; private ?TokenVerifierInterface $tokenVerifier; - private string $secret; public function __construct(TokenProviderInterface $tokenProvider, string $secret, UserProviderInterface $userProvider, RequestStack $requestStack, array $options, LoggerInterface $logger = null, TokenVerifierInterface $tokenVerifier = null) { @@ -45,7 +44,6 @@ public function __construct(TokenProviderInterface $tokenProvider, string $secre } $this->tokenProvider = $tokenProvider; $this->tokenVerifier = $tokenVerifier; - $this->secret = $secret; } /** @@ -53,18 +51,16 @@ public function __construct(TokenProviderInterface $tokenProvider, string $secre */ public function createRememberMeCookie(UserInterface $user): void { - $series = base64_encode(random_bytes(64)); - $tokenValue = $this->generateHash(base64_encode(random_bytes(64))); + $series = random_bytes(66); + $tokenValue = strtr(base64_encode(substr($series, 33)), '+/=', '-_~'); + $series = strtr(base64_encode(substr($series, 0, 33)), '+/=', '-_~'); $token = new PersistentToken(\get_class($user), $user->getUserIdentifier(), $series, $tokenValue, new \DateTime()); $this->tokenProvider->createNewToken($token); $this->createCookie(RememberMeDetails::fromPersistentToken($token, time() + $this->options['lifetime'])); } - /** - * {@inheritdoc} - */ - public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface { if (!str_contains($rememberMeDetails->getValue(), ':')) { throw new AuthenticationException('The cookie is incorrectly formatted.'); @@ -86,16 +82,26 @@ public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInte throw new AuthenticationException('The cookie has expired.'); } + return parent::consumeRememberMeCookie($rememberMeDetails->withValue($persistentToken->getLastUsed()->getTimestamp().':'.$rememberMeDetails->getValue().':'.$persistentToken->getClass())); + } + + public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void + { + [$lastUsed, $series, $tokenValue, $class] = explode(':', $rememberMeDetails->getValue(), 4); + $persistentToken = new PersistentToken($class, $rememberMeDetails->getUserIdentifier(), $series, $tokenValue, new \DateTime('@'.$lastUsed)); + // if a token was regenerated less than a minute ago, there is no need to regenerate it // if multiple concurrent requests reauthenticate a user we do not want to update the token several times - if ($persistentToken->getLastUsed()->getTimestamp() + 60 < time()) { - $tokenValue = $this->generateHash(base64_encode(random_bytes(64))); - $tokenLastUsed = new \DateTime(); - $this->tokenVerifier?->updateExistingToken($persistentToken, $tokenValue, $tokenLastUsed); - $this->tokenProvider->updateToken($series, $tokenValue, $tokenLastUsed); - - $this->createCookie($rememberMeDetails->withValue($series.':'.$tokenValue)); + if ($persistentToken->getLastUsed()->getTimestamp() + 60 >= time()) { + return; } + + $tokenValue = strtr(base64_encode(random_bytes(33)), '+/=', '-_~'); + $tokenLastUsed = new \DateTime(); + $this->tokenVerifier?->updateExistingToken($persistentToken, $tokenValue, $tokenLastUsed); + $this->tokenProvider->updateToken($series, $tokenValue, $tokenLastUsed); + + $this->createCookie($rememberMeDetails->withValue($series.':'.$tokenValue)); } /** @@ -111,7 +117,7 @@ public function clearRememberMeCookie(): void } $rememberMeDetails = RememberMeDetails::fromRawCookie($cookie); - [$series, ] = explode(':', $rememberMeDetails->getValue()); + [$series] = explode(':', $rememberMeDetails->getValue()); $this->tokenProvider->deleteTokenBySeries($series); } @@ -122,9 +128,4 @@ public function getTokenProvider(): TokenProviderInterface { return $this->tokenProvider; } - - private function generateHash(string $tokenValue): string - { - return hash_hmac('sha256', $tokenValue, $this->secret); - } } diff --git a/src/Symfony/Component/Security/Http/RememberMe/RememberMeDetails.php b/src/Symfony/Component/Security/Http/RememberMe/RememberMeDetails.php index 7945b417fdf49..0ae8bc0372cb5 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/RememberMeDetails.php +++ b/src/Symfony/Component/Security/Http/RememberMe/RememberMeDetails.php @@ -36,13 +36,17 @@ public function __construct(string $userFqcn, string $userIdentifier, int $expir public static function fromRawCookie(string $rawCookie): self { - $cookieParts = explode(self::COOKIE_DELIMITER, base64_decode($rawCookie), 4); + if (!str_contains($rawCookie, self::COOKIE_DELIMITER)) { + $rawCookie = base64_decode($rawCookie); + } + $cookieParts = explode(self::COOKIE_DELIMITER, $rawCookie, 4); if (4 !== \count($cookieParts)) { throw new AuthenticationException('The cookie contains invalid data.'); } - if (false === $cookieParts[1] = base64_decode($cookieParts[1], true)) { + if (false === $cookieParts[1] = base64_decode(strtr($cookieParts[1], '-_~', '+/='), true)) { throw new AuthenticationException('The user identifier contains a character from outside the base64 alphabet.'); } + $cookieParts[0] = strtr($cookieParts[0], '.', '\\'); return new static(...$cookieParts); } @@ -83,6 +87,6 @@ public function getValue(): string public function toString(): string { // $userIdentifier is encoded because it might contain COOKIE_DELIMITER, we assume other values don't - return base64_encode(implode(self::COOKIE_DELIMITER, [$this->userFqcn, base64_encode($this->userIdentifier), $this->expires, $this->value])); + return implode(self::COOKIE_DELIMITER, [strtr($this->userFqcn, '\\', '.'), strtr(base64_encode($this->userIdentifier), '+/=', '-_~'), $this->expires, $this->value]); } } diff --git a/src/Symfony/Component/Security/Http/RememberMe/SignatureRememberMeHandler.php b/src/Symfony/Component/Security/Http/RememberMe/SignatureRememberMeHandler.php index cab305788a07d..44467917ba1da 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/SignatureRememberMeHandler.php +++ b/src/Symfony/Component/Security/Http/RememberMe/SignatureRememberMeHandler.php @@ -53,9 +53,19 @@ public function createRememberMeCookie(UserInterface $user): void $this->createCookie($details); } - /** - * {@inheritdoc} - */ + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface + { + try { + $this->signatureHasher->acceptSignatureHash($rememberMeDetails->getUserIdentifier(), $rememberMeDetails->getExpires(), $rememberMeDetails->getValue()); + } catch (InvalidSignatureException $e) { + throw new AuthenticationException('The cookie\'s hash is invalid.', 0, $e); + } catch (ExpiredSignatureException $e) { + throw new AuthenticationException('The cookie has expired.', 0, $e); + } + + return parent::consumeRememberMeCookie($rememberMeDetails); + } + public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void { try { diff --git a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php index 97cf136999977..e671c50366b4a 100644 --- a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php +++ b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface; /** * The default session strategy implementation. @@ -31,10 +32,15 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte public const INVALIDATE = 'invalidate'; private string $strategy; + private ?ClearableTokenStorageInterface $csrfTokenStorage = null; - public function __construct(string $strategy) + public function __construct(string $strategy, ClearableTokenStorageInterface $csrfTokenStorage = null) { $this->strategy = $strategy; + + if (self::MIGRATE === $strategy) { + $this->csrfTokenStorage = $csrfTokenStorage; + } } /** @@ -47,10 +53,12 @@ public function onAuthentication(Request $request, TokenInterface $token) return; case self::MIGRATE: - // Note: this logic is duplicated in several authentication listeners - // until Symfony 5.0 due to a security fix with BC compat $request->getSession()->migrate(true); + if ($this->csrfTokenStorage) { + $this->csrfTokenStorage->clear(); + } + return; case self::INVALIDATE: diff --git a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php index c29bb9a85fbde..f2d03eed1c0f1 100644 --- a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php @@ -53,6 +53,7 @@ protected function setUp(): void /** * @group time-sensitive + * * @dataProvider provideCreateLoginLinkData */ public function testCreateLoginLink($user, array $extraProperties, Request $request = null) @@ -68,7 +69,7 @@ public function testCreateLoginLink($user, array $extraProperties, Request $requ // allow a small expiration offset to avoid time-sensitivity && abs(time() + 600 - $parameters['expires']) <= 1 // make sure hash is what we expect - && $parameters['hash'] === $this->createSignatureHash('weaverryan', $parameters['expires'], array_values($extraProperties)); + && $parameters['hash'] === $this->createSignatureHash('weaverryan', $parameters['expires'], $extraProperties); }), UrlGeneratorInterface::ABSOLUTE_URL ) @@ -115,7 +116,7 @@ public function provideCreateLoginLinkData() public function testConsumeLoginLink() { $expires = time() + 500; - $signature = $this->createSignatureHash('weaverryan', $expires, ['ryan@symfonycasts.com', 'pwhash']); + $signature = $this->createSignatureHash('weaverryan', $expires); $request = Request::create(sprintf('/login/verify?user=weaverryan&hash=%s&expires=%d', $signature, $expires)); $user = new TestLoginLinkHandlerUser('weaverryan', 'ryan@symfonycasts.com', 'pwhash'); @@ -131,44 +132,37 @@ public function testConsumeLoginLink() public function testConsumeLoginLinkWithExpired() { - $this->expectException(ExpiredLoginLinkException::class); $expires = time() - 500; - $signature = $this->createSignatureHash('weaverryan', $expires, ['ryan@symfonycasts.com', 'pwhash']); + $signature = $this->createSignatureHash('weaverryan', $expires); $request = Request::create(sprintf('/login/verify?user=weaverryan&hash=%s&expires=%d', $signature, $expires)); - $user = new TestLoginLinkHandlerUser('weaverryan', 'ryan@symfonycasts.com', 'pwhash'); - $this->userProvider->createUser($user); - $linker = $this->createLinker(['max_uses' => 3]); + $this->expectException(ExpiredLoginLinkException::class); $linker->consumeLoginLink($request); } public function testConsumeLoginLinkWithUserNotFound() { - $this->expectException(InvalidLoginLinkException::class); - $request = Request::create('/login/verify?user=weaverryan&hash=thehash&expires=10000'); + $request = Request::create('/login/verify?user=weaverryan&hash=thehash&expires='.(time() + 500)); $linker = $this->createLinker(); + $this->expectException(InvalidLoginLinkException::class); $linker->consumeLoginLink($request); } public function testConsumeLoginLinkWithDifferentSignature() { - $this->expectException(InvalidLoginLinkException::class); $request = Request::create(sprintf('/login/verify?user=weaverryan&hash=fake_hash&expires=%d', time() + 500)); - $user = new TestLoginLinkHandlerUser('weaverryan', 'ryan@symfonycasts.com', 'pwhash'); - $this->userProvider->createUser($user); - $linker = $this->createLinker(); + $this->expectException(InvalidLoginLinkException::class); $linker->consumeLoginLink($request); } public function testConsumeLoginLinkExceedsMaxUsage() { - $this->expectException(ExpiredLoginLinkException::class); $expires = time() + 500; - $signature = $this->createSignatureHash('weaverryan', $expires, ['ryan@symfonycasts.com', 'pwhash']); + $signature = $this->createSignatureHash('weaverryan', $expires); $request = Request::create(sprintf('/login/verify?user=weaverryan&hash=%s&expires=%d', $signature, $expires)); $user = new TestLoginLinkHandlerUser('weaverryan', 'ryan@symfonycasts.com', 'pwhash'); @@ -179,6 +173,7 @@ public function testConsumeLoginLinkExceedsMaxUsage() $this->expiredLinkCache->save($item); $linker = $this->createLinker(['max_uses' => 3]); + $this->expectException(ExpiredLoginLinkException::class); $linker->consumeLoginLink($request); } @@ -206,15 +201,12 @@ public function testConsumeLoginLinkWithMissingExpiration() $linker->consumeLoginLink($request); } - private function createSignatureHash(string $username, int $expires, array $extraFields): string + private function createSignatureHash(string $username, int $expires, array $extraFields = ['emailProperty' => 'ryan@symfonycasts.com', 'passwordProperty' => 'pwhash']): string { - $fields = [base64_encode($username), $expires]; - foreach ($extraFields as $extraField) { - $fields[] = base64_encode($extraField); - } + $hasher = new SignatureHasher($this->propertyAccessor, array_keys($extraFields), 's3cret'); + $user = new TestLoginLinkHandlerUser($username, $extraFields['emailProperty'] ?? '', $extraFields['passwordProperty'] ?? '', $extraFields['lastAuthenticatedAt'] ?? null); - // matches hash logic in the class - return base64_encode(hash_hmac('sha256', implode(':', $fields), 's3cret')); + return $hasher->computeSignatureHash($user, $expires); } private function createLinker(array $options = [], array $extraProperties = ['emailProperty', 'passwordProperty']): LoginLinkHandler @@ -298,7 +290,7 @@ public function loadUserByIdentifier(string $userIdentifier): TestLoginLinkHandl public function refreshUser(UserInterface $user): TestLoginLinkHandlerUser { - return $this->users[$username]; + return $this->users[$user->getUserIdentifier()]; } public function supportsClass(string $class): bool diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php index 4e2c0980ba0aa..76472b1d5733c 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php @@ -93,8 +93,8 @@ public function testConsumeRememberMeCookieValid() /** @var Cookie $cookie */ $cookie = $this->request->attributes->get(ResponseListener::COOKIE_ATTR_NAME); - $rememberParts = explode(':', base64_decode($rememberMeDetails->toString()), 4); - $cookieParts = explode(':', base64_decode($cookie->getValue()), 4); + $rememberParts = explode(':', $rememberMeDetails->toString(), 4); + $cookieParts = explode(':', $cookie->getValue(), 4); $this->assertSame($rememberParts[0], $cookieParts[0]); // class $this->assertSame($rememberParts[1], $cookieParts[1]); // identifier @@ -156,4 +156,19 @@ public function testConsumeRememberMeCookieExpired() $this->handler->consumeRememberMeCookie(new RememberMeDetails(InMemoryUser::class, 'wouter', 360, 'series1:tokenvalue')); } + + public function testBase64EncodedTokens() + { + $this->tokenProvider->expects($this->any()) + ->method('loadTokenBySeries') + ->with('series1') + ->willReturn(new PersistentToken(InMemoryUser::class, 'wouter', 'series1', 'tokenvalue', new \DateTime('-10 min'))) + ; + + $this->tokenProvider->expects($this->once())->method('updateToken')->with('series1'); + + $rememberMeDetails = new RememberMeDetails(InMemoryUser::class, 'wouter', 360, 'series1:tokenvalue'); + $rememberMeDetails = RememberMeDetails::fromRawCookie(base64_encode($rememberMeDetails->toString())); + $this->handler->consumeRememberMeCookie($rememberMeDetails); + } } diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php index d7b7b85673cd7..8205009448a64 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php @@ -12,13 +12,11 @@ namespace Symfony\Component\Security\Http\Tests\RememberMe; use PHPUnit\Framework\TestCase; -use Symfony\Bridge\PhpUnit\ClockMock; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\Security\Core\Exception\AuthenticationException; -use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException; -use Symfony\Component\Security\Core\Signature\Exception\InvalidSignatureException; use Symfony\Component\Security\Core\Signature\SignatureHasher; use Symfony\Component\Security\Core\User\InMemoryUser; use Symfony\Component\Security\Core\User\InMemoryUserProvider; @@ -36,10 +34,8 @@ class SignatureRememberMeHandlerTest extends TestCase protected function setUp(): void { - $this->signatureHasher = $this->createMock(SignatureHasher::class); + $this->signatureHasher = new SignatureHasher(PropertyAccess::createPropertyAccessor(), [], 's3cret'); $this->userProvider = new InMemoryUserProvider(); - $user = new InMemoryUser('wouter', null); - $this->userProvider->createUser($user); $this->requestStack = new RequestStack(); $this->request = Request::create('/login'); $this->requestStack->push($this->request); @@ -51,10 +47,9 @@ protected function setUp(): void */ public function testCreateRememberMeCookie() { - ClockMock::register(SignatureRememberMeHandler::class); - $user = new InMemoryUser('wouter', null); - $this->signatureHasher->expects($this->once())->method('computeSignatureHash')->with($user, $expire = time() + 31536000)->willReturn('abc'); + $signature = $this->signatureHasher->computeSignatureHash($user, $expire = time() + 31536000); + $this->userProvider->createUser(new InMemoryUser('wouter', null)); $this->handler->createRememberMeCookie($user); @@ -62,7 +57,7 @@ public function testCreateRememberMeCookie() /** @var Cookie $cookie */ $cookie = $this->request->attributes->get(ResponseListener::COOKIE_ATTR_NAME); - $this->assertEquals(base64_encode(InMemoryUser::class.':d291dGVy:'.$expire.':abc'), $cookie->getValue()); + $this->assertEquals(strtr(InMemoryUser::class, '\\', '.').':d291dGVy:'.$expire.':'.$signature, $cookie->getValue()); } public function testClearRememberMeCookie() @@ -76,50 +71,36 @@ public function testClearRememberMeCookie() $this->assertNull($cookie->getValue()); } - /** - * @group time-sensitive - */ public function testConsumeRememberMeCookieValid() { - $this->signatureHasher->expects($this->once())->method('verifySignatureHash')->with($user = new InMemoryUser('wouter', null), 360, 'signature'); - $this->signatureHasher->expects($this->any()) - ->method('computeSignatureHash') - ->with($user, $expire = time() + 31536000) - ->willReturn('newsignature'); + $user = new InMemoryUser('wouter', null); + $signature = $this->signatureHasher->computeSignatureHash($user, $expire = time() + 3600); + $this->userProvider->createUser(new InMemoryUser('wouter', null)); - $rememberMeDetails = new RememberMeDetails(InMemoryUser::class, 'wouter', 360, 'signature'); + $rememberMeDetails = new RememberMeDetails(InMemoryUser::class, 'wouter', $expire, $signature); $this->handler->consumeRememberMeCookie($rememberMeDetails); $this->assertTrue($this->request->attributes->has(ResponseListener::COOKIE_ATTR_NAME)); /** @var Cookie $cookie */ $cookie = $this->request->attributes->get(ResponseListener::COOKIE_ATTR_NAME); - $this->assertEquals((new RememberMeDetails(InMemoryUser::class, 'wouter', $expire, 'newsignature'))->toString(), $cookie->getValue()); + $this->assertNotEquals((new RememberMeDetails(InMemoryUser::class, 'wouter', $expire, $signature))->toString(), $cookie->getValue()); } public function testConsumeRememberMeCookieInvalidHash() { $this->expectException(AuthenticationException::class); $this->expectExceptionMessage('The cookie\'s hash is invalid.'); - - $this->signatureHasher->expects($this->any()) - ->method('verifySignatureHash') - ->with(new InMemoryUser('wouter', null), 360, 'badsignature') - ->will($this->throwException(new InvalidSignatureException())); - - $this->handler->consumeRememberMeCookie(new RememberMeDetails(InMemoryUser::class, 'wouter', 360, 'badsignature')); + $this->handler->consumeRememberMeCookie(new RememberMeDetails(InMemoryUser::class, 'wouter', time() + 600, 'badsignature')); } public function testConsumeRememberMeCookieExpired() { + $user = new InMemoryUser('wouter', null); + $signature = $this->signatureHasher->computeSignatureHash($user, 360); + $this->expectException(AuthenticationException::class); $this->expectExceptionMessage('The cookie has expired.'); - - $this->signatureHasher->expects($this->any()) - ->method('verifySignatureHash') - ->with(new InMemoryUser('wouter', null), 360, 'signature') - ->will($this->throwException(new ExpiredSignatureException())); - - $this->handler->consumeRememberMeCookie(new RememberMeDetails(InMemoryUser::class, 'wouter', 360, 'signature')); + $this->handler->consumeRememberMeCookie(new RememberMeDetails(InMemoryUser::class, 'wouter', 360, $signature)); } } diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php index 69953ae6fd14e..b52b2f5a522c8 100644 --- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface; use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; class SessionAuthenticationStrategyTest extends TestCase @@ -57,6 +58,18 @@ public function testSessionIsInvalidated() $strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class)); } + public function testCsrfTokensAreCleared() + { + $session = $this->createMock(SessionInterface::class); + $session->expects($this->once())->method('migrate')->with($this->equalTo(true)); + + $csrfStorage = $this->createMock(ClearableTokenStorageInterface::class); + $csrfStorage->expects($this->once())->method('clear'); + + $strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE, $csrfStorage); + $strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class)); + } + private function getRequest($session = null) { $request = $this->createMock(Request::class); diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 13bb3a203ffb2..b82778060b655 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.1", - "symfony/security-core": "^5.4.7|^6.0", + "symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5", "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^6.1", "symfony/polyfill-mbstring": "~1.0", diff --git a/src/Symfony/Component/Semaphore/LICENSE b/src/Symfony/Component/Semaphore/LICENSE index 7fa9539054928..f2345234aa9ea 100644 --- a/src/Symfony/Component/Semaphore/LICENSE +++ b/src/Symfony/Component/Semaphore/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2022 Fabien Potencier +Copyright (c) 2016-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Serializer/LICENSE b/src/Symfony/Component/Serializer/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Serializer/LICENSE +++ b/src/Symfony/Component/Serializer/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index c5141e71452f5..a29654cbea4fa 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -156,14 +156,7 @@ protected function setAttributeValue(object $object, string $attribute, mixed $v $key = \get_class($object).':'.$setter; if (!isset(self::$setterAccessibleCache[$key])) { - try { - // We have to use is_callable() here since method_exists() - // does not "see" protected/private methods - self::$setterAccessibleCache[$key] = \is_callable([$object, $setter]) && !(new \ReflectionMethod($object, $setter))->isStatic(); - } catch (\ReflectionException $e) { - // Method does not exist in the class, probably a magic method - self::$setterAccessibleCache[$key] = false; - } + self::$setterAccessibleCache[$key] = method_exists($object, $setter) && \is_callable([$object, $setter]) && !(new \ReflectionMethod($object, $setter))->isStatic(); } if (self::$setterAccessibleCache[$key]) { diff --git a/src/Symfony/Component/Stopwatch/LICENSE b/src/Symfony/Component/Stopwatch/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Stopwatch/LICENSE +++ b/src/Symfony/Component/Stopwatch/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/String/LICENSE b/src/Symfony/Component/String/LICENSE index 9c907a46a6218..5c7ba0551cb65 100644 --- a/src/Symfony/Component/String/LICENSE +++ b/src/Symfony/Component/String/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019-2022 Fabien Potencier +Copyright (c) 2019-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Templating/LICENSE b/src/Symfony/Component/Templating/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Templating/LICENSE +++ b/src/Symfony/Component/Templating/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Translation/Bridge/Crowdin/LICENSE b/src/Symfony/Component/Translation/Bridge/Crowdin/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Translation/Bridge/Crowdin/LICENSE +++ b/src/Symfony/Component/Translation/Bridge/Crowdin/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Translation/Bridge/Loco/LICENSE b/src/Symfony/Component/Translation/Bridge/Loco/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Translation/Bridge/Loco/LICENSE +++ b/src/Symfony/Component/Translation/Bridge/Loco/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Translation/Bridge/Lokalise/LICENSE b/src/Symfony/Component/Translation/Bridge/Lokalise/LICENSE index 48d17c4fb34f1..d354b95ffee02 100644 --- a/src/Symfony/Component/Translation/Bridge/Lokalise/LICENSE +++ b/src/Symfony/Component/Translation/Bridge/Lokalise/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 Fabien Potencier +Copyright (c) 2021-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Translation/LICENSE b/src/Symfony/Component/Translation/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Translation/LICENSE +++ b/src/Symfony/Component/Translation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Uid/LICENSE b/src/Symfony/Component/Uid/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Component/Uid/LICENSE +++ b/src/Symfony/Component/Uid/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Uid/Tests/UuidTest.php b/src/Symfony/Component/Uid/Tests/UuidTest.php index 3e3c36c02ab03..8e73eb0d2d057 100644 --- a/src/Symfony/Component/Uid/Tests/UuidTest.php +++ b/src/Symfony/Component/Uid/Tests/UuidTest.php @@ -170,6 +170,25 @@ public function testIsValid() $this->assertTrue(UuidV4::isValid(self::A_UUID_V4)); } + public function testIsValidWithNilUuid() + { + $this->assertTrue(Uuid::isValid('00000000-0000-0000-0000-000000000000')); + $this->assertTrue(NilUuid::isValid('00000000-0000-0000-0000-000000000000')); + + $this->assertFalse(UuidV1::isValid('00000000-0000-0000-0000-000000000000')); + $this->assertFalse(UuidV4::isValid('00000000-0000-0000-0000-000000000000')); + } + + public function testIsValidWithMaxUuid() + { + $this->assertTrue(Uuid::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff')); + $this->assertTrue(Uuid::isValid('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF')); + $this->assertTrue(Uuid::isValid('fFFFFFFF-ffff-FFFF-FFFF-FFFFffFFFFFF')); + + $this->assertFalse(UuidV5::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff')); + $this->assertFalse(UuidV6::isValid('ffffffff-ffff-ffff-ffff-ffffffffffff')); + } + public function testEquals() { $uuid1 = new UuidV1(self::A_UUID_V1); diff --git a/src/Symfony/Component/Uid/Uuid.php b/src/Symfony/Component/Uid/Uuid.php index 70f3476595b92..8b571067545fd 100644 --- a/src/Symfony/Component/Uid/Uuid.php +++ b/src/Symfony/Component/Uid/Uuid.php @@ -55,7 +55,7 @@ public static function fromString(string $uuid): static $uuid = substr_replace($uuid, '-', 18, 0); $uuid = substr_replace($uuid, '-', 23, 0); } elseif (26 === \strlen($uuid) && Ulid::isValid($uuid)) { - $ulid = new Ulid('00000000000000000000000000'); + $ulid = new NilUlid(); $ulid->uid = strtoupper($uuid); $uuid = $ulid->toRfc4122(); } @@ -115,6 +115,14 @@ final public static function v6(): UuidV6 public static function isValid(string $uuid): bool { + if (self::NIL === $uuid && \in_array(static::class, [__CLASS__, NilUuid::class], true)) { + return true; + } + + if (__CLASS__ === static::class && 'ffffffff-ffff-ffff-ffff-ffffffffffff' === strtr($uuid, 'F', 'f')) { + return true; + } + if (!preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){2}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$}Di', $uuid)) { return false; } diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 744f619fa7762..cddcb4e573a81 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -16,6 +16,7 @@ use Egulias\EmailValidator\Validation\NoRFCWarningsValidation; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\LogicException; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; @@ -71,7 +72,7 @@ public function validate(mixed $value, Constraint $constraint) if (null === $constraint->mode) { if (Email::VALIDATION_MODE_STRICT === $this->defaultMode && !class_exists(EguliasEmailValidator::class)) { - throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', EguliasEmailValidator::class)); + throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', Email::class)); } $constraint->mode = $this->defaultMode; diff --git a/src/Symfony/Component/Validator/Constraints/IbanValidator.php b/src/Symfony/Component/Validator/Constraints/IbanValidator.php index 3e9c15f7e115a..eaeb9aac40fc4 100644 --- a/src/Symfony/Component/Validator/Constraints/IbanValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IbanValidator.php @@ -102,7 +102,7 @@ class IbanValidator extends ConstraintValidator 'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia, Former Yugoslav Republic of 'ML' => 'ML\d{2}[A-Z]{1}\d{23}', // Mali 'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Martinique - 'MR' => 'MR13\d{5}\d{5}\d{11}\d{2}', // Mauritania + '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 'MU' => 'MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}', // Mauritius 'MZ' => 'MZ\d{2}\d{21}', // Mozambique @@ -127,7 +127,7 @@ class IbanValidator extends ConstraintValidator 'SN' => 'SN\d{2}[A-Z]{1}\d{23}', // Senegal 'TF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Southern Territories 'TL' => 'TL\d{2}\d{3}\d{14}\d{2}', // Timor-Leste - 'TN' => 'TN59\d{2}\d{3}\d{13}\d{2}', // Tunisia + 'TN' => 'TN\d{2}\d{2}\d{3}\d{13}\d{2}', // Tunisia 'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey 'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine 'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State diff --git a/src/Symfony/Component/Validator/Constraints/UniqueValidator.php b/src/Symfony/Component/Validator/Constraints/UniqueValidator.php index c47c63bb6e6a8..578d5f746698f 100644 --- a/src/Symfony/Component/Validator/Constraints/UniqueValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UniqueValidator.php @@ -79,7 +79,7 @@ private function reduceElementKeys(array $fields, array $element): array if (!\is_string($field)) { throw new UnexpectedTypeException($field, 'string'); } - if (isset($element[$field])) { + if (\array_key_exists($field, $element)) { $output[$field] = $element[$field]; } } diff --git a/src/Symfony/Component/Validator/LICENSE b/src/Symfony/Component/Validator/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Validator/LICENSE +++ b/src/Symfony/Component/Validator/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php index 2f045ccf64ff7..aa5a72a785726 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php @@ -280,6 +280,14 @@ public function getInvalidCollectionValues(): array ['id' => 1, 'email' => 'bar@email.com'], ['id' => 1, 'email' => 'foo@email.com'], ], ['id']], + 'unique null' => [ + [null, null], + [], + ], + 'unique field null' => [ + [['nullField' => null], ['nullField' => null]], + ['nullField'], + ], ]; } } diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index 2691295eada91..d6e690c02e8b5 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -39,7 +39,7 @@ "symfony/property-info": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0", "doctrine/annotations": "^1.13|^2", - "egulias/email-validator": "^2.1.10|^3" + "egulias/email-validator": "^2.1.10|^3|^4" }, "conflict": { "doctrine/annotations": "<1.13", diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 22401e62dd158..e74888d41317e 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -167,9 +167,9 @@ protected function getDumpHeader() }; refStyle.innerHTML = 'pre.sf-dump .sf-dump-compact, .sf-dump-str-collapse .sf-dump-str-collapse, .sf-dump-str-expand .sf-dump-str-expand { display: none; }'; -(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); +doc.head.appendChild(refStyle); refStyle = doc.createElement('style'); -(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); +doc.head.appendChild(refStyle); if (!doc.addEventListener) { addEventListener = function (element, eventName, callback) { diff --git a/src/Symfony/Component/VarDumper/LICENSE b/src/Symfony/Component/VarDumper/LICENSE index a843ec124ea70..72412a62b2029 100644 --- a/src/Symfony/Component/VarDumper/LICENSE +++ b/src/Symfony/Component/VarDumper/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2022 Fabien Potencier +Copyright (c) 2014-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php index f4be025c351fe..66cd5fbeda660 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php @@ -22,7 +22,7 @@ class CasterTest extends TestCase { use VarDumperTestTrait; - private $referenceArray = [ + private static $referenceArray = [ 'null' => null, 'empty' => false, 'public' => 'pub', @@ -38,12 +38,12 @@ class CasterTest extends TestCase public function testFilter($filter, $expectedDiff, $listedProperties = null) { if (null === $listedProperties) { - $filteredArray = Caster::filter($this->referenceArray, $filter); + $filteredArray = Caster::filter(self::$referenceArray, $filter); } else { - $filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties); + $filteredArray = Caster::filter(self::$referenceArray, $filter, $listedProperties); } - $this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray)); + $this->assertSame($expectedDiff, array_diff_assoc(self::$referenceArray, $filteredArray)); } public function provideFilter() @@ -126,7 +126,7 @@ public function provideFilter() ], [ Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE, - $this->referenceArray, + self::$referenceArray, ['public', "\0*\0protected"], ], [ diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index f7ef22df5c241..5e8c76dda6271 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -151,6 +151,7 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount } if (null !== $sleep) { if (!isset($sleep[$n]) || ($i && $c !== $class)) { + unset($arrayValue[$name]); continue; } $sleep[$n] = false; @@ -166,6 +167,9 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount } } } + if (method_exists($class, '__unserialize')) { + $properties = $arrayValue; + } prepare_value: $objectsPool[$value] = [$id = \count($objectsPool)]; @@ -196,7 +200,7 @@ public static function export($value, $indent = '') case true === $value: return 'true'; case null === $value: return 'null'; case '' === $value: return "''"; - case $value instanceof \UnitEnum: return ltrim(var_export($value, true), '\\'); + case $value instanceof \UnitEnum: return '\\'.ltrim(var_export($value, true), '\\'); } if ($value instanceof Reference) { diff --git a/src/Symfony/Component/VarExporter/LICENSE b/src/Symfony/Component/VarExporter/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Component/VarExporter/LICENSE +++ b/src/Symfony/Component/VarExporter/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/VarExporter/Tests/Fixtures/__unserialize-but-no-__serialize.php b/src/Symfony/Component/VarExporter/Tests/Fixtures/__unserialize-but-no-__serialize.php new file mode 100644 index 0000000000000..987999b8d2cfa --- /dev/null +++ b/src/Symfony/Component/VarExporter/Tests/Fixtures/__unserialize-but-no-__serialize.php @@ -0,0 +1,15 @@ + 'ccc', + ], + ] +); diff --git a/src/Symfony/Component/VarExporter/Tests/Fixtures/unit-enum.php b/src/Symfony/Component/VarExporter/Tests/Fixtures/unit-enum.php index 48ab51dd0141b..98bc12272ed5d 100644 --- a/src/Symfony/Component/VarExporter/Tests/Fixtures/unit-enum.php +++ b/src/Symfony/Component/VarExporter/Tests/Fixtures/unit-enum.php @@ -1,5 +1,5 @@ foo = 'ccc'; + } + + public function __unserialize(array $data): void + { + $this->foo = $data['foo']; + } +} diff --git a/src/Symfony/Component/WebLink/LICENSE b/src/Symfony/Component/WebLink/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/WebLink/LICENSE +++ b/src/Symfony/Component/WebLink/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php b/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php index 5c04414273815..47d5d6ff276f6 100644 --- a/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Workflow\Dumper; -use InvalidArgumentException; use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Marking; use Symfony\Component\Workflow\Metadata\MetadataStoreInterface; @@ -57,7 +56,7 @@ class PlantUmlDumper implements DumperInterface public function __construct(string $transitionType) { if (!\in_array($transitionType, self::TRANSITION_TYPES, true)) { - throw new InvalidArgumentException("Transition type '$transitionType' does not exist."); + throw new \InvalidArgumentException("Transition type '$transitionType' does not exist."); } $this->transitionType = $transitionType; } @@ -209,9 +208,7 @@ private function getState(string $place, Definition $definition, Marking $markin $description = $workflowMetadata->getMetadata('description', $place); if (null !== $description) { - $output .= ' as '.$place. - \PHP_EOL. - $place.' : '.$description; + $output .= \PHP_EOL.$placeEscaped.' : '.$description; } return $output; diff --git a/src/Symfony/Component/Workflow/LICENSE b/src/Symfony/Component/Workflow/LICENSE index a843ec124ea70..72412a62b2029 100644 --- a/src/Symfony/Component/Workflow/LICENSE +++ b/src/Symfony/Component/Workflow/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2022 Fabien Potencier +Copyright (c) 2014-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php index 85c67969b8488..0c750fc750255 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php @@ -12,9 +12,12 @@ namespace Symfony\Component\Workflow\Tests\Dumper; use PHPUnit\Framework\TestCase; +use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Dumper\PlantUmlDumper; use Symfony\Component\Workflow\Marking; +use Symfony\Component\Workflow\Metadata\InMemoryMetadataStore; use Symfony\Component\Workflow\Tests\WorkflowBuilderTrait; +use Symfony\Component\Workflow\Transition; class PlantUmlDumperTest extends TestCase { @@ -63,6 +66,34 @@ public function provideStateMachineDefinitionWithoutMarking() yield [$this->createComplexStateMachineDefinition(), $marking, 'complex-state-machine-marking', 'SimpleDiagram']; } + public function testDumpWorkflowWithSpacesInTheStateNamesAndDescription() + { + $dumper = new PlantUmlDumper(PlantUmlDumper::WORKFLOW_TRANSITION); + + // The graph looks like: + // + // +---------+ t 1 +----------+ | + // | place a | -----> | place b | | + // +---------+ +----------+ | + $places = ['place a', 'place b']; + + $transitions = []; + $transition = new Transition('t 1', 'place a', 'place b'); + $transitions[] = $transition; + + $placesMetadata = []; + $placesMetadata['place a'] = [ + 'description' => 'My custom place description', + ]; + $inMemoryMetadataStore = new InMemoryMetadataStore([], $placesMetadata); + $definition = new Definition($places, $transitions, null, $inMemoryMetadataStore); + + $dump = $dumper->dump($definition, null, ['title' => 'SimpleDiagram']); + $dump = str_replace(\PHP_EOL, "\n", $dump.\PHP_EOL); + $file = $this->getFixturePath('simple-workflow-with-spaces', PlantUmlDumper::WORKFLOW_TRANSITION); + $this->assertStringEqualsFile($file, $dump); + } + private function getFixturePath($name, $transitionType) { return __DIR__.'/../fixtures/puml/'.$transitionType.'/'.$name.'.puml'; diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml index 0ea138f83f725..1e8a2ea0f6b86 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml @@ -17,8 +17,8 @@ skinparam agent { } state "a" <> state "b" <> -state "c" <> as c -c : My custom place description +state "c" <> +"c" : My custom place description agent "t1" agent "t2" "a" -[#Purple]-> "t1": "My custom transition label 2" diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml index 02e7f396eacb3..b57dc5b1fab43 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml @@ -17,8 +17,8 @@ skinparam agent { } state "a" <> state "b" -state "c" <> as c -c : My custom place description +state "c" <> +"c" : My custom place description agent "t1" agent "t2" "a" -[#Purple]-> "t1": "My custom transition label 2" diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-with-spaces.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-with-spaces.puml new file mode 100644 index 0000000000000..0e20d27198024 --- /dev/null +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-with-spaces.puml @@ -0,0 +1,23 @@ +@startuml +allow_mixing +title SimpleDiagram +skinparam titleBorderRoundCorner 15 +skinparam titleBorderThickness 2 +skinparam state { + BackgroundColor<> #87b741 + BackgroundColor<> #3887C6 + BorderColor #3887C6 + BorderColor<> Black + FontColor<> White +} +skinparam agent { + BackgroundColor #ffffff + BorderColor #3887C6 +} +state "place a" <> +"place a" : My custom place description +state "place b" +agent "t 1" +"place a" --> "t 1" +"t 1" --> "place b" +@enduml diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index b085b28f041d0..4e84dbc0730a9 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -50,7 +50,7 @@ public static function initialize(int $flags, int $parsedLineNumber = null, stri /** * Converts a YAML string to a PHP value. * - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior * @param array $references Mapping of variable names to values * * @throws ParseException diff --git a/src/Symfony/Component/Yaml/LICENSE b/src/Symfony/Component/Yaml/LICENSE index 88bf75bb4d6a2..008370457251e 100644 --- a/src/Symfony/Component/Yaml/LICENSE +++ b/src/Symfony/Component/Yaml/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 48ab44b9e69d5..991f1213eb539 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -43,7 +43,7 @@ class Parser * Parses a YAML file into a PHP value. * * @param string $filename The path to the YAML file to be parsed - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior * * @throws ParseException If the file could not be read or the YAML is not valid */ @@ -70,7 +70,7 @@ public function parseFile(string $filename, int $flags = 0): mixed * Parses a YAML string to a PHP value. * * @param string $value A YAML string - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior * * @throws ParseException If the YAML is not valid */ @@ -694,7 +694,7 @@ private function moveToPreviousLine(): bool * Parses a YAML value. * * @param string $value A YAML value - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior * @param string $context The parser context (either sequence or mapping) * * @throws ParseException When reference does not exist diff --git a/src/Symfony/Contracts/Cache/LICENSE b/src/Symfony/Contracts/Cache/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/Cache/LICENSE +++ b/src/Symfony/Contracts/Cache/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/Deprecation/LICENSE b/src/Symfony/Contracts/Deprecation/LICENSE index 406242ff28554..0f262c225767a 100644 --- a/src/Symfony/Contracts/Deprecation/LICENSE +++ b/src/Symfony/Contracts/Deprecation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020-2022 Fabien Potencier +Copyright (c) 2020-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/EventDispatcher/LICENSE b/src/Symfony/Contracts/EventDispatcher/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/EventDispatcher/LICENSE +++ b/src/Symfony/Contracts/EventDispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/HttpClient/LICENSE b/src/Symfony/Contracts/HttpClient/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/HttpClient/LICENSE +++ b/src/Symfony/Contracts/HttpClient/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/LICENSE b/src/Symfony/Contracts/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/LICENSE +++ b/src/Symfony/Contracts/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/Service/LICENSE b/src/Symfony/Contracts/Service/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/Service/LICENSE +++ b/src/Symfony/Contracts/Service/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Contracts/Translation/LICENSE b/src/Symfony/Contracts/Translation/LICENSE index 74cdc2dbf6dbe..99757d517117d 100644 --- a/src/Symfony/Contracts/Translation/LICENSE +++ b/src/Symfony/Contracts/Translation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2022 Fabien Potencier +Copyright (c) 2018-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal