Merge branch '5.1'
* 5.1: (28 commits) [DI] fix Use "composer/package-versions-deprecated" when possible Fix Small update in our internal terminology Fix support for PHP8 union types [VarDumper] fix typo [Lock][Messenger] Fix precedence of DSN options for 5.1 Fix support for PHP8 union types [FrameworkBundle] preserve dots in query-string when redirecting [3.4] Fix support for PHP8 union types [PhpUnitBridge] Streamline ansi/no-ansi of composer according to phpunit --colors option [3.4] Small update in our internal terminology [Cache] fix compat with DBAL v3 Remove unnecessary null check [HttpFoundation] Allow `null` in InputBag@set [HttpClient] Convert CurlHttpClient::handlePush() to instance method Fix package rename when releasing bumped Symfony version to 5.1.3 updated VERSION for 5.1.2 updated CHANGELOG for 5.1.2 ...
This commit is contained in:
commit
092632dc14
|
@ -7,6 +7,16 @@ in 5.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 for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
||||||
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.1.0...v5.1.1
|
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.1.0...v5.1.1
|
||||||
|
|
||||||
|
* 5.1.2 (2020-06-15)
|
||||||
|
|
||||||
|
* bug #37265 [HttpFoundation] use InputBag for Request::$request only if data is coming from a form (nicolas-grekas)
|
||||||
|
* bug #37283 [SecurityBundle] Fix CookieClearingLogoutListener DI configuration (wouterj)
|
||||||
|
* bug #37160 Reset question validator attempts only for actual stdin (ostrolucky)
|
||||||
|
* bug #36975 [PropertyInfo] Make PhpDocExtractor compatible with phpDocumentor v5 (DerManoMann)
|
||||||
|
* bug #37279 [Form] Fixed prototype block prefixes hierarchy of the CollectionType (yceruto)
|
||||||
|
* bug #37276 [Form] Fixed block prefixes hierarchy of the CollectionType (yceruto)
|
||||||
|
* bug #37261 Fix register csrf protection listener (Ne-Lexa)
|
||||||
|
|
||||||
* 5.1.1 (2020-06-12)
|
* 5.1.1 (2020-06-12)
|
||||||
|
|
||||||
* bug #37227 [DependencyInjection][CheckTypeDeclarationsPass] Handle unresolved parameters pointing to environment variables (fancyweb)
|
* bug #37227 [DependencyInjection][CheckTypeDeclarationsPass] Handle unresolved parameters pointing to environment variables (fancyweb)
|
||||||
|
|
|
@ -65,18 +65,18 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Kevin Bond (kbond)
|
- Kevin Bond (kbond)
|
||||||
- Saša Stamenković (umpirsky)
|
- Saša Stamenković (umpirsky)
|
||||||
- Peter Rehm (rpet)
|
- Peter Rehm (rpet)
|
||||||
|
- Gábor Egyed (1ed)
|
||||||
- Gabriel Ostrolucký (gadelat)
|
- Gabriel Ostrolucký (gadelat)
|
||||||
- Henrik Bjørnskov (henrikbjorn)
|
- Henrik Bjørnskov (henrikbjorn)
|
||||||
- Gábor Egyed (1ed)
|
|
||||||
- Miha Vrhovnik
|
- Miha Vrhovnik
|
||||||
- David Maicher (dmaicher)
|
- David Maicher (dmaicher)
|
||||||
|
- Titouan Galopin (tgalopin)
|
||||||
- Diego Saint Esteben (dii3g0)
|
- Diego Saint Esteben (dii3g0)
|
||||||
- Jan Schädlich (jschaedl)
|
- Jan Schädlich (jschaedl)
|
||||||
- Titouan Galopin (tgalopin)
|
|
||||||
- Konstantin Kudryashov (everzet)
|
- Konstantin Kudryashov (everzet)
|
||||||
|
- Vladimir Reznichenko (kalessil)
|
||||||
- Bilal Amarni (bamarni)
|
- Bilal Amarni (bamarni)
|
||||||
- Mathieu Piot (mpiot)
|
- Mathieu Piot (mpiot)
|
||||||
- Vladimir Reznichenko (kalessil)
|
|
||||||
- Florin Patan (florinpatan)
|
- Florin Patan (florinpatan)
|
||||||
- Jáchym Toušek (enumag)
|
- Jáchym Toušek (enumag)
|
||||||
- Andrej Hudec (pulzarraider)
|
- Andrej Hudec (pulzarraider)
|
||||||
|
@ -91,12 +91,12 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Henrik Westphal (snc)
|
- Henrik Westphal (snc)
|
||||||
- Dariusz Górecki (canni)
|
- Dariusz Górecki (canni)
|
||||||
- David Buchmann (dbu)
|
- David Buchmann (dbu)
|
||||||
|
- Jérôme Tamarelle (gromnan)
|
||||||
- Graham Campbell (graham)
|
- Graham Campbell (graham)
|
||||||
- Dariusz Ruminski
|
- Dariusz Ruminski
|
||||||
- Lee McDermott
|
- Lee McDermott
|
||||||
- Brandon Turner
|
- Brandon Turner
|
||||||
- Luis Cordova (cordoval)
|
- Luis Cordova (cordoval)
|
||||||
- Jérôme Tamarelle (gromnan)
|
|
||||||
- Daniel Holmes (dholmes)
|
- Daniel Holmes (dholmes)
|
||||||
- Toni Uebernickel (havvg)
|
- Toni Uebernickel (havvg)
|
||||||
- Fran Moreno (franmomu)
|
- Fran Moreno (franmomu)
|
||||||
|
@ -106,11 +106,11 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Antoine Hérault (herzult)
|
- Antoine Hérault (herzult)
|
||||||
- Paráda József (paradajozsef)
|
- Paráda József (paradajozsef)
|
||||||
- Arnaud Le Blanc (arnaud-lb)
|
- Arnaud Le Blanc (arnaud-lb)
|
||||||
|
- Sebastiaan Stok (sstok)
|
||||||
- Maxime STEINHAUSSER
|
- Maxime STEINHAUSSER
|
||||||
- Baptiste Clavié (talus)
|
- Baptiste Clavié (talus)
|
||||||
- Michal Piotrowski (eventhorizon)
|
- Michal Piotrowski (eventhorizon)
|
||||||
- Tim Nagel (merk)
|
- Tim Nagel (merk)
|
||||||
- Sebastiaan Stok (sstok)
|
|
||||||
- Chris Wilkinson (thewilkybarkid)
|
- Chris Wilkinson (thewilkybarkid)
|
||||||
- Brice BERNARD (brikou)
|
- Brice BERNARD (brikou)
|
||||||
- marc.weistroff
|
- marc.weistroff
|
||||||
|
@ -170,6 +170,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Philipp Wahala (hifi)
|
- Philipp Wahala (hifi)
|
||||||
- Rafael Dohms (rdohms)
|
- Rafael Dohms (rdohms)
|
||||||
- jwdeitch
|
- jwdeitch
|
||||||
|
- Ahmed TAILOULOUTE (ahmedtai)
|
||||||
- Mikael Pajunen
|
- Mikael Pajunen
|
||||||
- Arman Hosseini (arman)
|
- Arman Hosseini (arman)
|
||||||
- Niels Keurentjes (curry684)
|
- Niels Keurentjes (curry684)
|
||||||
|
@ -177,7 +178,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Richard van Laak (rvanlaak)
|
- Richard van Laak (rvanlaak)
|
||||||
- Richard Shank (iampersistent)
|
- Richard Shank (iampersistent)
|
||||||
- Thomas Rabaix (rande)
|
- Thomas Rabaix (rande)
|
||||||
- Ahmed TAILOULOUTE (ahmedtai)
|
|
||||||
- Vincent Touzet (vincenttouzet)
|
- Vincent Touzet (vincenttouzet)
|
||||||
- jeremyFreeAgent (jeremyfreeagent)
|
- jeremyFreeAgent (jeremyfreeagent)
|
||||||
- Rouven Weßling (realityking)
|
- Rouven Weßling (realityking)
|
||||||
|
@ -198,6 +198,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- GDIBass
|
- GDIBass
|
||||||
- Samuel NELA (snela)
|
- Samuel NELA (snela)
|
||||||
- Saif (╯°□°)╯ (azjezz)
|
- Saif (╯°□°)╯ (azjezz)
|
||||||
|
- Gary PEGEOT (gary-p)
|
||||||
- James Halsall (jaitsu)
|
- James Halsall (jaitsu)
|
||||||
- Matthieu Napoli (mnapoli)
|
- Matthieu Napoli (mnapoli)
|
||||||
- Florent Mata (fmata)
|
- Florent Mata (fmata)
|
||||||
|
@ -220,7 +221,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- DQNEO
|
- DQNEO
|
||||||
- Andre Rømcke (andrerom)
|
- Andre Rømcke (andrerom)
|
||||||
- mcfedr (mcfedr)
|
- mcfedr (mcfedr)
|
||||||
- Gary PEGEOT (gary-p)
|
|
||||||
- Ruben Gonzalez (rubenrua)
|
- Ruben Gonzalez (rubenrua)
|
||||||
- Benjamin Dulau (dbenjamin)
|
- Benjamin Dulau (dbenjamin)
|
||||||
- Jan Rosier (rosier)
|
- Jan Rosier (rosier)
|
||||||
|
@ -244,6 +244,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Matthieu Bontemps (mbontemps)
|
- Matthieu Bontemps (mbontemps)
|
||||||
- apetitpa
|
- apetitpa
|
||||||
- Pierre Minnieur (pminnieur)
|
- Pierre Minnieur (pminnieur)
|
||||||
|
- David Prévot
|
||||||
- fivestar
|
- fivestar
|
||||||
- Dominique Bongiraud
|
- Dominique Bongiraud
|
||||||
- Jeremy Livingston (jeremylivingston)
|
- Jeremy Livingston (jeremylivingston)
|
||||||
|
@ -277,7 +278,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Ruud Kamphuis (ruudk)
|
- Ruud Kamphuis (ruudk)
|
||||||
- Pavel Batanov (scaytrase)
|
- Pavel Batanov (scaytrase)
|
||||||
- Mantis Development
|
- Mantis Development
|
||||||
- David Prévot
|
|
||||||
- Loïc Faugeron
|
- Loïc Faugeron
|
||||||
- Hidde Wieringa (hiddewie)
|
- Hidde Wieringa (hiddewie)
|
||||||
- dFayet
|
- dFayet
|
||||||
|
@ -371,6 +371,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Chris Smith (cs278)
|
- Chris Smith (cs278)
|
||||||
- Thomas Bisignani (toma)
|
- Thomas Bisignani (toma)
|
||||||
- Florian Klein (docteurklein)
|
- Florian Klein (docteurklein)
|
||||||
|
- Benjamin Leveque (benji07)
|
||||||
- Manuel Kiessling (manuelkiessling)
|
- Manuel Kiessling (manuelkiessling)
|
||||||
- Atsuhiro KUBO (iteman)
|
- Atsuhiro KUBO (iteman)
|
||||||
- rudy onfroy (ronfroy)
|
- rudy onfroy (ronfroy)
|
||||||
|
@ -407,6 +408,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Dariusz Rumiński
|
- Dariusz Rumiński
|
||||||
- Berny Cantos (xphere81)
|
- Berny Cantos (xphere81)
|
||||||
- Thierry Thuon (lepiaf)
|
- Thierry Thuon (lepiaf)
|
||||||
|
- Guilhem N (guilhemn)
|
||||||
- Ricard Clau (ricardclau)
|
- Ricard Clau (ricardclau)
|
||||||
- Mark Challoner (markchalloner)
|
- Mark Challoner (markchalloner)
|
||||||
- Philippe Segatori
|
- Philippe Segatori
|
||||||
|
@ -432,6 +434,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Tomasz Kowalczyk (thunderer)
|
- Tomasz Kowalczyk (thunderer)
|
||||||
- Artur Eshenbrener
|
- Artur Eshenbrener
|
||||||
- Timo Bakx (timobakx)
|
- Timo Bakx (timobakx)
|
||||||
|
- Harm van Tilborg (hvt)
|
||||||
- Thomas Perez (scullwm)
|
- Thomas Perez (scullwm)
|
||||||
- Felix Labrecque
|
- Felix Labrecque
|
||||||
- Yaroslav Kiliba
|
- Yaroslav Kiliba
|
||||||
|
@ -471,7 +474,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Michele Locati
|
- Michele Locati
|
||||||
- Pavel Volokitin (pvolok)
|
- Pavel Volokitin (pvolok)
|
||||||
- Valentine Boineau (valentineboineau)
|
- Valentine Boineau (valentineboineau)
|
||||||
- Benjamin Leveque (benji07)
|
|
||||||
- Arthur de Moulins (4rthem)
|
- Arthur de Moulins (4rthem)
|
||||||
- Matthias Althaus (althaus)
|
- Matthias Althaus (althaus)
|
||||||
- Nicolas Dewez (nicolas_dewez)
|
- Nicolas Dewez (nicolas_dewez)
|
||||||
|
@ -516,10 +518,11 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Steffen Roßkamp
|
- Steffen Roßkamp
|
||||||
- Alexandru Furculita (afurculita)
|
- Alexandru Furculita (afurculita)
|
||||||
- Valentin Jonovs (valentins-jonovs)
|
- Valentin Jonovs (valentins-jonovs)
|
||||||
- Guilhem N (guilhemn)
|
- Sebastien Morel (plopix)
|
||||||
- Jeanmonod David (jeanmonod)
|
- Jeanmonod David (jeanmonod)
|
||||||
- Christopher Davis (chrisguitarguy)
|
- Christopher Davis (chrisguitarguy)
|
||||||
- Webnet team (webnet)
|
- Webnet team (webnet)
|
||||||
|
- Joe Bennett (kralos)
|
||||||
- Farhad Safarov
|
- Farhad Safarov
|
||||||
- Jan Schumann
|
- Jan Schumann
|
||||||
- Niklas Fiekas
|
- Niklas Fiekas
|
||||||
|
@ -556,6 +559,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Ariel Ferrandini (aferrandini)
|
- Ariel Ferrandini (aferrandini)
|
||||||
- Dirk Pahl (dirkaholic)
|
- Dirk Pahl (dirkaholic)
|
||||||
- cedric lombardot (cedriclombardot)
|
- cedric lombardot (cedriclombardot)
|
||||||
|
- Arkadius Stefanski (arkadius)
|
||||||
- Tim Goudriaan (codedmonkey)
|
- Tim Goudriaan (codedmonkey)
|
||||||
- Jonas Flodén (flojon)
|
- Jonas Flodén (flojon)
|
||||||
- Tobias Weichart
|
- Tobias Weichart
|
||||||
|
@ -621,6 +625,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Maks Slesarenko
|
- Maks Slesarenko
|
||||||
- Filip Procházka (fprochazka)
|
- Filip Procházka (fprochazka)
|
||||||
- mmoreram
|
- mmoreram
|
||||||
|
- Jeroen Thora (bolle)
|
||||||
- Markus Lanthaler (lanthaler)
|
- Markus Lanthaler (lanthaler)
|
||||||
- Remi Collet
|
- Remi Collet
|
||||||
- Vicent Soria Durá (vicentgodella)
|
- Vicent Soria Durá (vicentgodella)
|
||||||
|
@ -688,6 +693,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Pavel Campr (pcampr)
|
- Pavel Campr (pcampr)
|
||||||
- Andrii Dembitskyi
|
- Andrii Dembitskyi
|
||||||
- Johnny Robeson (johnny)
|
- Johnny Robeson (johnny)
|
||||||
|
- Thomas Landauer (thomas-landauer)
|
||||||
- Guilliam Xavier
|
- Guilliam Xavier
|
||||||
- Disquedur
|
- Disquedur
|
||||||
- Michiel Boeckaert (milio)
|
- Michiel Boeckaert (milio)
|
||||||
|
@ -701,13 +707,11 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Piotr Stankowski
|
- Piotr Stankowski
|
||||||
- Baptiste Leduc (bleduc)
|
- Baptiste Leduc (bleduc)
|
||||||
- Julien Maulny
|
- Julien Maulny
|
||||||
- Sebastien Morel (plopix)
|
|
||||||
- Jean-Christophe Cuvelier [Artack]
|
- Jean-Christophe Cuvelier [Artack]
|
||||||
- Julien Montel (julienmgel)
|
- Julien Montel (julienmgel)
|
||||||
- Simon DELICATA
|
- Simon DELICATA
|
||||||
- Artem Henvald (artemgenvald)
|
- Artem Henvald (artemgenvald)
|
||||||
- Dmitry Simushev
|
- Dmitry Simushev
|
||||||
- Joe Bennett (kralos)
|
|
||||||
- alcaeus
|
- alcaeus
|
||||||
- Thomas Talbot (ioni)
|
- Thomas Talbot (ioni)
|
||||||
- Fred Cox
|
- Fred Cox
|
||||||
|
@ -722,10 +726,12 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Marvin Butkereit
|
- Marvin Butkereit
|
||||||
- Renan
|
- Renan
|
||||||
- Ricky Su (ricky)
|
- Ricky Su (ricky)
|
||||||
|
- Marcin Szepczynski (czepol)
|
||||||
- Kyle Evans (kevans91)
|
- Kyle Evans (kevans91)
|
||||||
- Charles-Henri Bruyand
|
- Charles-Henri Bruyand
|
||||||
- Max Rath (drak3)
|
- Max Rath (drak3)
|
||||||
- Stéphane Escandell (sescandell)
|
- Stéphane Escandell (sescandell)
|
||||||
|
- Baptiste Leduc (korbeil)
|
||||||
- Konstantin S. M. Möllers (ksmmoellers)
|
- Konstantin S. M. Möllers (ksmmoellers)
|
||||||
- James Johnston
|
- James Johnston
|
||||||
- Noémi Salaün (noemi-salaun)
|
- Noémi Salaün (noemi-salaun)
|
||||||
|
@ -776,7 +782,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- maxime.steinhausser
|
- maxime.steinhausser
|
||||||
- adev
|
- adev
|
||||||
- Stefan Warman
|
- Stefan Warman
|
||||||
- Arkadius Stefanski (arkadius)
|
|
||||||
- Tristan Maindron (tmaindron)
|
- Tristan Maindron (tmaindron)
|
||||||
- Behnoush Norouzali (behnoush)
|
- Behnoush Norouzali (behnoush)
|
||||||
- Wesley Lancel
|
- Wesley Lancel
|
||||||
|
@ -949,12 +954,10 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Jayson Xu (superjavason)
|
- Jayson Xu (superjavason)
|
||||||
- Hubert Lenoir (hubert_lenoir)
|
- Hubert Lenoir (hubert_lenoir)
|
||||||
- fago
|
- fago
|
||||||
- Harm van Tilborg
|
|
||||||
- Jan Prieser
|
- Jan Prieser
|
||||||
- GDIBass
|
- GDIBass
|
||||||
- Antoine Lamirault
|
- Antoine Lamirault
|
||||||
- Adrien Lucas (adrienlucas)
|
- Adrien Lucas (adrienlucas)
|
||||||
- Jeroen Thora (bolle)
|
|
||||||
- Zhuravlev Alexander (scif)
|
- Zhuravlev Alexander (scif)
|
||||||
- Stefano Degenkamp (steef)
|
- Stefano Degenkamp (steef)
|
||||||
- James Michael DuPont
|
- James Michael DuPont
|
||||||
|
@ -1038,7 +1041,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Don Pinkster
|
- Don Pinkster
|
||||||
- Maksim Muruev
|
- Maksim Muruev
|
||||||
- Emil Einarsson
|
- Emil Einarsson
|
||||||
- Thomas Landauer
|
|
||||||
- 243083df
|
- 243083df
|
||||||
- Thibault Duplessis
|
- Thibault Duplessis
|
||||||
- Rimas Kudelis
|
- Rimas Kudelis
|
||||||
|
@ -1060,6 +1062,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Hugo Alliaume (kocal)
|
- Hugo Alliaume (kocal)
|
||||||
- Marcos Gómez Vilches (markitosgv)
|
- Marcos Gómez Vilches (markitosgv)
|
||||||
- Matthew Davis (mdavis1982)
|
- Matthew Davis (mdavis1982)
|
||||||
|
- Paulo Ribeiro (paulo)
|
||||||
- Markus S. (staabm)
|
- Markus S. (staabm)
|
||||||
- Benjamin Morel
|
- Benjamin Morel
|
||||||
- Maks
|
- Maks
|
||||||
|
@ -1118,7 +1121,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- xaav
|
- xaav
|
||||||
- Mahmoud Mostafa (mahmoud)
|
- Mahmoud Mostafa (mahmoud)
|
||||||
- Antonio Jose Cerezo (ajcerezo)
|
- Antonio Jose Cerezo (ajcerezo)
|
||||||
- Baptiste Leduc (korbeil)
|
|
||||||
- Ahmed Abdou
|
- Ahmed Abdou
|
||||||
- Daniel Iwaniec
|
- Daniel Iwaniec
|
||||||
- Thomas Ferney
|
- Thomas Ferney
|
||||||
|
@ -1157,6 +1159,8 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- zairig imad (zairigimad)
|
- zairig imad (zairigimad)
|
||||||
- Anton Babenko (antonbabenko)
|
- Anton Babenko (antonbabenko)
|
||||||
- Irmantas Šiupšinskas (irmantas)
|
- Irmantas Šiupšinskas (irmantas)
|
||||||
|
- Benoit Mallo
|
||||||
|
- Lescot Edouard (idetox)
|
||||||
- Danilo Silva
|
- Danilo Silva
|
||||||
- Giuseppe Campanelli
|
- Giuseppe Campanelli
|
||||||
- Arnaud PETITPAS (apetitpa)
|
- Arnaud PETITPAS (apetitpa)
|
||||||
|
@ -1226,11 +1230,13 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- gr1ev0us
|
- gr1ev0us
|
||||||
- mlazovla
|
- mlazovla
|
||||||
- Alejandro Diaz Torres
|
- Alejandro Diaz Torres
|
||||||
|
- quentin neyrat (qneyrat)
|
||||||
- Max Beutel
|
- Max Beutel
|
||||||
- Jan Vernieuwe (vernija)
|
- Jan Vernieuwe (vernija)
|
||||||
- Antanas Arvasevicius
|
- Antanas Arvasevicius
|
||||||
- Pierre Dudoret
|
- Pierre Dudoret
|
||||||
- Thomas
|
- Thomas
|
||||||
|
- j.schmitt
|
||||||
- Maximilian Berghoff (electricmaxxx)
|
- Maximilian Berghoff (electricmaxxx)
|
||||||
- nacho
|
- nacho
|
||||||
- Piotr Antosik (antek88)
|
- Piotr Antosik (antek88)
|
||||||
|
@ -1326,7 +1332,9 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Carlos Ortega Huetos
|
- Carlos Ortega Huetos
|
||||||
- rpg600
|
- rpg600
|
||||||
- Péter Buri (burci)
|
- Péter Buri (burci)
|
||||||
|
- John VanDeWeghe
|
||||||
- kaiwa
|
- kaiwa
|
||||||
|
- Claude Khedhiri (ck-developer)
|
||||||
- Charles Sanquer (csanquer)
|
- Charles Sanquer (csanquer)
|
||||||
- Albert Ganiev (helios-ag)
|
- Albert Ganiev (helios-ag)
|
||||||
- Neil Katin
|
- Neil Katin
|
||||||
|
@ -1363,6 +1371,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- arnaud (arnooo999)
|
- arnaud (arnooo999)
|
||||||
- Gilles Doge (gido)
|
- Gilles Doge (gido)
|
||||||
- Oscar Esteve (oesteve)
|
- Oscar Esteve (oesteve)
|
||||||
|
- Sobhan Sharifi (50bhan)
|
||||||
- abulford
|
- abulford
|
||||||
- Philipp Kretzschmar
|
- Philipp Kretzschmar
|
||||||
- antograssiot
|
- antograssiot
|
||||||
|
@ -1412,6 +1421,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Marc Torres
|
- Marc Torres
|
||||||
- Mark Spink
|
- Mark Spink
|
||||||
- Alberto Aldegheri
|
- Alberto Aldegheri
|
||||||
|
- Sagrario Meneses
|
||||||
- Dmitri Petmanson
|
- Dmitri Petmanson
|
||||||
- heccjj
|
- heccjj
|
||||||
- Alexandre Melard
|
- Alexandre Melard
|
||||||
|
@ -1731,7 +1741,9 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Przemysław Piechota (kibao)
|
- Przemysław Piechota (kibao)
|
||||||
- Leonid Terentyev (li0n)
|
- Leonid Terentyev (li0n)
|
||||||
- Martynas Sudintas (martiis)
|
- Martynas Sudintas (martiis)
|
||||||
|
- Douglas Hammond (wizhippo)
|
||||||
- ryunosuke
|
- ryunosuke
|
||||||
|
- Bruno BOUTAREL
|
||||||
- victoria
|
- victoria
|
||||||
- Francisco Facioni (fran6co)
|
- Francisco Facioni (fran6co)
|
||||||
- Stanislav Gamayunov (happyproff)
|
- Stanislav Gamayunov (happyproff)
|
||||||
|
@ -1864,6 +1876,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Pavel.Batanov
|
- Pavel.Batanov
|
||||||
- avi123
|
- avi123
|
||||||
- Pavel Prischepa
|
- Pavel Prischepa
|
||||||
|
- Sami Mussbach
|
||||||
- alsar
|
- alsar
|
||||||
- downace
|
- downace
|
||||||
- Aarón Nieves Fernández
|
- Aarón Nieves Fernández
|
||||||
|
@ -1891,6 +1904,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Brian Graham (incognito)
|
- Brian Graham (incognito)
|
||||||
- Kevin Vergauwen (innocenzo)
|
- Kevin Vergauwen (innocenzo)
|
||||||
- Alessio Baglio (ioalessio)
|
- Alessio Baglio (ioalessio)
|
||||||
|
- Jeroen Noten (jeroennoten)
|
||||||
- Johannes Müller (johmue)
|
- Johannes Müller (johmue)
|
||||||
- Jordi Llonch (jordillonch)
|
- Jordi Llonch (jordillonch)
|
||||||
- Nicholas Ruunu (nicholasruunu)
|
- Nicholas Ruunu (nicholasruunu)
|
||||||
|
@ -1911,6 +1925,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Alexey Popkov
|
- Alexey Popkov
|
||||||
- Gijs Kunze
|
- Gijs Kunze
|
||||||
- Artyom Protaskin
|
- Artyom Protaskin
|
||||||
|
- Steven Dubois
|
||||||
- Nathanael d. Noblet
|
- Nathanael d. Noblet
|
||||||
- helmer
|
- helmer
|
||||||
- ged15
|
- ged15
|
||||||
|
@ -1983,6 +1998,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Andrew Marcinkevičius (ifdattic)
|
- Andrew Marcinkevičius (ifdattic)
|
||||||
- Ioana Hazsda (ioana-hazsda)
|
- Ioana Hazsda (ioana-hazsda)
|
||||||
- Jan Marek (janmarek)
|
- Jan Marek (janmarek)
|
||||||
|
- Dmitriy Mamontov (mamontovdmitriy)
|
||||||
- Mark de Haan (markdehaan)
|
- Mark de Haan (markdehaan)
|
||||||
- Dan Patrick (mdpatrick)
|
- Dan Patrick (mdpatrick)
|
||||||
- naitsirch (naitsirch)
|
- naitsirch (naitsirch)
|
||||||
|
@ -2343,6 +2359,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Ben Miller
|
- Ben Miller
|
||||||
- Peter Gribanov
|
- Peter Gribanov
|
||||||
- Matteo Galli
|
- Matteo Galli
|
||||||
|
- Loenix
|
||||||
- kwiateusz
|
- kwiateusz
|
||||||
- jspee
|
- jspee
|
||||||
- Ilya Bulakh
|
- Ilya Bulakh
|
||||||
|
@ -2466,7 +2483,6 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- Marco Petersen (ocrampete16)
|
- Marco Petersen (ocrampete16)
|
||||||
- ollie harridge (ollietb)
|
- ollie harridge (ollietb)
|
||||||
- Paul Andrieux (paulandrieux)
|
- Paul Andrieux (paulandrieux)
|
||||||
- Paulo Ribeiro (paulo)
|
|
||||||
- Paweł Szczepanek (pauluz)
|
- Paweł Szczepanek (pauluz)
|
||||||
- Philippe Degeeter (pdegeeter)
|
- Philippe Degeeter (pdegeeter)
|
||||||
- Christian López Espínola (penyaskito)
|
- Christian López Espínola (penyaskito)
|
||||||
|
@ -2521,6 +2537,7 @@ Symfony is the result of the work of many people who made the code better
|
||||||
- MaPePeR
|
- MaPePeR
|
||||||
- Andreas Streichardt
|
- Andreas Streichardt
|
||||||
- Alexandre Segura
|
- Alexandre Segura
|
||||||
|
- Marco Pfeiffer
|
||||||
- Vivien
|
- Vivien
|
||||||
- Pascal Hofmann
|
- Pascal Hofmann
|
||||||
- david-binda
|
- david-binda
|
||||||
|
|
|
@ -107,6 +107,7 @@
|
||||||
"async-aws/ses": "^1.0",
|
"async-aws/ses": "^1.0",
|
||||||
"async-aws/sqs": "^1.0",
|
"async-aws/sqs": "^1.0",
|
||||||
"cache/integration-tests": "dev-master",
|
"cache/integration-tests": "dev-master",
|
||||||
|
"composer/package-versions-deprecated": "^1.8",
|
||||||
"doctrine/annotations": "~1.0",
|
"doctrine/annotations": "~1.0",
|
||||||
"doctrine/cache": "~1.6",
|
"doctrine/cache": "~1.6",
|
||||||
"doctrine/collections": "~1.0",
|
"doctrine/collections": "~1.0",
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
"symfony/service-contracts": "^1.1|^2"
|
"symfony/service-contracts": "^1.1|^2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"composer/package-versions-deprecated": "^1.8",
|
||||||
"symfony/stopwatch": "^4.4|^5.0",
|
"symfony/stopwatch": "^4.4|^5.0",
|
||||||
"symfony/cache": "^5.1",
|
"symfony/cache": "^5.1",
|
||||||
"symfony/config": "^4.4|^5.0",
|
"symfony/config": "^4.4|^5.0",
|
||||||
|
|
|
@ -23,7 +23,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
*/
|
*/
|
||||||
class NotFoundActivationStrategy extends ErrorLevelActivationStrategy
|
class NotFoundActivationStrategy extends ErrorLevelActivationStrategy
|
||||||
{
|
{
|
||||||
private $blacklist;
|
private $exclude;
|
||||||
private $requestStack;
|
private $requestStack;
|
||||||
|
|
||||||
public function __construct(RequestStack $requestStack, array $excludedUrls, $actionLevel)
|
public function __construct(RequestStack $requestStack, array $excludedUrls, $actionLevel)
|
||||||
|
@ -31,7 +31,7 @@ class NotFoundActivationStrategy extends ErrorLevelActivationStrategy
|
||||||
parent::__construct($actionLevel);
|
parent::__construct($actionLevel);
|
||||||
|
|
||||||
$this->requestStack = $requestStack;
|
$this->requestStack = $requestStack;
|
||||||
$this->blacklist = '{('.implode('|', $excludedUrls).')}i';
|
$this->exclude = '{('.implode('|', $excludedUrls).')}i';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isHandlerActivated(array $record): bool
|
public function isHandlerActivated(array $record): bool
|
||||||
|
@ -45,7 +45,7 @@ class NotFoundActivationStrategy extends ErrorLevelActivationStrategy
|
||||||
&& 404 == $record['context']['exception']->getStatusCode()
|
&& 404 == $record['context']['exception']->getStatusCode()
|
||||||
&& ($request = $this->requestStack->getMasterRequest())
|
&& ($request = $this->requestStack->getMasterRequest())
|
||||||
) {
|
) {
|
||||||
return !preg_match($this->blacklist, $request->getPathInfo());
|
return !preg_match($this->exclude, $request->getPathInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isActivated;
|
return $isActivated;
|
||||||
|
|
|
@ -182,15 +182,21 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_array('--colors=never', $argv, true) || (isset($argv[$i = array_search('never', $argv, true) - 1]) && '--colors' === $argv[$i])) {
|
||||||
|
$COMPOSER .= ' --no-ansi';
|
||||||
|
} else {
|
||||||
|
$COMPOSER .= ' --ansi';
|
||||||
|
}
|
||||||
|
|
||||||
$info += [
|
$info += [
|
||||||
'versions' => [],
|
'versions' => [],
|
||||||
'requires' => ['php' => '*'],
|
'requires' => ['php' => '*'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (1 === \count($info['versions'])) {
|
if (1 === \count($info['versions'])) {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
} else {
|
} else {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
||||||
|
@ -220,7 +226,7 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
||||||
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
||||||
$q = '\\' === DIRECTORY_SEPARATOR ? '"' : '';
|
$q = '\\' === DIRECTORY_SEPARATOR ? '"' : '';
|
||||||
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
|
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
|
||||||
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", [], $p, getcwd()));
|
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
|
||||||
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
|
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
exit($exit);
|
exit($exit);
|
||||||
|
|
|
@ -62,7 +62,17 @@ class RedirectController
|
||||||
$attributes = [];
|
$attributes = [];
|
||||||
if (false === $ignoreAttributes || \is_array($ignoreAttributes)) {
|
if (false === $ignoreAttributes || \is_array($ignoreAttributes)) {
|
||||||
$attributes = $request->attributes->get('_route_params');
|
$attributes = $request->attributes->get('_route_params');
|
||||||
$attributes = $keepQueryParams ? array_merge($request->query->all(), $attributes) : $attributes;
|
|
||||||
|
if ($keepQueryParams) {
|
||||||
|
if ($query = $request->server->get('QUERY_STRING')) {
|
||||||
|
$query = self::parseQuery($query);
|
||||||
|
} else {
|
||||||
|
$query = $request->query->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
$attributes = array_merge($query, $attributes);
|
||||||
|
}
|
||||||
|
|
||||||
unset($attributes['route'], $attributes['permanent'], $attributes['ignoreAttributes'], $attributes['keepRequestMethod'], $attributes['keepQueryParams']);
|
unset($attributes['route'], $attributes['permanent'], $attributes['ignoreAttributes'], $attributes['keepRequestMethod'], $attributes['keepQueryParams']);
|
||||||
if ($ignoreAttributes) {
|
if ($ignoreAttributes) {
|
||||||
$attributes = array_diff_key($attributes, array_flip($ignoreAttributes));
|
$attributes = array_diff_key($attributes, array_flip($ignoreAttributes));
|
||||||
|
@ -117,8 +127,7 @@ class RedirectController
|
||||||
$scheme = $request->getScheme();
|
$scheme = $request->getScheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$qs = $request->getQueryString();
|
if ($qs = $request->server->get('QUERY_STRING') ?: $request->getQueryString()) {
|
||||||
if ($qs) {
|
|
||||||
if (false === strpos($path, '?')) {
|
if (false === strpos($path, '?')) {
|
||||||
$qs = '?'.$qs;
|
$qs = '?'.$qs;
|
||||||
} else {
|
} else {
|
||||||
|
@ -176,4 +185,49 @@ class RedirectController
|
||||||
|
|
||||||
throw new \RuntimeException(sprintf('The parameter "path" or "route" is required to configure the redirect action in "%s" routing configuration.', $request->attributes->get('_route')));
|
throw new \RuntimeException(sprintf('The parameter "path" or "route" is required to configure the redirect action in "%s" routing configuration.', $request->attributes->get('_route')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function parseQuery(string $query)
|
||||||
|
{
|
||||||
|
$q = [];
|
||||||
|
|
||||||
|
foreach (explode('&', $query) as $v) {
|
||||||
|
if (false !== $i = strpos($v, "\0")) {
|
||||||
|
$v = substr($v, 0, $i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $i = strpos($v, '=')) {
|
||||||
|
$k = urldecode($v);
|
||||||
|
$v = '';
|
||||||
|
} else {
|
||||||
|
$k = urldecode(substr($v, 0, $i));
|
||||||
|
$v = substr($v, $i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== $i = strpos($k, "\0")) {
|
||||||
|
$k = substr($k, 0, $i);
|
||||||
|
}
|
||||||
|
|
||||||
|
$k = ltrim($k, ' ');
|
||||||
|
|
||||||
|
if (false === $i = strpos($k, '[')) {
|
||||||
|
$q[] = bin2hex($k).$v;
|
||||||
|
} else {
|
||||||
|
$q[] = substr_replace($k, bin2hex(substr($k, 0, $i)), 0, $i).$v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_str(implode('&', $q), $q);
|
||||||
|
|
||||||
|
$query = [];
|
||||||
|
|
||||||
|
foreach ($q as $k => $v) {
|
||||||
|
if (false !== $i = strpos($k, '_')) {
|
||||||
|
$query[substr_replace($k, hex2bin(substr($k, 0, $i)).'[', 0, 1 + $i)] = $v;
|
||||||
|
} else {
|
||||||
|
$query[hex2bin($k)] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ trait MicroKernelTrait
|
||||||
throw new \LogicException(sprintf('"%s" uses "%s", but does not implement the required method "protected function configureContainer(ContainerConfigurator $c): void".', get_debug_type($this), MicroKernelTrait::class), 0, $e);
|
throw new \LogicException(sprintf('"%s" uses "%s", but does not implement the required method "protected function configureContainer(ContainerConfigurator $c): void".', get_debug_type($this), MicroKernelTrait::class), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$configuratorClass = $configureContainer->getNumberOfParameters() > 0 && ($type = $configureContainer->getParameters()[0]->getType()) && !$type->isBuiltin() ? $type->getName() : null;
|
$configuratorClass = $configureContainer->getNumberOfParameters() > 0 && ($type = $configureContainer->getParameters()[0]->getType()) instanceof \ReflectionNamedType && !$type->isBuiltin() ? $type->getName() : null;
|
||||||
|
|
||||||
if ($configuratorClass && !is_a(ContainerConfigurator::class, $configuratorClass, true)) {
|
if ($configuratorClass && !is_a(ContainerConfigurator::class, $configuratorClass, true)) {
|
||||||
$this->configureContainer($container, $loader);
|
$this->configureContainer($container, $loader);
|
||||||
|
|
|
@ -267,9 +267,9 @@ class RedirectControllerTest extends TestCase
|
||||||
return [
|
return [
|
||||||
['http://www.example.com/base/redirect-path', '/redirect-path', ''],
|
['http://www.example.com/base/redirect-path', '/redirect-path', ''],
|
||||||
['http://www.example.com/base/redirect-path?foo=bar', '/redirect-path?foo=bar', ''],
|
['http://www.example.com/base/redirect-path?foo=bar', '/redirect-path?foo=bar', ''],
|
||||||
['http://www.example.com/base/redirect-path?foo=bar', '/redirect-path', 'foo=bar'],
|
['http://www.example.com/base/redirect-path?f.o=bar', '/redirect-path', 'f.o=bar'],
|
||||||
['http://www.example.com/base/redirect-path?foo=bar&abc=example', '/redirect-path?foo=bar', 'abc=example'],
|
['http://www.example.com/base/redirect-path?f.o=bar&a.c=example', '/redirect-path?f.o=bar', 'a.c=example'],
|
||||||
['http://www.example.com/base/redirect-path?foo=bar&abc=example&baz=def', '/redirect-path?foo=bar', 'abc=example&baz=def'],
|
['http://www.example.com/base/redirect-path?f.o=bar&a.c=example&b.z=def', '/redirect-path?f.o=bar', 'a.c=example&b.z=def'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,17 +302,16 @@ class RedirectControllerTest extends TestCase
|
||||||
$baseUrl = '/base';
|
$baseUrl = '/base';
|
||||||
$port = 80;
|
$port = 80;
|
||||||
|
|
||||||
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'base=zaza');
|
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza');
|
||||||
$request->query = new ParameterBag(['base' => 'zaza']);
|
|
||||||
$request->attributes = new ParameterBag(['_route_params' => ['base2' => 'zaza']]);
|
$request->attributes = new ParameterBag(['_route_params' => ['base2' => 'zaza']]);
|
||||||
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
||||||
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?base=zaza&base2=zaza')->with('/test', ['base' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
|
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?b.se=zaza&base2=zaza')->with('/test', ['b.se' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
|
||||||
$controller = new RedirectController($urlGenerator);
|
$controller = new RedirectController($urlGenerator);
|
||||||
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?base=zaza&base2=zaza');
|
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zaza&base2=zaza');
|
||||||
|
|
||||||
$request->attributes->set('_route_params', ['base2' => 'zaza', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
|
$request->attributes->set('_route_params', ['base2' => 'zaza', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
|
||||||
$this->assertRedirectUrl($controller($request), '/test?base=zaza&base2=zaza');
|
$this->assertRedirectUrl($controller($request), '/test?b.se=zaza&base2=zaza');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRedirectWithQueryWithRouteParamsOveriding()
|
public function testRedirectWithQueryWithRouteParamsOveriding()
|
||||||
|
@ -322,17 +321,16 @@ class RedirectControllerTest extends TestCase
|
||||||
$baseUrl = '/base';
|
$baseUrl = '/base';
|
||||||
$port = 80;
|
$port = 80;
|
||||||
|
|
||||||
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'base=zaza');
|
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza');
|
||||||
$request->query = new ParameterBag(['base' => 'zaza']);
|
$request->attributes = new ParameterBag(['_route_params' => ['b.se' => 'zouzou']]);
|
||||||
$request->attributes = new ParameterBag(['_route_params' => ['base' => 'zouzou']]);
|
|
||||||
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
|
||||||
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?base=zouzou')->with('/test', ['base' => 'zouzou'], UrlGeneratorInterface::ABSOLUTE_URL);
|
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?b.se=zouzou')->with('/test', ['b.se' => 'zouzou'], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
|
|
||||||
$controller = new RedirectController($urlGenerator);
|
$controller = new RedirectController($urlGenerator);
|
||||||
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?base=zouzou');
|
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zouzou');
|
||||||
|
|
||||||
$request->attributes->set('_route_params', ['base' => 'zouzou', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
|
$request->attributes->set('_route_params', ['b.se' => 'zouzou', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
|
||||||
$this->assertRedirectUrl($controller($request), '/test?base=zouzou');
|
$this->assertRedirectUrl($controller($request), '/test?b.se=zouzou');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMissingPathOrRouteParameter()
|
public function testMissingPathOrRouteParameter()
|
||||||
|
@ -353,29 +351,20 @@ class RedirectControllerTest extends TestCase
|
||||||
|
|
||||||
private function createRequestObject($scheme, $host, $port, $baseUrl, $queryString = '')
|
private function createRequestObject($scheme, $host, $port, $baseUrl, $queryString = '')
|
||||||
{
|
{
|
||||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
|
if ('' !== $queryString) {
|
||||||
$request
|
parse_str($queryString, $query);
|
||||||
->expects($this->any())
|
} else {
|
||||||
->method('getScheme')
|
$query = [];
|
||||||
->willReturn($scheme);
|
}
|
||||||
$request
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getHost')
|
|
||||||
->willReturn($host);
|
|
||||||
$request
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getPort')
|
|
||||||
->willReturn($port);
|
|
||||||
$request
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getBaseUrl')
|
|
||||||
->willReturn($baseUrl);
|
|
||||||
$request
|
|
||||||
->expects($this->any())
|
|
||||||
->method('getQueryString')
|
|
||||||
->willReturn($queryString);
|
|
||||||
|
|
||||||
return $request;
|
return new Request($query, [], [], [], [], [
|
||||||
|
'HTTPS' => 'https' === $scheme,
|
||||||
|
'HTTP_HOST' => $host.($port ? ':'.$port : ''),
|
||||||
|
'SERVER_PORT' => $port,
|
||||||
|
'SCRIPT_FILENAME' => $baseUrl,
|
||||||
|
'REQUEST_URI' => $baseUrl,
|
||||||
|
'QUERY_STRING' => $queryString,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createRedirectController($httpPort = null, $httpsPort = null)
|
private function createRedirectController($httpPort = null, $httpsPort = null)
|
||||||
|
|
|
@ -435,26 +435,31 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
||||||
if ($this->conn instanceof \PDO) {
|
if ($this->conn instanceof \PDO) {
|
||||||
$this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME);
|
$this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME);
|
||||||
} else {
|
} else {
|
||||||
switch ($this->driver = $this->conn->getDriver()->getName()) {
|
$driver = $this->conn->getDriver();
|
||||||
case 'mysqli':
|
|
||||||
|
switch (true) {
|
||||||
|
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
|
||||||
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
|
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
|
||||||
case 'pdo_mysql':
|
|
||||||
case 'drizzle_pdo_mysql':
|
case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
|
||||||
$this->driver = 'mysql';
|
$this->driver = 'mysql';
|
||||||
break;
|
break;
|
||||||
case 'pdo_sqlite':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
|
||||||
$this->driver = 'sqlite';
|
$this->driver = 'sqlite';
|
||||||
break;
|
break;
|
||||||
case 'pdo_pgsql':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
|
||||||
$this->driver = 'pgsql';
|
$this->driver = 'pgsql';
|
||||||
break;
|
break;
|
||||||
case 'oci8':
|
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
|
||||||
case 'pdo_oracle':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
|
||||||
$this->driver = 'oci';
|
$this->driver = 'oci';
|
||||||
break;
|
break;
|
||||||
case 'pdo_sqlsrv':
|
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
|
||||||
$this->driver = 'sqlsrv';
|
$this->driver = 'sqlsrv';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$this->driver = \get_class($driver);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||||
if (!$parametersWithUndefinedConstants) {
|
if (!$parametersWithUndefinedConstants) {
|
||||||
yield preg_replace('/^ @@.*/m', '', $m);
|
yield preg_replace('/^ @@.*/m', '', $m);
|
||||||
} else {
|
} else {
|
||||||
|
$t = $m->getReturnType();
|
||||||
$stack = [
|
$stack = [
|
||||||
$m->getDocComment(),
|
$m->getDocComment(),
|
||||||
$m->getName(),
|
$m->getName(),
|
||||||
|
@ -179,15 +180,16 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||||
$m->isPrivate(),
|
$m->isPrivate(),
|
||||||
$m->isProtected(),
|
$m->isProtected(),
|
||||||
$m->returnsReference(),
|
$m->returnsReference(),
|
||||||
$m->hasReturnType() ? $m->getReturnType()->getName() : '',
|
$t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($m->getParameters() as $p) {
|
foreach ($m->getParameters() as $p) {
|
||||||
if (!isset($parametersWithUndefinedConstants[$p->name])) {
|
if (!isset($parametersWithUndefinedConstants[$p->name])) {
|
||||||
$stack[] = (string) $p;
|
$stack[] = (string) $p;
|
||||||
} else {
|
} else {
|
||||||
|
$t = $p->getType();
|
||||||
$stack[] = $p->isOptional();
|
$stack[] = $p->isOptional();
|
||||||
$stack[] = $p->hasType() ? $p->getType()->getName() : '';
|
$stack[] = $t instanceof \ReflectionNamedType ? ((string) $t->allowsNull()).$t->getName() : (string) $t;
|
||||||
$stack[] = $p->isPassedByReference();
|
$stack[] = $p->isPassedByReference();
|
||||||
$stack[] = $p->isVariadic();
|
$stack[] = $p->isVariadic();
|
||||||
$stack[] = $p->getName();
|
$stack[] = $p->getName();
|
||||||
|
|
|
@ -42,7 +42,7 @@ class AutowireRequiredPropertiesPass extends AbstractRecursivePass
|
||||||
|
|
||||||
$properties = $value->getProperties();
|
$properties = $value->getProperties();
|
||||||
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
||||||
if (!$reflectionProperty->hasType()) {
|
if (!($type = $reflectionProperty->getType()) instanceof \ReflectionNamedType) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (false === $doc = $reflectionProperty->getDocComment()) {
|
if (false === $doc = $reflectionProperty->getDocComment()) {
|
||||||
|
@ -55,7 +55,7 @@ class AutowireRequiredPropertiesPass extends AbstractRecursivePass
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = $reflectionProperty->getType()->getName();
|
$type = $type->getName();
|
||||||
$value->setProperty($name, new TypedReference($type, $type, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name));
|
$value->setProperty($name, new TypedReference($type, $type, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,9 +153,26 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
|
||||||
/**
|
/**
|
||||||
* @throws InvalidParameterTypeException When a parameter is not compatible with the declared type
|
* @throws InvalidParameterTypeException When a parameter is not compatible with the declared type
|
||||||
*/
|
*/
|
||||||
private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix): void
|
private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, string $type = null): void
|
||||||
{
|
{
|
||||||
$type = $parameter->getType()->getName();
|
if (null === $type) {
|
||||||
|
$type = $parameter->getType();
|
||||||
|
|
||||||
|
if ($type instanceof \ReflectionUnionType) {
|
||||||
|
foreach ($type->getTypes() as $type) {
|
||||||
|
try {
|
||||||
|
$this->checkType($checkedDefinition, $value, $parameter, $envPlaceholderUniquePrefix, $type);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} catch (InvalidParameterTypeException $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidParameterTypeException($this->currentId, $e->getCode(), $parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $type->getName();
|
||||||
|
}
|
||||||
|
|
||||||
if ($value instanceof Reference) {
|
if ($value instanceof Reference) {
|
||||||
if (!$this->container->has($value = (string) $value)) {
|
if (!$this->container->has($value = (string) $value)) {
|
||||||
|
@ -266,7 +283,7 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$checkFunction = sprintf('is_%s', $parameter->getType()->getName());
|
$checkFunction = sprintf('is_%s', $type);
|
||||||
|
|
||||||
if (!$parameter->getType()->isBuiltin() || !$checkFunction($value)) {
|
if (!$parameter->getType()->isBuiltin() || !$checkFunction($value)) {
|
||||||
throw new InvalidParameterTypeException($this->currentId, \is_object($value) ? $class : get_debug_type($value), $parameter);
|
throw new InvalidParameterTypeException($this->currentId, \is_object($value) ? $class : get_debug_type($value), $parameter);
|
||||||
|
|
|
@ -227,7 +227,7 @@ class PhpDumper extends Dumper
|
||||||
$regex = preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex;
|
$regex = preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex;
|
||||||
} while (0 < --$i);
|
} while (0 < --$i);
|
||||||
|
|
||||||
$this->targetDirRegex = '#'.preg_quote($dir[0], '#').$regex.'#';
|
$this->targetDirRegex = '#(^|file://|[:;, \|\r\n])'.preg_quote($dir[0], '#').$regex.'#';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2030,11 +2030,12 @@ EOF;
|
||||||
private function export($value)
|
private function export($value)
|
||||||
{
|
{
|
||||||
if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) {
|
if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) {
|
||||||
$prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : '';
|
|
||||||
$suffix = $matches[0][1] + \strlen($matches[0][0]);
|
$suffix = $matches[0][1] + \strlen($matches[0][0]);
|
||||||
|
$matches[0][1] += \strlen($matches[1][0]);
|
||||||
|
$prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : '';
|
||||||
$suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : '';
|
$suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : '';
|
||||||
$dirname = $this->asFiles ? '$this->containerDir' : '__DIR__';
|
$dirname = $this->asFiles ? '$this->containerDir' : '__DIR__';
|
||||||
$offset = 1 + $this->targetDirMaxMatches - \count($matches);
|
$offset = 2 + $this->targetDirMaxMatches - \count($matches);
|
||||||
|
|
||||||
if (0 < $offset) {
|
if (0 < $offset) {
|
||||||
$dirname = sprintf('\dirname(__DIR__, %d)', $offset + (int) $this->asFiles);
|
$dirname = sprintf('\dirname(__DIR__, %d)', $offset + (int) $this->asFiles);
|
||||||
|
|
|
@ -67,7 +67,7 @@ final class Preloader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function doPreload(string $class, array &$preloaded)
|
private static function doPreload(string $class, array &$preloaded): void
|
||||||
{
|
{
|
||||||
if (isset($preloaded[$class]) || \in_array($class, ['self', 'static', 'parent'], true)) {
|
if (isset($preloaded[$class]) || \in_array($class, ['self', 'static', 'parent'], true)) {
|
||||||
return;
|
return;
|
||||||
|
@ -87,9 +87,7 @@ final class Preloader
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 70400) {
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
foreach ($r->getProperties(\ReflectionProperty::IS_PUBLIC) as $p) {
|
foreach ($r->getProperties(\ReflectionProperty::IS_PUBLIC) as $p) {
|
||||||
if (($t = $p->getType()) && !$t->isBuiltin()) {
|
self::preloadType($p->getType(), $preloaded);
|
||||||
self::doPreload($t->getName(), $preloaded);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,17 +101,26 @@ final class Preloader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($t = $p->getType()) && !$t->isBuiltin()) {
|
self::preloadType($p->getType(), $preloaded);
|
||||||
self::doPreload($t->getName(), $preloaded);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($t = $m->getReturnType()) && !$t->isBuiltin()) {
|
self::preloadType($p->getReturnType(), $preloaded);
|
||||||
self::doPreload($t->getName(), $preloaded);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (\ReflectionException $e) {
|
} catch (\ReflectionException $e) {
|
||||||
// ignore missing classes
|
// ignore missing classes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function preloadType(?\ReflectionType $t, array &$preloaded): void
|
||||||
|
{
|
||||||
|
if (!$t || $t->isBuiltin()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($t instanceof \ReflectionUnionType ? $t->getTypes() : [$t] as $t) {
|
||||||
|
if (!$t->isBuiltin()) {
|
||||||
|
self::doPreload($t instanceof \ReflectionNamedType ? $t->getName() : $t, $preloaded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,10 @@ class InvalidParameterTypeException extends InvalidArgumentException
|
||||||
{
|
{
|
||||||
public function __construct(string $serviceId, string $type, \ReflectionParameter $parameter)
|
public function __construct(string $serviceId, string $type, \ReflectionParameter $parameter)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $parameter->getType()->getName(), $type));
|
$acceptedType = $parameter->getType();
|
||||||
|
$acceptedType = $acceptedType instanceof \ReflectionNamedType ? $acceptedType->getName() : (string) $acceptedType;
|
||||||
|
$this->code = $type;
|
||||||
|
|
||||||
|
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $acceptedType, $type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,26 +31,36 @@ class ProxyHelper
|
||||||
if (!$type) {
|
if (!$type) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!\is_string($type)) {
|
|
||||||
$name = $type->getName();
|
$types = [];
|
||||||
|
|
||||||
|
foreach ($type instanceof \ReflectionUnionType ? $type->getTypes() : [$type] as $type) {
|
||||||
|
$name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type;
|
||||||
|
|
||||||
if ($type->isBuiltin()) {
|
if ($type->isBuiltin()) {
|
||||||
return $noBuiltin ? null : $name;
|
if (!$noBuiltin) {
|
||||||
|
$types[] = $name;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lcName = strtolower($name);
|
||||||
|
$prefix = $noBuiltin ? '' : '\\';
|
||||||
|
|
||||||
|
if ('self' !== $lcName && 'parent' !== $lcName) {
|
||||||
|
$types[] = '' !== $prefix ? $prefix.$name : $name;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$r instanceof \ReflectionMethod) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ('self' === $lcName) {
|
||||||
|
$types[] = $prefix.$r->getDeclaringClass()->name;
|
||||||
|
} else {
|
||||||
|
$types[] = ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$lcName = strtolower($name);
|
|
||||||
$prefix = $noBuiltin ? '' : '\\';
|
|
||||||
|
|
||||||
if ('self' !== $lcName && 'parent' !== $lcName) {
|
return $types ? implode('|', $types) : null;
|
||||||
return $prefix.$name;
|
|
||||||
}
|
|
||||||
if (!$r instanceof \ReflectionMethod) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ('self' === $lcName) {
|
|
||||||
return $prefix.$r->getDeclaringClass()->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class PhpDumperTest extends TestCase
|
||||||
|
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->setDefinition('test', $definition);
|
$container->setDefinition('test', $definition);
|
||||||
$container->setParameter('foo', 'wiz'.\dirname(__DIR__));
|
$container->setParameter('foo', 'file://'.\dirname(__DIR__));
|
||||||
$container->setParameter('bar', __DIR__);
|
$container->setParameter('bar', __DIR__);
|
||||||
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
|
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
|
||||||
$container->setParameter('buz', \dirname(__DIR__, 2));
|
$container->setParameter('buz', \dirname(__DIR__, 2));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ProjectServiceContainer extends Container
|
||||||
*/
|
*/
|
||||||
protected function getTestService()
|
protected function getTestService()
|
||||||
{
|
{
|
||||||
return $this->services['test'] = new \stdClass(('wiz'.\dirname(__DIR__, 1)), [('wiz'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]);
|
return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParameter(string $name)
|
public function getParameter(string $name)
|
||||||
|
@ -102,7 +102,7 @@ class ProjectServiceContainer extends Container
|
||||||
protected function getDefaultParameters(): array
|
protected function getDefaultParameters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'foo' => ('wiz'.\dirname(__DIR__, 1)),
|
'foo' => ('file://'.\dirname(__DIR__, 1)),
|
||||||
'bar' => __DIR__,
|
'bar' => __DIR__,
|
||||||
'baz' => (__DIR__.'/PhpDumperTest.php'),
|
'baz' => (__DIR__.'/PhpDumperTest.php'),
|
||||||
'buz' => \dirname(__DIR__, 2),
|
'buz' => \dirname(__DIR__, 2),
|
||||||
|
|
|
@ -187,7 +187,7 @@ class RegisterListenersPass implements CompilerPassInterface
|
||||||
|| !($r = $container->getReflectionClass($class, false))
|
|| !($r = $container->getReflectionClass($class, false))
|
||||||
|| !$r->hasMethod($method)
|
|| !$r->hasMethod($method)
|
||||||
|| 1 > ($m = $r->getMethod($method))->getNumberOfParameters()
|
|| 1 > ($m = $r->getMethod($method))->getNumberOfParameters()
|
||||||
|| !($type = $m->getParameters()[0]->getType())
|
|| !($type = $m->getParameters()[0]->getType()) instanceof \ReflectionNamedType
|
||||||
|| $type->isBuiltin()
|
|| $type->isBuiltin()
|
||||||
|| Event::class === ($name = $type->getName())
|
|| Event::class === ($name = $type->getName())
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpClient;
|
||||||
|
|
||||||
use Psr\Log\LoggerAwareInterface;
|
use Psr\Log\LoggerAwareInterface;
|
||||||
use Psr\Log\LoggerAwareTrait;
|
use Psr\Log\LoggerAwareTrait;
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
|
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\HttpClient\Exception\TransportException;
|
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||||
use Symfony\Component\HttpClient\Internal\CurlClientState;
|
use Symfony\Component\HttpClient\Internal\CurlClientState;
|
||||||
|
@ -71,7 +70,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||||
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);
|
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->multi = $multi = new CurlClientState();
|
$this->multi = new CurlClientState();
|
||||||
self::$curlVersion = self::$curlVersion ?? curl_version();
|
self::$curlVersion = self::$curlVersion ?? curl_version();
|
||||||
|
|
||||||
// Don't enable HTTP/1.1 pipelining: it forces responses to be sent in order
|
// Don't enable HTTP/1.1 pipelining: it forces responses to be sent in order
|
||||||
|
@ -95,10 +94,8 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logger = &$this->logger;
|
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, function ($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) {
|
||||||
|
return $this->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes);
|
||||||
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, static function ($parent, $pushed, array $requestHeaders) use ($multi, $maxPendingPushes, &$logger) {
|
|
||||||
return self::handlePush($parent, $pushed, $requestHeaders, $multi, $maxPendingPushes, $logger);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +358,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function handlePush($parent, $pushed, array $requestHeaders, CurlClientState $multi, int $maxPendingPushes, ?LoggerInterface $logger): int
|
private function handlePush($parent, $pushed, array $requestHeaders, int $maxPendingPushes): int
|
||||||
{
|
{
|
||||||
$headers = [];
|
$headers = [];
|
||||||
$origin = curl_getinfo($parent, CURLINFO_EFFECTIVE_URL);
|
$origin = curl_getinfo($parent, CURLINFO_EFFECTIVE_URL);
|
||||||
|
@ -373,7 +370,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($headers[':method']) || !isset($headers[':scheme']) || !isset($headers[':authority']) || !isset($headers[':path'])) {
|
if (!isset($headers[':method']) || !isset($headers[':scheme']) || !isset($headers[':authority']) || !isset($headers[':path'])) {
|
||||||
$logger && $logger->debug(sprintf('Rejecting pushed response from "%s": pushed headers are invalid', $origin));
|
$this->logger && $this->logger->debug(sprintf('Rejecting pushed response from "%s": pushed headers are invalid', $origin));
|
||||||
|
|
||||||
return CURL_PUSH_DENY;
|
return CURL_PUSH_DENY;
|
||||||
}
|
}
|
||||||
|
@ -384,21 +381,21 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||||
// but this is a MUST in the HTTP/2 RFC; let's restrict pushes to the original host,
|
// but this is a MUST in the HTTP/2 RFC; let's restrict pushes to the original host,
|
||||||
// ignoring domains mentioned as alt-name in the certificate for now (same as curl).
|
// ignoring domains mentioned as alt-name in the certificate for now (same as curl).
|
||||||
if (0 !== strpos($origin, $url.'/')) {
|
if (0 !== strpos($origin, $url.'/')) {
|
||||||
$logger && $logger->debug(sprintf('Rejecting pushed response from "%s": server is not authoritative for "%s"', $origin, $url));
|
$this->logger && $this->logger->debug(sprintf('Rejecting pushed response from "%s": server is not authoritative for "%s"', $origin, $url));
|
||||||
|
|
||||||
return CURL_PUSH_DENY;
|
return CURL_PUSH_DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($maxPendingPushes <= \count($multi->pushedResponses)) {
|
if ($maxPendingPushes <= \count($this->multi->pushedResponses)) {
|
||||||
$fifoUrl = key($multi->pushedResponses);
|
$fifoUrl = key($this->multi->pushedResponses);
|
||||||
unset($multi->pushedResponses[$fifoUrl]);
|
unset($this->multi->pushedResponses[$fifoUrl]);
|
||||||
$logger && $logger->debug(sprintf('Evicting oldest pushed response: "%s"', $fifoUrl));
|
$this->logger && $this->logger->debug(sprintf('Evicting oldest pushed response: "%s"', $fifoUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
$url .= $headers[':path'][0];
|
$url .= $headers[':path'][0];
|
||||||
$logger && $logger->debug(sprintf('Queueing pushed response: "%s"', $url));
|
$this->logger && $this->logger->debug(sprintf('Queueing pushed response: "%s"', $url));
|
||||||
|
|
||||||
$multi->pushedResponses[$url] = new PushedResponse(new CurlResponse($multi, $pushed), $headers, $multi->openHandles[(int) $parent][1] ?? [], $pushed);
|
$this->multi->pushedResponses[$url] = new PushedResponse(new CurlResponse($this->multi, $pushed), $headers, $this->multi->openHandles[(int) $parent][1] ?? [], $pushed);
|
||||||
|
|
||||||
return CURL_PUSH_OK;
|
return CURL_PUSH_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
|
||||||
$options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void {
|
$options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void {
|
||||||
if ($info['primary_ip'] !== $lastPrimaryIp) {
|
if ($info['primary_ip'] !== $lastPrimaryIp) {
|
||||||
if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) {
|
if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) {
|
||||||
throw new TransportException(sprintf('IP "%s" is blacklisted for "%s".', $info['primary_ip'], $info['url']));
|
throw new TransportException(sprintf('IP "%s" is blocked for "%s".', $info['primary_ip'], $info['url']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastPrimaryIp = $info['primary_ip'];
|
$lastPrimaryIp = $info['primary_ip'];
|
||||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||||
|
|
||||||
class NoPrivateNetworkHttpClientTest extends TestCase
|
class NoPrivateNetworkHttpClientTest extends TestCase
|
||||||
{
|
{
|
||||||
public function getBlacklistData(): array
|
public function getExcludeData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// private
|
// private
|
||||||
|
@ -63,16 +63,16 @@ class NoPrivateNetworkHttpClientTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getBlacklistData
|
* @dataProvider getExcludeData
|
||||||
*/
|
*/
|
||||||
public function testBlacklist(string $ipAddr, $subnets, bool $mustThrow)
|
public function testExclude(string $ipAddr, $subnets, bool $mustThrow)
|
||||||
{
|
{
|
||||||
$content = 'foo';
|
$content = 'foo';
|
||||||
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
|
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
|
||||||
|
|
||||||
if ($mustThrow) {
|
if ($mustThrow) {
|
||||||
$this->expectException(TransportException::class);
|
$this->expectException(TransportException::class);
|
||||||
$this->expectExceptionMessage(sprintf('IP "%s" is blacklisted for "%s".', $ipAddr, $url));
|
$this->expectExceptionMessage(sprintf('IP "%s" is blocked for "%s".', $ipAddr, $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
$previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content);
|
$previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content);
|
||||||
|
|
|
@ -72,12 +72,12 @@ final class InputBag extends ParameterBag
|
||||||
/**
|
/**
|
||||||
* Sets an input by name.
|
* Sets an input by name.
|
||||||
*
|
*
|
||||||
* @param string|array $value
|
* @param string|array|null $value
|
||||||
*/
|
*/
|
||||||
public function set(string $key, $value)
|
public function set(string $key, $value)
|
||||||
{
|
{
|
||||||
if (!is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
|
if (null !== $value && !is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
|
||||||
trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string or an array instead.', get_debug_type($value), __METHOD__);
|
trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string, array, or null instead.', get_debug_type($value), __METHOD__);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parameters[$key] = $value;
|
$this->parameters[$key] = $value;
|
||||||
|
|
|
@ -51,7 +51,7 @@ class InputBagTest extends TestCase
|
||||||
public function testSetWithNonStringishOrArrayIsDeprecated()
|
public function testSetWithNonStringishOrArrayIsDeprecated()
|
||||||
{
|
{
|
||||||
$bag = new InputBag();
|
$bag = new InputBag();
|
||||||
$this->expectDeprecation('Since symfony/http-foundation 5.1: Passing "Symfony\Component\HttpFoundation\InputBag" as a 2nd Argument to "Symfony\Component\HttpFoundation\InputBag::set()" is deprecated, pass a string or an array instead.');
|
$this->expectDeprecation('Since symfony/http-foundation 5.1: Passing "Symfony\Component\HttpFoundation\InputBag" as a 2nd Argument to "Symfony\Component\HttpFoundation\InputBag::set()" is deprecated, pass a string, array, or null instead.');
|
||||||
$bag->set('foo', new InputBag());
|
$bag->set('foo', new InputBag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
||||||
if (!$type = $parameter->getType()) {
|
if (!$type = $parameter->getType()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$name = $type->getName();
|
$name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type;
|
||||||
|
|
||||||
if ($function instanceof \ReflectionMethod) {
|
if ($function instanceof \ReflectionMethod) {
|
||||||
$lcName = strtolower($name);
|
$lcName = strtolower($name);
|
||||||
|
|
|
@ -127,10 +127,10 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
|
||||||
|
|
||||||
private function matchAnyRegexps(string $class, array $regexps): bool
|
private function matchAnyRegexps(string $class, array $regexps): bool
|
||||||
{
|
{
|
||||||
$blacklisted = false !== strpos($class, 'Test');
|
$isTest = false !== strpos($class, 'Test');
|
||||||
|
|
||||||
foreach ($regexps as $regex) {
|
foreach ($regexps as $regex) {
|
||||||
if ($blacklisted && false === strpos($regex, 'Test')) {
|
if ($isTest && false === strpos($regex, 'Test')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ class ErrorListener implements EventSubscriberInterface
|
||||||
$r = new \ReflectionFunction(\Closure::fromCallable($event->getController()));
|
$r = new \ReflectionFunction(\Closure::fromCallable($event->getController()));
|
||||||
$r = $r->getParameters()[$k] ?? null;
|
$r = $r->getParameters()[$k] ?? null;
|
||||||
|
|
||||||
if ($r && (!$r->hasType() || \in_array($r->getType()->getName(), [FlattenException::class, LegacyFlattenException::class], true))) {
|
if ($r && (!($r = $r->getType()) instanceof \ReflectionNamedType || \in_array($r->getName(), [FlattenException::class, LegacyFlattenException::class], true))) {
|
||||||
$arguments = $event->getArguments();
|
$arguments = $event->getArguments();
|
||||||
$arguments[$k] = FlattenException::createFromThrowable($e);
|
$arguments[$k] = FlattenException::createFromThrowable($e);
|
||||||
$event->setArguments($arguments);
|
$event->setArguments($arguments);
|
||||||
|
|
|
@ -25,7 +25,7 @@ use Symfony\Component\Intl\Data\Util\LocaleScanner;
|
||||||
*/
|
*/
|
||||||
class CurrencyDataGenerator extends AbstractDataGenerator
|
class CurrencyDataGenerator extends AbstractDataGenerator
|
||||||
{
|
{
|
||||||
private static $blacklist = [
|
private static $denylist = [
|
||||||
'XBA' => true, // European Composite Unit
|
'XBA' => true, // European Composite Unit
|
||||||
'XBB' => true, // European Monetary Unit
|
'XBB' => true, // European Monetary Unit
|
||||||
'XBC' => true, // European Unit of Account (XBC)
|
'XBC' => true, // European Unit of Account (XBC)
|
||||||
|
@ -133,7 +133,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||||
$symbolNamePairs = iterator_to_array($rootBundle['Currencies']);
|
$symbolNamePairs = iterator_to_array($rootBundle['Currencies']);
|
||||||
|
|
||||||
// Remove unwanted currencies
|
// Remove unwanted currencies
|
||||||
$symbolNamePairs = array_diff_key($symbolNamePairs, self::$blacklist);
|
$symbolNamePairs = array_diff_key($symbolNamePairs, self::$denylist);
|
||||||
|
|
||||||
return $symbolNamePairs;
|
return $symbolNamePairs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||||
'za' => 'zha',
|
'za' => 'zha',
|
||||||
'zh' => 'zho',
|
'zh' => 'zho',
|
||||||
];
|
];
|
||||||
private static $blacklist = [
|
private static $denylist = [
|
||||||
'root' => true, // Absolute root language
|
'root' => true, // Absolute root language
|
||||||
'mul' => true, // Multiple languages
|
'mul' => true, // Multiple languages
|
||||||
'mis' => true, // Uncoded language
|
'mis' => true, // Uncoded language
|
||||||
|
@ -182,7 +182,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||||
|
|
||||||
private static function generateLanguageNames(ArrayAccessibleResourceBundle $localeBundle): array
|
private static function generateLanguageNames(ArrayAccessibleResourceBundle $localeBundle): array
|
||||||
{
|
{
|
||||||
return array_diff_key(iterator_to_array($localeBundle['Languages']), self::$blacklist);
|
return array_diff_key(iterator_to_array($localeBundle['Languages']), self::$denylist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateAlpha3Codes(array $languageCodes, ArrayAccessibleResourceBundle $metadataBundle): array
|
private function generateAlpha3Codes(array $languageCodes, ArrayAccessibleResourceBundle $metadataBundle): array
|
||||||
|
|
|
@ -40,7 +40,7 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||||
'YE' => 'YEM',
|
'YE' => 'YEM',
|
||||||
];
|
];
|
||||||
|
|
||||||
private static $blacklist = [
|
private static $denylist = [
|
||||||
// Exceptional reservations
|
// Exceptional reservations
|
||||||
'AC' => true, // Ascension Island
|
'AC' => true, // Ascension Island
|
||||||
'CP' => true, // Clipperton Island
|
'CP' => true, // Clipperton Island
|
||||||
|
@ -69,7 +69,7 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||||
|
|
||||||
public static function isValidCountryCode($region)
|
public static function isValidCountryCode($region)
|
||||||
{
|
{
|
||||||
if (isset(self::$blacklist[$region])) {
|
if (isset(self::$denylist[$region])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use Symfony\Component\Intl\Data\Util\LocaleScanner;
|
||||||
*/
|
*/
|
||||||
class ScriptDataGenerator extends AbstractDataGenerator
|
class ScriptDataGenerator extends AbstractDataGenerator
|
||||||
{
|
{
|
||||||
private static $blacklist = [
|
private static $denylist = [
|
||||||
'Zzzz' => true, // Unknown Script
|
'Zzzz' => true, // Unknown Script
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
||||||
// isset() on \ResourceBundle returns true even if the value is null
|
// isset() on \ResourceBundle returns true even if the value is null
|
||||||
if (isset($localeBundle['Scripts']) && null !== $localeBundle['Scripts']) {
|
if (isset($localeBundle['Scripts']) && null !== $localeBundle['Scripts']) {
|
||||||
$data = [
|
$data = [
|
||||||
'Names' => array_diff_key(iterator_to_array($localeBundle['Scripts']), self::$blacklist),
|
'Names' => array_diff_key(iterator_to_array($localeBundle['Scripts']), self::$denylist),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->scriptCodes = array_merge($this->scriptCodes, array_keys($data['Names']));
|
$this->scriptCodes = array_merge($this->scriptCodes, array_keys($data['Names']));
|
||||||
|
|
|
@ -120,8 +120,8 @@ class MongoDbStore implements BlockingStoreInterface
|
||||||
if (isset($parsedUrl['query'])) {
|
if (isset($parsedUrl['query'])) {
|
||||||
parse_str($parsedUrl['query'], $query);
|
parse_str($parsedUrl['query'], $query);
|
||||||
}
|
}
|
||||||
$this->options['collection'] = $this->options['collection'] ?? $query['collection'] ?? null;
|
$this->options['collection'] = $query['collection'] ?? $this->options['collection'] ?? null;
|
||||||
$this->options['database'] = $this->options['database'] ?? ltrim($parsedUrl['path'] ?? '', '/') ?: null;
|
$this->options['database'] = ltrim($parsedUrl['path'] ?? '', '/') ?: $this->options['database'] ?? null;
|
||||||
if (null === $this->options['database']) {
|
if (null === $this->options['database']) {
|
||||||
throw new InvalidArgumentException(sprintf('"%s()" requires the "database" in the URI path or option when constructing with a URI.', __METHOD__));
|
throw new InvalidArgumentException(sprintf('"%s()" requires the "database" in the URI path or option when constructing with a URI.', __METHOD__));
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,26 +318,31 @@ class PdoStore implements PersistingStoreInterface
|
||||||
if ($con instanceof \PDO) {
|
if ($con instanceof \PDO) {
|
||||||
$this->driver = $con->getAttribute(\PDO::ATTR_DRIVER_NAME);
|
$this->driver = $con->getAttribute(\PDO::ATTR_DRIVER_NAME);
|
||||||
} else {
|
} else {
|
||||||
switch ($this->driver = $con->getDriver()->getName()) {
|
$driver = $con->getDriver();
|
||||||
case 'mysqli':
|
|
||||||
throw new NotSupportedException(sprintf('The store "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
|
switch (true) {
|
||||||
case 'pdo_mysql':
|
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
|
||||||
case 'drizzle_pdo_mysql':
|
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
|
||||||
|
|
||||||
|
case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
|
||||||
$this->driver = 'mysql';
|
$this->driver = 'mysql';
|
||||||
break;
|
break;
|
||||||
case 'pdo_sqlite':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
|
||||||
$this->driver = 'sqlite';
|
$this->driver = 'sqlite';
|
||||||
break;
|
break;
|
||||||
case 'pdo_pgsql':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
|
||||||
$this->driver = 'pgsql';
|
$this->driver = 'pgsql';
|
||||||
break;
|
break;
|
||||||
case 'oci8':
|
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
|
||||||
case 'pdo_oracle':
|
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
|
||||||
$this->driver = 'oci';
|
$this->driver = 'oci';
|
||||||
break;
|
break;
|
||||||
case 'pdo_sqlsrv':
|
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
|
||||||
$this->driver = 'sqlsrv';
|
$this->driver = 'sqlsrv';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$this->driver = \get_class($driver);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,19 @@ class MongoDbStoreTest extends AbstractStoreTest
|
||||||
yield ['mongodb://localhost/', ['database' => 'test', 'collection' => 'lock']];
|
yield ['mongodb://localhost/', ['database' => 'test', 'collection' => 'lock']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDsnPrecedence()
|
||||||
|
{
|
||||||
|
$client = self::getMongoClient();
|
||||||
|
|
||||||
|
$store = new MongoDbStore('mongodb://localhost/test_dsn?collection=lock_dns', ['collection' => 'lock_option', 'database' => 'test_option']);
|
||||||
|
$r = new \ReflectionObject($store);
|
||||||
|
$p = $r->getProperty('options');
|
||||||
|
$p->setAccessible(true);
|
||||||
|
$options = $p->getValue($store);
|
||||||
|
$this->assertSame('lock_dns', $options['collection']);
|
||||||
|
$this->assertSame('test_dsn', $options['database']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideInvalidConstructorArgs
|
* @dataProvider provideInvalidConstructorArgs
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -70,6 +70,15 @@ class ConnectionTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDsnPrecedence()
|
||||||
|
{
|
||||||
|
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
|
||||||
|
$this->assertEquals(
|
||||||
|
new Connection(['queue_name' => 'queue_dsn'], new SqsClient(['region' => 'us-east-2', 'accessKeyId' => 'key_dsn', 'accessKeySecret' => 'secret_dsn'], null, $httpClient)),
|
||||||
|
Connection::fromDsn('sqs://key_dsn:secret_dsn@default/queue_dsn?region=us-east-2', ['region' => 'eu-west-3', 'queue_name' => 'queue_options', 'access_key' => 'key_option', 'secret_key' => 'secret_option'], $httpClient)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testFromDsnWithRegion()
|
public function testFromDsnWithRegion()
|
||||||
{
|
{
|
||||||
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
|
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
|
||||||
|
|
|
@ -94,19 +94,19 @@ class Connection
|
||||||
if (isset($parsedUrl['query'])) {
|
if (isset($parsedUrl['query'])) {
|
||||||
parse_str($parsedUrl['query'], $query);
|
parse_str($parsedUrl['query'], $query);
|
||||||
}
|
}
|
||||||
|
$options = $query + $options + self::DEFAULT_OPTIONS;
|
||||||
$configuration = [
|
$configuration = [
|
||||||
'buffer_size' => $options['buffer_size'] ?? (int) ($query['buffer_size'] ?? self::DEFAULT_OPTIONS['buffer_size']),
|
'buffer_size' => (int) $options['buffer_size'],
|
||||||
'wait_time' => $options['wait_time'] ?? (int) ($query['wait_time'] ?? self::DEFAULT_OPTIONS['wait_time']),
|
'wait_time' => (int) $options['wait_time'],
|
||||||
'poll_timeout' => $options['poll_timeout'] ?? ($query['poll_timeout'] ?? self::DEFAULT_OPTIONS['poll_timeout']),
|
'poll_timeout' => $options['poll_timeout'],
|
||||||
'visibility_timeout' => $options['visibility_timeout'] ?? ($query['visibility_timeout'] ?? self::DEFAULT_OPTIONS['visibility_timeout']),
|
'visibility_timeout' => $options['visibility_timeout'],
|
||||||
'auto_setup' => $options['auto_setup'] ?? (bool) ($query['auto_setup'] ?? self::DEFAULT_OPTIONS['auto_setup']),
|
'auto_setup' => (bool) $options['auto_setup'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$clientConfiguration = [
|
$clientConfiguration = [
|
||||||
'region' => $options['region'] ?? ($query['region'] ?? self::DEFAULT_OPTIONS['region']),
|
'region' => $options['region'],
|
||||||
'accessKeyId' => $options['access_key'] ?? (urldecode($parsedUrl['user'] ?? '') ?: self::DEFAULT_OPTIONS['access_key']),
|
'accessKeyId' => urldecode($parsedUrl['user'] ?? '') ?: $options['access_key'] ?? self::DEFAULT_OPTIONS['access_key'],
|
||||||
'accessKeySecret' => $options['secret_key'] ?? (urldecode($parsedUrl['pass'] ?? '') ?: self::DEFAULT_OPTIONS['secret_key']),
|
'accessKeySecret' => urldecode($parsedUrl['pass'] ?? '') ?: $options['secret_key'] ?? self::DEFAULT_OPTIONS['secret_key'],
|
||||||
];
|
];
|
||||||
unset($query['region']);
|
unset($query['region']);
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ class ConnectionTest extends TestCase
|
||||||
'expectedAutoSetup' => false,
|
'expectedAutoSetup' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
yield 'options from options array wins over options from dsn' => [
|
yield 'options from dsn array wins over options from options' => [
|
||||||
'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal&auto_setup=true',
|
'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal&auto_setup=true',
|
||||||
'options' => [
|
'options' => [
|
||||||
'table_name' => 'name_from_options',
|
'table_name' => 'name_from_options',
|
||||||
|
@ -219,10 +219,10 @@ class ConnectionTest extends TestCase
|
||||||
'auto_setup' => false,
|
'auto_setup' => false,
|
||||||
],
|
],
|
||||||
'expectedConnection' => 'default',
|
'expectedConnection' => 'default',
|
||||||
'expectedTableName' => 'name_from_options',
|
'expectedTableName' => 'name_from_dsn',
|
||||||
'expectedRedeliverTimeout' => 1800,
|
'expectedRedeliverTimeout' => 1200,
|
||||||
'expectedQueue' => 'important',
|
'expectedQueue' => 'normal',
|
||||||
'expectedAutoSetup' => false,
|
'expectedAutoSetup' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
yield 'options from dsn with falsey boolean' => [
|
yield 'options from dsn with falsey boolean' => [
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Connection implements ResetInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
$configuration = ['connection' => $components['host']];
|
$configuration = ['connection' => $components['host']];
|
||||||
$configuration += $options + $query + static::DEFAULT_OPTIONS;
|
$configuration += $query + $options + static::DEFAULT_OPTIONS;
|
||||||
|
|
||||||
$configuration['auto_setup'] = filter_var($configuration['auto_setup'], FILTER_VALIDATE_BOOLEAN);
|
$configuration['auto_setup'] = filter_var($configuration['auto_setup'], FILTER_VALIDATE_BOOLEAN);
|
||||||
|
|
||||||
|
|
|
@ -228,11 +228,24 @@ class MessengerPass implements CompilerPassInterface
|
||||||
throw new RuntimeException(sprintf('Invalid handler service "%s": argument "$%s" of method "%s::__invoke()" must have a type-hint corresponding to the message class it handles.', $serviceId, $parameters[0]->getName(), $handlerClass->getName()));
|
throw new RuntimeException(sprintf('Invalid handler service "%s": argument "$%s" of method "%s::__invoke()" must have a type-hint corresponding to the message class it handles.', $serviceId, $parameters[0]->getName(), $handlerClass->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type instanceof \ReflectionUnionType) {
|
||||||
|
$types = [];
|
||||||
|
foreach ($type->getTypes() as $type) {
|
||||||
|
if (!$type->isBuiltin()) {
|
||||||
|
$types[] = (string) $type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($types) {
|
||||||
|
return $types;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($type->isBuiltin()) {
|
if ($type->isBuiltin()) {
|
||||||
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type));
|
throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$parameters[0]->getType()->getName()];
|
return [$type->getName()];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function registerReceivers(ContainerBuilder $container, array $busIds)
|
private function registerReceivers(ContainerBuilder $container, array $busIds)
|
||||||
|
|
|
@ -50,9 +50,9 @@ class UnsupportedSchemeException extends LogicException
|
||||||
'class' => Bridge\Firebase\FirebaseTransportFactory::class,
|
'class' => Bridge\Firebase\FirebaseTransportFactory::class,
|
||||||
'package' => 'symfony/firebase-notifier',
|
'package' => 'symfony/firebase-notifier',
|
||||||
],
|
],
|
||||||
'freemobile' => [
|
'free-mobile' => [
|
||||||
'class' => Bridge\FreeMobile\FreeMobileTransportFactory::class,
|
'class' => Bridge\FreeMobile\FreeMobileTransportFactory::class,
|
||||||
'package' => 'symfony/freemobile-notifier',
|
'package' => 'symfony/free-mobile-notifier',
|
||||||
],
|
],
|
||||||
'ovhcloud' => [
|
'ovhcloud' => [
|
||||||
'class' => Bridge\OvhCloud\OvhCloudTransportFactory::class,
|
'class' => Bridge\OvhCloud\OvhCloudTransportFactory::class,
|
||||||
|
|
|
@ -206,7 +206,7 @@ class OptionsResolver implements Options
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params[0]) && null !== ($type = $params[0]->getType()) && self::class === $type->getName() && (!isset($params[1]) || (null !== ($type = $params[1]->getType()) && Options::class === $type->getName()))) {
|
if (isset($params[0]) && null !== ($type = $params[0]->getType()) && self::class === $type->getName() && (!isset($params[1]) || (($type = $params[1]->getType()) instanceof \ReflectionNamedType && Options::class === $type->getName()))) {
|
||||||
// Store closure for later evaluation
|
// Store closure for later evaluation
|
||||||
$this->nested[$option][] = $value;
|
$this->nested[$option][] = $value;
|
||||||
$this->defaults[$option] = [];
|
$this->defaults[$option] = [];
|
||||||
|
@ -1283,7 +1283,7 @@ class OptionsResolver implements Options
|
||||||
|
|
||||||
private function getParameterClassName(\ReflectionParameter $parameter): ?string
|
private function getParameterClassName(\ReflectionParameter $parameter): ?string
|
||||||
{
|
{
|
||||||
if (!($type = $parameter->getType()) || $type->isBuiltin()) {
|
if (!($type = $parameter->getType()) instanceof \ReflectionNamedType || $type->isBuiltin()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,8 +428,9 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||||
// handle uninitialized properties in PHP >= 7.4
|
// handle uninitialized properties in PHP >= 7.4
|
||||||
if (\PHP_VERSION_ID >= 70400 && preg_match('/^Typed property ([\w\\\]+)::\$(\w+) must not be accessed before initialization$/', $e->getMessage(), $matches)) {
|
if (\PHP_VERSION_ID >= 70400 && preg_match('/^Typed property ([\w\\\]+)::\$(\w+) must not be accessed before initialization$/', $e->getMessage(), $matches)) {
|
||||||
$r = new \ReflectionProperty($matches[1], $matches[2]);
|
$r = new \ReflectionProperty($matches[1], $matches[2]);
|
||||||
|
$type= ($type = $r->getType()) instanceof \ReflectionNamedType ? $type->getName() : (string) $type;
|
||||||
|
|
||||||
throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $r->getDeclaringClass()->getName(), $r->getName(), $r->getType()->getName()), 0, $e);
|
throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $r->getDeclaringClass()->getName(), $r->getName(), $type, 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
|
|
|
@ -135,7 +135,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||||
$reflectionProperty = new \ReflectionProperty($class, $property);
|
$reflectionProperty = new \ReflectionProperty($class, $property);
|
||||||
$type = $reflectionProperty->getType();
|
$type = $reflectionProperty->getType();
|
||||||
if (null !== $type) {
|
if (null !== $type) {
|
||||||
return [$this->extractFromReflectionType($type, $reflectionProperty->getDeclaringClass())];
|
return $this->extractFromReflectionType($type, $reflectionProperty->getDeclaringClass());
|
||||||
}
|
}
|
||||||
} catch (\ReflectionException $e) {
|
} catch (\ReflectionException $e) {
|
||||||
// noop
|
// noop
|
||||||
|
@ -393,11 +393,11 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||||
}
|
}
|
||||||
$type = $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass());
|
$type = $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass());
|
||||||
|
|
||||||
if (\in_array($prefix, $this->arrayMutatorPrefixes)) {
|
if (1 === \count($type) && \in_array($prefix, $this->arrayMutatorPrefixes)) {
|
||||||
$type = new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type);
|
$type = [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type[0])];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$type];
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -413,7 +413,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reflectionType = $reflectionMethod->getReturnType()) {
|
if ($reflectionType = $reflectionMethod->getReturnType()) {
|
||||||
return [$this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass())];
|
return $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\in_array($prefix, ['is', 'can', 'has'])) {
|
if (\in_array($prefix, ['is', 'can', 'has'])) {
|
||||||
|
@ -448,7 +448,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||||
}
|
}
|
||||||
$reflectionType = $parameter->getType();
|
$reflectionType = $parameter->getType();
|
||||||
|
|
||||||
return $reflectionType ? [$this->extractFromReflectionType($reflectionType, $constructor->getDeclaringClass())] : null;
|
return $reflectionType ? $this->extractFromReflectionType($reflectionType, $constructor->getDeclaringClass()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parentClass = $reflectionClass->getParentClass()) {
|
if ($parentClass = $reflectionClass->getParentClass()) {
|
||||||
|
@ -477,22 +477,26 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||||
return [new Type(static::MAP_TYPES[$type] ?? $type)];
|
return [new Type(static::MAP_TYPES[$type] ?? $type)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function extractFromReflectionType(\ReflectionType $reflectionType, \ReflectionClass $declaringClass): Type
|
private function extractFromReflectionType(\ReflectionType $reflectionType, \ReflectionClass $declaringClass): array
|
||||||
{
|
{
|
||||||
$phpTypeOrClass = $reflectionType->getName();
|
$types = [];
|
||||||
$nullable = $reflectionType->allowsNull();
|
$nullable = $reflectionType->allowsNull();
|
||||||
|
|
||||||
if (Type::BUILTIN_TYPE_ARRAY === $phpTypeOrClass) {
|
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) {
|
||||||
$type = new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true);
|
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type;
|
||||||
} elseif ('void' === $phpTypeOrClass) {
|
|
||||||
$type = new Type(Type::BUILTIN_TYPE_NULL, $nullable);
|
if (Type::BUILTIN_TYPE_ARRAY === $phpTypeOrClass) {
|
||||||
} elseif ($reflectionType->isBuiltin()) {
|
$types[] = new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true);
|
||||||
$type = new Type($phpTypeOrClass, $nullable);
|
} elseif ('void' === $phpTypeOrClass || 'null' === $phpTypeOrClass) {
|
||||||
} else {
|
$types[] = new Type(Type::BUILTIN_TYPE_NULL, $nullable);
|
||||||
$type = new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $this->resolveTypeName($phpTypeOrClass, $declaringClass));
|
} elseif ($reflectionType->isBuiltin()) {
|
||||||
|
$types[] = new Type($phpTypeOrClass, $nullable);
|
||||||
|
} else {
|
||||||
|
$types[] = new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $this->resolveTypeName($phpTypeOrClass, $declaringClass));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resolveTypeName(string $name, \ReflectionClass $declaringClass): string
|
private function resolveTypeName(string $name, \ReflectionClass $declaringClass): string
|
||||||
|
|
|
@ -244,7 +244,7 @@ EOF;
|
||||||
* Last but not least:
|
* Last but not least:
|
||||||
* - Because it is not possibe to mix unicode/non-unicode patterns in a single regexp, several of them can be generated.
|
* - Because it is not possibe to mix unicode/non-unicode patterns in a single regexp, several of them can be generated.
|
||||||
* - The same regexp can be used several times when the logic in the switch rejects the match. When this happens, the
|
* - The same regexp can be used several times when the logic in the switch rejects the match. When this happens, the
|
||||||
* matching-but-failing subpattern is blacklisted by replacing its name by "(*F)", which forces a failure-to-match.
|
* matching-but-failing subpattern is excluded by replacing its name by "(*F)", which forces a failure-to-match.
|
||||||
* To ease this backlisting operation, the name of subpatterns is also the string offset where the replacement should occur.
|
* To ease this backlisting operation, the name of subpatterns is also the string offset where the replacement should occur.
|
||||||
*/
|
*/
|
||||||
private function compileDynamicRoutes(RouteCollection $collection, bool $matchHost, int $chunkLimit, array &$conditions): array
|
private function compileDynamicRoutes(RouteCollection $collection, bool $matchHost, int $chunkLimit, array &$conditions): array
|
||||||
|
|
|
@ -171,9 +171,7 @@ class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthent
|
||||||
$authenticatedToken->eraseCredentials();
|
$authenticatedToken->eraseCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->eventDispatcher) {
|
$this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS);
|
||||||
$this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => \get_class($authenticator)]);
|
$this->logger->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => \get_class($authenticator)]);
|
||||||
|
|
|
@ -411,7 +411,7 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
|
||||||
protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, string $parameterName, $parameterData, array $context, string $format = null)
|
protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, string $parameterName, $parameterData, array $context, string $format = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (($parameterType = $parameter->getType()) && !$parameterType->isBuiltin()) {
|
if (($parameterType = $parameter->getType()) instanceof \ReflectionNamedType && !$parameterType->isBuiltin()) {
|
||||||
$parameterClass = $parameterType->getName();
|
$parameterClass = $parameterType->getName();
|
||||||
new \ReflectionClass($parameterClass); // throws a \ReflectionException if the class doesn't exist
|
new \ReflectionClass($parameterClass); // throws a \ReflectionException if the class doesn't exist
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ class ReflectionCaster
|
||||||
$prefix = Caster::PREFIX_VIRTUAL;
|
$prefix = Caster::PREFIX_VIRTUAL;
|
||||||
|
|
||||||
$a += [
|
$a += [
|
||||||
$prefix.'name' => $c->getName(),
|
$prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : (string) $c,
|
||||||
$prefix.'allowsNull' => $c->allowsNull(),
|
$prefix.'allowsNull' => $c->allowsNull(),
|
||||||
$prefix.'isBuiltin' => $c->isBuiltin(),
|
$prefix.'isBuiltin' => $c->isBuiltin(),
|
||||||
];
|
];
|
||||||
|
@ -182,7 +182,7 @@ class ReflectionCaster
|
||||||
|
|
||||||
if (isset($a[$prefix.'returnType'])) {
|
if (isset($a[$prefix.'returnType'])) {
|
||||||
$v = $a[$prefix.'returnType'];
|
$v = $a[$prefix.'returnType'];
|
||||||
$v = $v->getName();
|
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
|
||||||
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
|
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
|
||||||
}
|
}
|
||||||
if (isset($a[$prefix.'class'])) {
|
if (isset($a[$prefix.'class'])) {
|
||||||
|
@ -244,7 +244,7 @@ class ReflectionCaster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($v = $c->getType()) {
|
if ($v = $c->getType()) {
|
||||||
$a[$prefix.'typeHint'] = $v->getName();
|
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a[$prefix.'typeHint'])) {
|
if (isset($a[$prefix.'typeHint'])) {
|
||||||
|
@ -320,10 +320,14 @@ class ReflectionCaster
|
||||||
foreach ($a[$prefix.'parameters']->value as $k => $param) {
|
foreach ($a[$prefix.'parameters']->value as $k => $param) {
|
||||||
$signature .= ', ';
|
$signature .= ', ';
|
||||||
if ($type = $param->getType()) {
|
if ($type = $param->getType()) {
|
||||||
if (!$param->isOptional() && $param->allowsNull()) {
|
if (!$type instanceof \ReflectionNamedType) {
|
||||||
$signature .= '?';
|
$signature .= $type.' ';
|
||||||
|
} else {
|
||||||
|
if (!$param->isOptional() && $param->allowsNull()) {
|
||||||
|
$signature .= '?';
|
||||||
|
}
|
||||||
|
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
|
||||||
}
|
}
|
||||||
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
|
|
||||||
}
|
}
|
||||||
$signature .= $k;
|
$signature .= $k;
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,8 @@ class CliDumper extends AbstractDumper
|
||||||
} elseif (Cursor::HASH_RESOURCE === $type) {
|
} elseif (Cursor::HASH_RESOURCE === $type) {
|
||||||
$prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' ');
|
$prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' ');
|
||||||
} else {
|
} else {
|
||||||
$prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class, $attr).' [' : '[';
|
$unstyledPrefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? 'array:'.$class : '';
|
||||||
|
$prefix = $this->style('note', $unstyledPrefix, $attr).($unstyledPrefix ? ' [' : '[');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($cursor->softRefCount || 0 < $cursor->softRefHandle) && empty($attr['cut_hash'])) {
|
if (($cursor->softRefCount || 0 < $cursor->softRefHandle) && empty($attr['cut_hash'])) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Symfony\Component\VarDumper\Tests\Dumper;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||||
|
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
|
||||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
|
@ -489,6 +490,57 @@ EOTXT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function provideDumpArrayWithColor()
|
||||||
|
{
|
||||||
|
yield [
|
||||||
|
['foo' => 'bar'],
|
||||||
|
0,
|
||||||
|
<<<EOTXT
|
||||||
|
\e[0;38;5;208m\e[38;5;38marray:1\e[0;38;5;208m [\e[m
|
||||||
|
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
||||||
|
\e[0;38;5;208m]\e[m
|
||||||
|
|
||||||
|
EOTXT
|
||||||
|
];
|
||||||
|
|
||||||
|
yield [[], AbstractDumper::DUMP_LIGHT_ARRAY, "\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
|
||||||
|
|
||||||
|
yield [
|
||||||
|
['foo' => 'bar'],
|
||||||
|
AbstractDumper::DUMP_LIGHT_ARRAY,
|
||||||
|
<<<EOTXT
|
||||||
|
\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[\e[m
|
||||||
|
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
||||||
|
\e[0;38;5;208m]\e[m
|
||||||
|
|
||||||
|
EOTXT
|
||||||
|
];
|
||||||
|
|
||||||
|
yield [[], 0, "\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideDumpArrayWithColor
|
||||||
|
*/
|
||||||
|
public function testDumpArrayWithColor($value, $flags, $expectedOut)
|
||||||
|
{
|
||||||
|
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||||
|
$this->markTestSkipped('Windows console does not support coloration');
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
$dumper = new CliDumper(function ($line, $depth) use (&$out) {
|
||||||
|
if ($depth >= 0) {
|
||||||
|
$out .= str_repeat(' ', $depth).$line."\n";
|
||||||
|
}
|
||||||
|
}, null, $flags);
|
||||||
|
$dumper->setColors(true);
|
||||||
|
$cloner = new VarCloner();
|
||||||
|
$dumper->dump($cloner->cloneVar($value));
|
||||||
|
|
||||||
|
$this->assertSame($expectedOut, $out);
|
||||||
|
}
|
||||||
|
|
||||||
private function getSpecialVars()
|
private function getSpecialVars()
|
||||||
{
|
{
|
||||||
foreach (array_keys($GLOBALS) as $var) {
|
foreach (array_keys($GLOBALS) as $var) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ trait ServiceLocatorTrait
|
||||||
} else {
|
} else {
|
||||||
$type = (new \ReflectionFunction($factory))->getReturnType();
|
$type = (new \ReflectionFunction($factory))->getReturnType();
|
||||||
|
|
||||||
$this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').$type->getName() : '?';
|
$this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ trait ServiceSubscriberTrait
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::class === $method->getDeclaringClass()->name && ($returnType = $method->getReturnType()) && !$returnType->isBuiltin()) {
|
if (self::class === $method->getDeclaringClass()->name && ($returnType = $method->getReturnType()) && !$returnType->isBuiltin()) {
|
||||||
$services[self::class.'::'.$method->name] = '?'.$returnType->getName();
|
$services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
|
"version": "2.99",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.1-dev"
|
"dev-master": "2.1-dev"
|
||||||
|
|
Reference in New Issue