diff --git a/.appveyor.yml b/.appveyor.yml
index 507bc46e0ec25..4cdaf958bfd33 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -50,9 +50,10 @@ install:
- php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex
- git config --global user.email ""
- git config --global user.name "Symfony"
- - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F)
+ - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F)
- php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit
- SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
+ - SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
- php composer.phar update --no-progress --ansi
- php phpunit install
diff --git a/.github/build-packages.php b/.github/build-packages.php
index c8c802ad595b4..30dcf0c9adce8 100644
--- a/.github/build-packages.php
+++ b/.github/build-packages.php
@@ -46,7 +46,7 @@
passthru("cd $dir && git init && git add . && git commit -q -m - && git archive -o package.tar HEAD && rm .git/ -Rf");
}
- $package->version = (isset($package->extra->{'branch-version'}) ? $package->extra->{'branch-version'} : $version).'.x-dev';
+ $package->version = preg_replace('/(?:\.x)?-dev$/', '', $package->extra->{'branch-alias'}->{'dev-main'} ?? $version).'.x-dev';
$package->dist['type'] = 'tar';
$package->dist['url'] = 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__))."/$dir/package.tar";
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 6505e20d39a22..96f4b8be0996b 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -137,8 +137,9 @@ jobs:
- name: Configure composer
run: |
COMPOSER_HOME="$(composer config home)"
+ composer self-update
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
- echo "COMPOSER_ROOT_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
+ echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory
id: composer-cache
diff --git a/.travis.yml b/.travis.yml
index fb30d059ad066..80c86ecdf7444 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,7 @@ addons:
env:
global:
+ - SYMFONY_VERSION=5.2
- MIN_PHP=7.2.5
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
- SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
@@ -170,8 +171,8 @@ install:
git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
git rm -rq src/Symfony/Bridge/PhpUnit
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
- export SYMFONY_VERSION=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref)
- sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
+ SYMFONY_PHPUNIT_BRIDGE_REF=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref)
+ sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_PHPUNIT_BRIDGE_REF'.x@dev"/' composer.json
rm -rf .phpunit
fi
@@ -180,7 +181,6 @@ install:
git config --global user.email ""
git config --global user.name "Symfony"
- export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*')
SYMFONY_VERSIONS=$(git ls-remote -q --heads);
if [[ ! $deps ]]; then
@@ -227,6 +227,7 @@ install:
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(echo "$SYMFONY_VERSIONS" | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
+ export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
- |
@@ -265,6 +266,7 @@ install:
export FLIP='^'
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
+ export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
git fetch --depth=2 origin $SYMFONY_VERSION
git checkout -m FETCH_HEAD
diff --git a/CHANGELOG-5.2.md b/CHANGELOG-5.2.md
index 6e42cd86cfbc4..7fe615b1fcca4 100644
--- a/CHANGELOG-5.2.md
+++ b/CHANGELOG-5.2.md
@@ -7,6 +7,17 @@ in 5.2 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.2.0...v5.2.1
+* 5.2.3 (2021-02-03)
+
+ * bug #39954 [Mailer][Mime] Fix case-sensitive handling of header names (piku235)
+ * bug #40055 [Messenger] Fix Doctrine setup when using a migration (fabpot)
+ * bug #40018 [TwigBridge] take into account all label related options (xabbuh)
+ * bug #40023 [Finder] use proper keys to not override appended files (xabbuh)
+ * bug #40019 [ErrorHandler] Fix strpos error when trying to call a method without a name (Deuchnord)
+ * bug #40027 [DoctrineBridge] add missing `@experimental` annotation on Uid generators (nicolas-grekas)
+ * bug #40004 [Serializer] Prevent access to private properties without getters (julienfalque)
+ * bug #40003 [Uid] Fix time to float conversion (fancyweb)
+
* 5.2.2 (2021-01-27)
* bug #38900 [Serializer] Exclude non-initialized properties accessed with getters (BoShurik)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 9f2ebcc65e3ed..5b8efba4073b3 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -24,10 +24,10 @@ Symfony is the result of the work of many people who made the code better
- Johannes S (johannes)
- Kris Wallsmith (kriswallsmith)
- Wouter de Jong (wouterj)
- - Yonel Ceruto (yonelceruto)
+ - Jérémy DERUSSÉ (jderusse)
- Thomas Calvet (fancyweb)
+ - Yonel Ceruto (yonelceruto)
- Hugo Hamon (hhamon)
- - Jérémy DERUSSÉ (jderusse)
- Abdellatif Ait boudad (aitboudad)
- Samuel ROZE (sroze)
- Romain Neutron (romain)
@@ -43,15 +43,16 @@ Symfony is the result of the work of many people who made the code better
- Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
+ - Oskar Stark (oskarstark)
- Eriksen Costa (eriksencosta)
- Guilhem Niot (energetick)
- Sarah Khalil (saro0h)
- Jan Schädlich (jschaedl)
- Jonathan Wage (jwage)
- Lynn van der Berg (kjarli)
+ - Pierre du Plessis (pierredup)
- Matthias Pigulla (mpdude)
- Diego Saint Esteben (dosten)
- - Pierre du Plessis (pierredup)
- Valentin Udaltsov (vudaltsov)
- Alexandre Salomé (alexandresalome)
- William Durand (couac)
@@ -77,11 +78,10 @@ Symfony is the result of the work of many people who made the code better
- Mathieu Piot (mpiot)
- Vladimir Reznichenko (kalessil)
- Bilal Amarni (bamarni)
- - Oskar Stark (oskarstark)
- Florin Patan (florinpatan)
- Jáchym Toušek (enumag)
- - Andrej Hudec (pulzarraider)
- Michel Weimerskirch (mweimerskirch)
+ - Andrej Hudec (pulzarraider)
- Issei Murasawa (issei_m)
- Christian Raue
- Eric Clemmons (ericclemmons)
@@ -115,12 +115,12 @@ Symfony is the result of the work of many people who made the code better
- Michal Piotrowski (eventhorizon)
- Jérôme Vasseur (jvasseur)
- Tim Nagel (merk)
+ - Alexander Schranz (alexander-schranz)
- Chris Wilkinson (thewilkybarkid)
+ - Peter Kokot (maastermedia)
- Brice BERNARD (brikou)
- - Alexander Schranz (alexander-schranz)
- marc.weistroff
- Tomáš Votruba (tomas_votruba)
- - Peter Kokot (maastermedia)
- Lars Strojny (lstrojny)
- lenar
- Alexander Schwenn (xelaris)
@@ -172,14 +172,15 @@ Symfony is the result of the work of many people who made the code better
- Jérémie Augustin (jaugustin)
- François-Xavier de Guillebon (de-gui_f)
- Oleg Voronkovich
+ - Tomas Norkūnas (norkunas)
- Philipp Wahala (hifi)
- Rafael Dohms (rdohms)
- jwdeitch
- Ahmed TAILOULOUTE (ahmedtai)
+ - Mathias Arlaud (mtarld)
- Mikael Pajunen
- Gary PEGEOT (gary-p)
- Arman Hosseini (arman)
- - Tomas Norkūnas (norkunas)
- Niels Keurentjes (curry684)
- Vyacheslav Pavlov
- George Mponos (gmponos)
@@ -191,17 +192,20 @@ Symfony is the result of the work of many people who made the code better
- Ben Davies (bendavies)
- Andreas Schempp (aschempp)
- Clemens Tolboom
+ - HypeMC (hypemc)
- Helmer Aaviksoo
- Hiromi Hishida (77web)
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Dawid Nowak
+ - Maxime Helias (maxhelias)
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
- Tyson Andre
- GDIBass
- Samuel NELA (snela)
+ - Olivier Dolbeau (odolbeau)
- Fabien Bourigault (fbourigault)
- Saif (╯°□°)╯ (azjezz)
- James Halsall (jaitsu)
@@ -212,7 +216,6 @@ Symfony is the result of the work of many people who made the code better
- Marek Štípek (maryo)
- Filippo Tessarotto (slamdunk)
- Daniel Espendiller
- - Maxime Helias (maxhelias)
- Possum
- Dorian Villet (gnutix)
- Michaël Perrin (michael.perrin)
@@ -223,16 +226,16 @@ Symfony is the result of the work of many people who made the code better
- Mario A. Alvarez Garcia (nomack84)
- Dennis Benkert (denderello)
- DQNEO
+ - David Prévot
- Andre Rømcke (andrerom)
- Smaine Milianni (ismail1432)
- - Mathias Arlaud (mtarld)
- mcfedr (mcfedr)
+ - Christian Scheb
- Ruben Gonzalez (rubenrua)
- Benjamin Dulau (dbenjamin)
- Jan Rosier (rosier)
- Mathieu Lemoine (lemoinem)
- Rémon van de Kamp (rpkamp)
- - HypeMC
- Christian Schmidt
- Andreas Hucks (meandmymonkey)
- Tom Van Looy (tvlooy)
@@ -244,6 +247,7 @@ Symfony is the result of the work of many people who made the code better
- bronze1man
- sun (sun)
- Larry Garfield (crell)
+ - Michael Käfer (michael_kaefer)
- Leo Feyer (leofeyer)
- Nikolay Labinskiy (e-moe)
- Martin Schuhfuß (usefulthink)
@@ -251,12 +255,10 @@ Symfony is the result of the work of many people who made the code better
- Matthieu Bontemps (mbontemps)
- apetitpa
- Pierre Minnieur (pminnieur)
- - David Prévot
- fivestar
- Dominique Bongiraud
- Hidde Wieringa (hiddewie)
- Jeremy Livingston (jeremylivingston)
- - Olivier Dolbeau (odolbeau)
- Michael Lee (zerustech)
- Dmitrii Poddubnyi (karser)
- Matthieu Auger (matthieuauger)
@@ -283,7 +285,6 @@ Symfony is the result of the work of many people who made the code better
- Marcel Beerta (mazen)
- Christopher Hertel (chertel)
- Ruud Kamphuis (ruudk)
- - Michael Käfer (michael_kaefer)
- Chi-teck
- Pavel Batanov (scaytrase)
- Mantis Development
@@ -315,6 +316,7 @@ Symfony is the result of the work of many people who made the code better
- Alessandro Lai (jean85)
- Adam Prager (padam87)
- Benoît Burnichon (bburnichon)
+ - YaFou
- Maciej Malarz (malarzm)
- Roman Marintšenko (inori)
- Xavier Montaña Carreras (xmontana)
@@ -336,6 +338,7 @@ Symfony is the result of the work of many people who made the code better
- Jakub Kucharovic (jkucharovic)
- Loick Piera (pyrech)
- Gocha Ossinkine (ossinkine)
+ - Jeroen Noten (jeroennoten)
- Uwe Jäger (uwej711)
- Martin Hujer (martinhujer)
- Eugene Leonovich (rybakit)
@@ -362,7 +365,6 @@ Symfony is the result of the work of many people who made the code better
- Alex Rock (pierstoval)
- Beau Simensen (simensen)
- Michael Hirschler (mvhirsch)
- - Christian Scheb
- Robert Kiss (kepten)
- Zan Baldwin (zanderbaldwin)
- Roumen Damianoff (roumen)
@@ -372,6 +374,7 @@ Symfony is the result of the work of many people who made the code better
- Langlet Vincent (deviling)
- Pascal Luna (skalpa)
- Wouter Van Hecke
+ - Iker Ibarguren (ikerib)
- Peter Kruithof (pkruithof)
- Michael Holm (hollo)
- Arjen van der Meijden
@@ -379,6 +382,7 @@ Symfony is the result of the work of many people who made the code better
- Damien Alexandre (damienalexandre)
- Simon Mönch (sm)
- Christian Schmidt
+ - Ben Hakim
- Patrick Landolt (scube)
- MatTheCat
- Denis Brumann (dbrumann)
@@ -413,6 +417,7 @@ Symfony is the result of the work of many people who made the code better
- Gustavo Piltcher
- Jesse Rushlow (geeshoe)
- Stepan Tanasiychuk (stfalcon)
+ - Ivan Kurnosov
- Tiago Ribeiro (fixe)
- Hidde Boomsma (hboomsma)
- John Bafford (jbafford)
@@ -434,10 +439,12 @@ Symfony is the result of the work of many people who made the code better
- Mark Challoner (markchalloner)
- ivan
- Karoly Gossler (connorhu)
+ - Simon Berger
- Ahmed Raafat
- Philippe Segatori
- Gennady Telegin (gtelegin)
- Thibaut Cheymol (tcheymol)
+ - Baptiste Leduc (korbeil)
- Erin Millard
- Artur Melo (restless)
- Matthew Lewinski (lewinski)
@@ -448,7 +455,6 @@ Symfony is the result of the work of many people who made the code better
- alquerci
- Oleg Andreyev
- Mateusz Sip (mateusz_sip)
- - YaFou
- Francesco Levorato
- Vitaliy Zakharov (zakharovvi)
- Tobias Sjösten (tobiassjosten)
@@ -463,7 +469,6 @@ Symfony is the result of the work of many people who made the code better
- Thomas Perez (scullwm)
- Felix Labrecque
- Yaroslav Kiliba
- - Ben Hakim
- Terje Bråten
- Gonzalo Vilaseca (gonzalovilaseca)
- Marco Petersen (ocrampete16)
@@ -479,7 +484,6 @@ Symfony is the result of the work of many people who made the code better
- Haralan Dobrev (hkdobrev)
- hossein zolfi (ocean)
- Clément Gautier (clementgautier)
- - Jeroen Noten (jeroennoten)
- Dāvis Zālītis (k0d3r1s)
- Sanpi
- Eduardo Gulias (egulias)
@@ -488,7 +492,6 @@ Symfony is the result of the work of many people who made the code better
- Stéphane PY (steph_py)
- Philipp Kräutli (pkraeutli)
- Grzegorz (Greg) Zdanowski (kiler129)
- - Iker Ibarguren (ikerib)
- Dimitri Gritsajuk (ottaviano)
- Kirill chEbba Chebunin (chebba)
-
@@ -524,7 +527,6 @@ Symfony is the result of the work of many people who made the code better
- Alain Hippolyte (aloneh)
- Grenier Kévin (mcsky_biig)
- Karoly Negyesi (chx)
- - Ivan Kurnosov
- Xavier HAUSHERR
- Albert Jessurum (ajessu)
- Laszlo Korte
@@ -563,13 +565,14 @@ Symfony is the result of the work of many people who made the code better
- Markus Bachmann (baachi)
- Kévin THERAGE (kevin_therage)
- Erkhembayar Gantulga (erheme318)
+ - Greg Anderson
- Islam93
- lancergr
+ - Vincent Langlet
- Tri Pham (phamuyentri)
- Mihai Stancu
- Ivan Nikolaev (destillat)
- Gildas Quéméner (gquemener)
- - Baptiste Leduc (korbeil)
- Laurent Masforné (heisenberg)
- Claude Khedhiri (ck-developer)
- Desjardins Jérôme (jewome62)
@@ -721,6 +724,7 @@ Symfony is the result of the work of many people who made the code better
- Steven Surowiec
- Kevin Saliou (kbsali)
- Shawn Iwinski
+ - Samuele Lilli (doncallisto)
- Gawain Lynch (gawain)
- mmokhi
- NothingWeAre
@@ -766,9 +770,11 @@ Symfony is the result of the work of many people who made the code better
- Fred Cox
- vitaliytv
- Philippe Segatori
+ - Loïc Frémont (loic425)
- fd6130 (fdtvui)
- Dalibor Karlović (dkarlovi)
- Andrey Sevastianov
+ - Oleksandr Barabolia (oleksandrbarabolia)
- Sebastian Blum
- Alexis Lefebvre
- aubx
@@ -776,7 +782,6 @@ Symfony is the result of the work of many people who made the code better
- Marvin Butkereit
- Renan
- Ricky Su (ricky)
- - Vincent Langlet
- Kyle Evans (kevans91)
- Charles-Henri Bruyand
- Max Rath (drak3)
@@ -907,7 +912,6 @@ Symfony is the result of the work of many people who made the code better
- Richard van den Brand (ricbra)
- develop
- flip111
- - Greg Anderson
- VJ
- RJ Garcia
- Delf Tonder (leberknecht)
@@ -1021,6 +1025,7 @@ Symfony is the result of the work of many people who made the code better
- Ben
- Vincent Composieux (eko)
- Jayson Xu (superjavason)
+ - Gijs van Lammeren
- Hubert Lenoir (hubert_lenoir)
- fago
- Jan Prieser
@@ -1081,6 +1086,7 @@ Symfony is the result of the work of many people who made the code better
- Peter Bowyer (pbowyer)
- Aleksey Podskrebyshev
- Calin Mihai Pristavu
+ - Vincent Langlet
- David Marín Carreño (davefx)
- Fabien LUCAS (flucas2)
- Konstantin Grachev (grachevko)
@@ -1156,7 +1162,6 @@ Symfony is the result of the work of many people who made the code better
- Dmitriy Derepko
- Stéphane Delprat
- Brian Freytag (brianfreytag)
- - Samuele Lilli (doncallisto)
- Brunet Laurent (lbrunet)
- Florent Viel (luxifer)
- Mikhail Yurasov (mym)
@@ -1185,12 +1190,12 @@ Symfony is the result of the work of many people who made the code better
- d-ph
- Stewart Malik
- Renan Taranto (renan-taranto)
+ - Gemorroj (gemorroj)
- Rikijs Murgs
- Mihail Krasilnikov (krasilnikovm)
- Uladzimir Tsykun
- iamvar
- Amaury Leroux de Lens (amo__)
- - Loïc Frémont (loic425)
- Christian Jul Jensen
- Alexandre GESLIN (alexandregeslin)
- The Whole Life to Learn
@@ -1199,11 +1204,16 @@ Symfony is the result of the work of many people who made the code better
- Mikkel Paulson
- ergiegonzaga
- Daniel González
+ - Piergiuseppe Longo
+ - Kevin Auivinet
- Liverbool (liverbool)
+ - Aurélien MARTIN
- Malte Schlüter
- Jules Matsounga (hyoa)
+ - Quentin Dequippe (qdequippe)
- khoptynskyi
- Sam Malone
+ - Christin Gruber (christingruber)
- Phan Thanh Ha (haphan)
- Chris Jones (leek)
- neghmurken
@@ -1371,7 +1381,6 @@ Symfony is the result of the work of many people who made the code better
- benatespina (benatespina)
- Denis Kop
- Jean-Guilhem Rouel (jean-gui)
- - HypeMC
- jfcixmedia
- Dominic Tubach
- Nikita Konstantinov
@@ -1409,6 +1418,7 @@ Symfony is the result of the work of many people who made the code better
- Alex Demchenko (pilot)
- Tadas Gliaubicas (tadcka)
- Thanos Polymeneas (thanos)
+ - Jon Green
- Atthaphon Urairat
- Benoit Garret
- Maximilian Ruta (deltachaos)
@@ -1524,6 +1534,7 @@ Symfony is the result of the work of many people who made the code better
- MightyBranch
- Kacper Gunia (cakper)
- Peter Thompson (petert82)
+ - Victor Macko (victor_m)
- error56
- Felicitus
- Krzysztof Przybyszewski
@@ -1542,6 +1553,7 @@ Symfony is the result of the work of many people who made the code better
- Islam Israfilov (islam93)
- Arthur Woimbée
- tsufeki
+ - Théo DELCEY
- dangkhoagms
- Philipp Strube
- Andrii Serdiuk (andreyserdjuk)
@@ -1597,6 +1609,7 @@ Symfony is the result of the work of many people who made the code better
- Malaney J. Hill
- Alexandre Pavy
- Adiel Cristo (arcristo)
+ - Artem Stepin (astepin)
- Christian Flach (cmfcmf)
- Cédric Girard (enk_)
- Lars Ambrosius Wallenborn (larsborn)
@@ -1604,12 +1617,14 @@ Symfony is the result of the work of many people who made the code better
- Sebastian Göttschkes (sgoettschkes)
- Tatsuya Tsuruoka
- Ross Tuck
+ - Gerben Oolbekkink
- Kévin Gomez (kevin)
- Mihai Nica (redecs)
- Andrei Igna
- Adam Prickett
- azine
- Javier Espinosa
+ - Luke Towers
- Anton Kroshilin
- Dawid Sajdak
- Norman Soetbeer
@@ -1663,6 +1678,7 @@ Symfony is the result of the work of many people who made the code better
- Klaas Cuvelier (kcuvelier)
- Flavien Knuchel (knuch)
- Mathieu TUDISCO (mathieutu)
+ - Dmytro Dzubenko
- markusu49
- Steve Frécinaux
- Constantine Shtompel
@@ -1674,6 +1690,7 @@ Symfony is the result of the work of many people who made the code better
- ShiraNai7
- Cedrick Oka
- Antal Áron (antalaron)
+ - Guillaume Sainthillier (guillaume-sainthillier)
- Vašek Purchart (vasek-purchart)
- Janusz Jabłoński (yanoosh)
- Fleuv
@@ -1712,11 +1729,11 @@ Symfony is the result of the work of many people who made the code better
- Luis Galeas
- Bogdan Scordaliu
- Martin Pärtel
+ - Fabien S (bafs)
- Daniel Rotter (danrot)
- Frédéric Bouchery (fbouchery)
- Patrick Daley (padrig)
- Max Summe
- - Simon Berger
- WedgeSama
- Hugo Sales
- Felds Liscia
@@ -1798,13 +1815,13 @@ Symfony is the result of the work of many people who made the code better
- Alex Silcock
- Raphael Hardt
- Qingshan Luo
- - Gijs van Lammeren
- Ergie Gonzaga
- Matthew J Mucklo
- AnrDaemon
- SnakePin
- Emre Akinci (emre)
- fdgdfg (psampaz)
+ - Andrea Ruggiero (pupax)
- Stéphane Seng
- Maxwell Vandervelde
- kaywalker
@@ -2013,6 +2030,7 @@ Symfony is the result of the work of many people who made the code better
- Rémi Faivre (rfv)
- Thierry Marianne (thierrymarianne)
- Nick Stemerdink
+ - Bernhard Rusch
- David Stone
- jjanvier
- Julius Beckmann
@@ -2254,6 +2272,7 @@ Symfony is the result of the work of many people who made the code better
- Haritz
- Matthieu Prat
- Grummfy
+ - pdragun
- Paul Le Corre
- Filipe Guerra
- Jean Ragouin
@@ -2457,6 +2476,7 @@ Symfony is the result of the work of many people who made the code better
- wesleyh
- sergey
- Menno Holtkamp
+ - Ser5
- Michael Hudson-Doyle
- Daniel Bannert
- Karim Miladi
@@ -2470,7 +2490,9 @@ Symfony is the result of the work of many people who made the code better
- Anonymous User
- Paweł Tomulik
- Eric J. Duran
+ - Pavol Tuka
- Alexandru Bucur
+ - Alexis Lefebvre
- cmfcmf
- Michal Forbak
- Drew Butler
@@ -2573,7 +2595,6 @@ Symfony is the result of the work of many people who made the code better
- parhs
- Diego Campoy
- TeLiXj
- - Vincent Langlet
- Oncle Tom
- Sam Anthony
- Christian Stocker
@@ -2615,6 +2636,7 @@ Symfony is the result of the work of many people who made the code better
- Siragusa (asiragusa)
- Daniel Basten (axhm3a)
- Dude (b1rdex)
+ - Gerard Berengue Llobera (bere)
- Bernd Matzner (bmatzner)
- Bram Tweedegolf (bram_tweedegolf)
- Brandon Kelly (brandonkelly)
diff --git a/composer.json b/composer.json
index d318bb7b227e4..e92efba50fae6 100644
--- a/composer.json
+++ b/composer.json
@@ -170,11 +170,13 @@
"repositories": [
{
"type": "path",
- "url": "src/Symfony/Contracts"
+ "url": "src/Symfony/Contracts",
+ "options": {
+ "versions": {
+ "symfony/contracts": "2.3.x-dev"
+ }
+ }
}
],
- "minimum-stability": "dev",
- "extra": {
- "branch-version": "5.2"
- }
+ "minimum-stability": "dev"
}
diff --git a/src/Symfony/Bridge/Doctrine/CHANGELOG.md b/src/Symfony/Bridge/Doctrine/CHANGELOG.md
index ea6918de35f1c..af0b9366a1b66 100644
--- a/src/Symfony/Bridge/Doctrine/CHANGELOG.md
+++ b/src/Symfony/Bridge/Doctrine/CHANGELOG.md
@@ -5,7 +5,7 @@ CHANGELOG
-----
* added support for symfony/uid as `UlidType` and `UuidType` as Doctrine types
- * added `UlidGenerator`, `UUidV1Generator`, `UuidV4Generator` and `UuidV6Generator`
+ * added `UlidGenerator`, `UuidV1Generator`, `UuidV4Generator` and `UuidV6Generator`
5.0.0
-----
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
index 8953038860fb8..364bf3b3acb96 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
@@ -15,6 +15,9 @@
use Doctrine\ORM\Id\AbstractIdGenerator;
use Symfony\Component\Uid\Ulid;
+/**
+ * @experimental in 5.2
+ */
final class UlidGenerator extends AbstractIdGenerator
{
public function generate(EntityManager $em, $entity): Ulid
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV1Generator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV1Generator.php
index 21d2fd6c19314..55f6eb1eb2113 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV1Generator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV1Generator.php
@@ -15,6 +15,9 @@
use Doctrine\ORM\Id\AbstractIdGenerator;
use Symfony\Component\Uid\UuidV1;
+/**
+ * @experimental in 5.2
+ */
final class UuidV1Generator extends AbstractIdGenerator
{
public function generate(EntityManager $em, $entity): UuidV1
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV4Generator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV4Generator.php
index 35b94a7cd0196..8731daa641032 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV4Generator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV4Generator.php
@@ -15,6 +15,9 @@
use Doctrine\ORM\Id\AbstractIdGenerator;
use Symfony\Component\Uid\UuidV4;
+/**
+ * @experimental in 5.2
+ */
final class UuidV4Generator extends AbstractIdGenerator
{
public function generate(EntityManager $em, $entity): UuidV4
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV6Generator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV6Generator.php
index 3677af1c2de70..cdcd908e93647 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV6Generator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidV6Generator.php
@@ -15,6 +15,9 @@
use Doctrine\ORM\Id\AbstractIdGenerator;
use Symfony\Component\Uid\UuidV6;
+/**
+ * @experimental in 5.2
+ */
final class UuidV6Generator extends AbstractIdGenerator
{
public function generate(EntityManager $em, $entity): UuidV6
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
index dff43279cfc46..268dc29b6ece0 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
@@ -831,4 +831,85 @@ public function testValidateUniquenessCause()
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
}
+
+ /**
+ * @dataProvider resultWithEmptyIterator
+ */
+ public function testValidateUniquenessWithEmptyIterator($entity, $result)
+ {
+ $constraint = new UniqueEntity([
+ 'message' => 'myMessage',
+ 'fields' => ['name'],
+ 'em' => self::EM_NAME,
+ 'repositoryMethod' => 'findByCustom',
+ ]);
+
+ $repository = $this->createRepositoryMock();
+ $repository->expects($this->once())
+ ->method('findByCustom')
+ ->willReturn($result)
+ ;
+ $this->em = $this->createEntityManagerMock($repository);
+ $this->registry = $this->createRegistryMock($this->em);
+ $this->validator = $this->createValidator();
+ $this->validator->initialize($this->context);
+
+ $this->validator->validate($entity, $constraint);
+
+ $this->assertNoViolation();
+ }
+
+ public function resultWithEmptyIterator(): array
+ {
+ $entity = new SingleIntIdEntity(1, 'foo');
+
+ return [
+ [$entity, new class() implements \Iterator {
+ public function current()
+ {
+ return null;
+ }
+
+ public function valid(): bool
+ {
+ return false;
+ }
+
+ public function next()
+ {
+ }
+
+ public function key()
+ {
+ }
+
+ public function rewind()
+ {
+ }
+ }],
+ [$entity, new class() implements \Iterator {
+ public function current()
+ {
+ return false;
+ }
+
+ public function valid(): bool
+ {
+ return false;
+ }
+
+ public function next()
+ {
+ }
+
+ public function key()
+ {
+ }
+
+ public function rewind()
+ {
+ }
+ }],
+ ];
+ }
}
diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
index cc811ef42b7a5..bed785cbd88c9 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
@@ -147,8 +147,7 @@ public function validate($entity, Constraint $constraint)
if ($result instanceof \Countable && 1 < \count($result)) {
$result = [$result->current(), $result->current()];
} else {
- $result = $result->current();
- $result = null === $result ? [] : [$result];
+ $result = $result->valid() && null !== $result->current() ? [$result->current()] : [];
}
} elseif (\is_array($result)) {
reset($result);
diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php
index c8229f1049683..7f0b1ed597e36 100644
--- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php
@@ -113,8 +113,18 @@ public function getFieldValue(FormView $view)
public function getFieldLabel(FormView $view): ?string
{
+ if (false === $label = $view->vars['label']) {
+ return null;
+ }
+
+ if (!$label && $labelFormat = $view->vars['label_format']) {
+ $label = str_replace(['%id%', '%name%'], [$view->vars['id'], $view->vars['name']], $labelFormat);
+ } elseif (!$label) {
+ $label = ucfirst(strtolower(trim(preg_replace(['/([A-Z])/', '/[_\s]+/'], ['_$1', ' '], $view->vars['name']))));
+ }
+
return $this->createFieldTranslation(
- $view->vars['label'],
+ $label,
$view->vars['label_translation_parameters'] ?: [],
$view->vars['translation_domain']
);
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php
index b5f936e1c761a..ce3ee926e11b8 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php
@@ -81,6 +81,7 @@ protected function setUp(): void
],
],
'choice_translation_domain' => 'forms',
+ 'label_format' => 'label format for field "%name%" with id "%id%"',
])
->add('choice_multiple', ChoiceType::class, [
'choices' => [
@@ -89,6 +90,7 @@ protected function setUp(): void
],
'multiple' => true,
'expanded' => true,
+ 'label' => false,
])
->getForm()
;
@@ -121,6 +123,21 @@ public function testFieldTranslatedLabel()
$this->assertSame('[trans]base.username[/trans]', $this->translatorExtension->getFieldLabel($this->view->children['username']));
}
+ public function testFieldLabelFromFormat()
+ {
+ $this->assertSame('label format for field "choice_grouped" with id "register_choice_grouped"', $this->rawExtension->getFieldLabel($this->view->children['choice_grouped']));
+ }
+
+ public function testFieldLabelFallsBackToName()
+ {
+ $this->assertSame('Choice flat', $this->rawExtension->getFieldLabel($this->view->children['choice_flat']));
+ }
+
+ public function testFieldLabelReturnsNullWhenLabelIsDisabled()
+ {
+ $this->assertNull($this->rawExtension->getFieldLabel($this->view->children['choice_multiple']));
+ }
+
public function testFieldHelp()
{
$this->assertSame('base.username_help', $this->rawExtension->getFieldHelp($this->view->children['username']));
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php
index 54c8ec6c00541..ea3bb17bb3038 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php
@@ -21,7 +21,7 @@
class HttpFoundationExtensionTest extends TestCase
{
/**
- * @dataProvider getGenerateAbsoluteUrlData()
+ * @dataProvider getGenerateAbsoluteUrlData
*/
public function testGenerateAbsoluteUrl($expected, $path, $pathinfo)
{
@@ -114,7 +114,7 @@ public function testGenerateAbsoluteUrlWithScriptFileName()
}
/**
- * @dataProvider getGenerateRelativePathData()
+ * @dataProvider getGenerateRelativePathData
*/
public function testGenerateRelativePath($expected, $path, $pathinfo)
{
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
index 30b3edf164637..01d586346ad30 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
@@ -65,7 +65,7 @@ public function testHtmlRedirectionIsIntercepted($statusCode, $hasSession)
{
$response = new Response('Some content', $statusCode);
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock('Redirection'), true);
$listener->onKernelResponse($event);
@@ -78,7 +78,7 @@ public function testNonHtmlRedirectionIsNotIntercepted()
{
$response = new Response('Some content', '301');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'json', true), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'json', true), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock('Redirection'), true);
$listener->onKernelResponse($event);
@@ -92,7 +92,7 @@ public function testToolbarIsInjected()
$response = new Response('
');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -108,7 +108,7 @@ public function testToolbarIsNotInjectedOnNonHtmlContentType()
$response = new Response('');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
$response->headers->set('Content-Type', 'text/xml');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -124,7 +124,7 @@ public function testToolbarIsNotInjectedOnContentDispositionAttachment()
$response = new Response('');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -140,7 +140,7 @@ public function testToolbarIsNotInjectedOnRedirection($statusCode, $hasSession)
{
$response = new Response('', $statusCode);
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'html', $hasSession), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -165,7 +165,7 @@ public function testToolbarIsNotInjectedWhenThereIsNoNoXDebugTokenResponseHeader
{
$response = new Response('');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -181,7 +181,7 @@ public function testToolbarIsNotInjectedWhenOnSubRequest()
$response = new Response('');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::SUB_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::SUB_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -197,7 +197,7 @@ public function testToolbarIsNotInjectedOnIncompleteHtmlResponses()
$response = new Response('Some content
');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -213,7 +213,7 @@ public function testToolbarIsNotInjectedOnXmlHttpRequests()
$response = new Response('');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(true), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(true), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -229,7 +229,7 @@ public function testToolbarIsNotInjectedOnNonHtmlRequests()
$response = new Response('');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'json'), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(false, 'json'), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock());
$listener->onKernelResponse($event);
@@ -242,7 +242,7 @@ public function testXDebugUrlHeader()
$response = new Response();
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $urlGenerator = $this->getUrlGeneratorMock();
+ $urlGenerator = $this->createMock(UrlGeneratorInterface::class);
$urlGenerator
->expects($this->once())
->method('generate')
@@ -250,7 +250,7 @@ public function testXDebugUrlHeader()
->willReturn('http://mydomain.com/_profiler/xxxxxxxx')
;
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator);
$listener->onKernelResponse($event);
@@ -263,7 +263,7 @@ public function testThrowingUrlGenerator()
$response = new Response();
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $urlGenerator = $this->getUrlGeneratorMock();
+ $urlGenerator = $this->createMock(UrlGeneratorInterface::class);
$urlGenerator
->expects($this->once())
->method('generate')
@@ -271,7 +271,7 @@ public function testThrowingUrlGenerator()
->willThrowException(new \Exception('foo'))
;
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator);
$listener->onKernelResponse($event);
@@ -284,7 +284,7 @@ public function testThrowingErrorCleanup()
$response = new Response();
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
- $urlGenerator = $this->getUrlGeneratorMock();
+ $urlGenerator = $this->createMock(UrlGeneratorInterface::class);
$urlGenerator
->expects($this->once())
->method('generate')
@@ -292,7 +292,7 @@ public function testThrowingErrorCleanup()
->willThrowException(new \Exception("This\nmultiline\r\ntabbed text should\tcome out\r on\n \ta single plain\r\nline"))
;
- $event = new ResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
+ $event = new ResponseEvent($this->createMock(Kernel::class), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response);
$listener = new WebDebugToolbarListener($this->getTwigMock(), false, WebDebugToolbarListener::ENABLED, $urlGenerator);
$listener->onKernelResponse($event);
@@ -331,14 +331,4 @@ protected function getTwigMock($render = 'WDT')
return $templating;
}
-
- protected function getUrlGeneratorMock()
- {
- return $this->createMock(UrlGeneratorInterface::class);
- }
-
- protected function getKernelMock()
- {
- return $this->createMock(Kernel::class);
- }
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
index 1e834e15cb830..df67579218b04 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
@@ -20,8 +20,6 @@
use Twig\Loader\LoaderInterface;
/**
- * Test for TemplateManager class.
- *
* @author Artur Wielogórski
*/
class TemplateManagerTest extends TestCase
@@ -37,7 +35,7 @@ class TemplateManagerTest extends TestCase
protected $profiler;
/**
- * @var \Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager
+ * @var TemplateManager
*/
protected $templateManager;
@@ -45,7 +43,7 @@ protected function setUp(): void
{
parent::setUp();
- $profiler = $this->mockProfiler();
+ $this->profiler = $this->createMock(Profiler::class);
$twigEnvironment = $this->mockTwigEnvironment();
$templates = [
'data_collector.foo' => ['foo', '@Foo/Collector/foo.html.twig'],
@@ -53,7 +51,7 @@ protected function setUp(): void
'data_collector.baz' => ['baz', '@Foo/Collector/baz.html.twig'],
];
- $this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);
+ $this->templateManager = new TemplateManager($this->profiler, $twigEnvironment, $templates);
}
public function testGetNameOfInvalidTemplate()
@@ -97,11 +95,6 @@ public function profileHasCollectorCallback($panel)
}
}
- protected function mockProfile()
- {
- return $this->createMock(Profile::class);
- }
-
protected function mockTwigEnvironment()
{
$this->twigEnvironment = $this->createMock(Environment::class);
@@ -116,13 +109,6 @@ protected function mockTwigEnvironment()
return $this->twigEnvironment;
}
-
- protected function mockProfiler()
- {
- $this->profiler = $this->createMock(Profiler::class);
-
- return $this->profiler;
- }
}
class ProfileDummy extends Profile
diff --git a/src/Symfony/Component/Console/EventListener/ErrorListener.php b/src/Symfony/Component/Console/EventListener/ErrorListener.php
index a34075793e165..897d9853f2848 100644
--- a/src/Symfony/Component/Console/EventListener/ErrorListener.php
+++ b/src/Symfony/Component/Console/EventListener/ErrorListener.php
@@ -40,12 +40,12 @@ public function onConsoleError(ConsoleErrorEvent $event)
$error = $event->getError();
if (!$inputString = $this->getInputString($event)) {
- $this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
+ $this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
return;
}
- $this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
+ $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
}
public function onConsoleTerminate(ConsoleTerminateEvent $event)
diff --git a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
index ce3df1a0ec7bd..2bafab040f8b6 100644
--- a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
+++ b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
@@ -30,35 +30,35 @@ public function testOnConsoleError()
{
$error = new \TypeError('An error occurred');
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->once())
- ->method('error')
+ ->method('critical')
->with('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'])
;
$listener = new ErrorListener($logger);
- $listener->onConsoleError(new ConsoleErrorEvent(new ArgvInput(['console.php', 'test:run', '--foo=baz', 'buzz']), $this->getOutput(), $error, new Command('test:run')));
+ $listener->onConsoleError(new ConsoleErrorEvent(new ArgvInput(['console.php', 'test:run', '--foo=baz', 'buzz']), $this->createMock(OutputInterface::class), $error, new Command('test:run')));
}
public function testOnConsoleErrorWithNoCommandAndNoInputString()
{
$error = new \RuntimeException('An error occurred');
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->once())
- ->method('error')
+ ->method('critical')
->with('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => 'An error occurred'])
;
$listener = new ErrorListener($logger);
- $listener->onConsoleError(new ConsoleErrorEvent(new NonStringInput(), $this->getOutput(), $error));
+ $listener->onConsoleError(new ConsoleErrorEvent(new NonStringInput(), $this->createMock(OutputInterface::class), $error));
}
public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog()
{
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->once())
->method('debug')
@@ -71,7 +71,7 @@ public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog()
public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog()
{
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->never())
->method('debug')
@@ -83,7 +83,7 @@ public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog()
public function testGetSubscribedEvents()
{
- $this->assertEquals(
+ $this->assertSame(
[
'console.error' => ['onConsoleError', -128],
'console.terminate' => ['onConsoleTerminate', -128],
@@ -94,7 +94,7 @@ public function testGetSubscribedEvents()
public function testAllKindsOfInputCanBeLogged()
{
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->exactly(3))
->method('debug')
@@ -109,7 +109,7 @@ public function testAllKindsOfInputCanBeLogged()
public function testCommandNameIsDisplayedForNonStringableInput()
{
- $logger = $this->getLogger();
+ $logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->once())
->method('debug')
@@ -120,19 +120,9 @@ public function testCommandNameIsDisplayedForNonStringableInput()
$listener->onConsoleTerminate($this->getConsoleTerminateEvent($this->createMock(InputInterface::class), 255));
}
- private function getLogger()
- {
- return $this->getMockForAbstractClass(LoggerInterface::class);
- }
-
private function getConsoleTerminateEvent(InputInterface $input, $exitCode)
{
- return new ConsoleTerminateEvent(new Command('test:run'), $input, $this->getOutput(), $exitCode);
- }
-
- private function getOutput()
- {
- return $this->createMock(OutputInterface::class);
+ return new ConsoleTerminateEvent(new Command('test:run'), $input, $this->createMock(OutputInterface::class), $exitCode);
}
}
diff --git a/src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedMethodErrorEnhancer.php b/src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedMethodErrorEnhancer.php
index ad0e4b3eef00b..c4355f92ce089 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedMethodErrorEnhancer.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedMethodErrorEnhancer.php
@@ -39,7 +39,7 @@ public function enhance(\Throwable $error): ?\Throwable
$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
- if (!class_exists($className) || null === $methods = get_class_methods($className)) {
+ if ('' === $methodName || !class_exists($className) || null === $methods = get_class_methods($className)) {
// failed to get the class or its methods on which an unknown method was called (for example on an anonymous class)
return new UndefinedMethodError($message, $error);
}
diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorEnhancer/UndefinedMethodErrorEnhancerTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorEnhancer/UndefinedMethodErrorEnhancerTest.php
index d6ac6c029c6fb..b31c6c292a8f4 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/ErrorEnhancer/UndefinedMethodErrorEnhancerTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorEnhancer/UndefinedMethodErrorEnhancerTest.php
@@ -40,6 +40,10 @@ public function provideUndefinedMethodData()
'Call to undefined method SplObjectStorage::what()',
'Attempted to call an undefined method named "what" of class "SplObjectStorage".',
],
+ [
+ 'Call to undefined method SplObjectStorage::()',
+ 'Attempted to call an undefined method named "" of class "SplObjectStorage".',
+ ],
[
'Call to undefined method SplObjectStorage::walid()',
"Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?",
diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php
index c3f7cad1b7e9e..65154ef2f2b44 100644
--- a/src/Symfony/Component/Finder/Finder.php
+++ b/src/Symfony/Component/Finder/Finder.php
@@ -654,7 +654,8 @@ public function append(iterable $iterator)
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
$it = new \ArrayIterator();
foreach ($iterator as $file) {
- $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
+ $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
+ $it[$file->getPathname()] = $file;
}
$this->iterators[] = $it;
} else {
diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php
index 5c75294979690..83e3a01e3106a 100644
--- a/src/Symfony/Component/Finder/Tests/FinderTest.php
+++ b/src/Symfony/Component/Finder/Tests/FinderTest.php
@@ -1118,6 +1118,17 @@ public function testAppendDoesNotRequireIn()
$this->assertIterator(iterator_to_array($finder->getIterator()), $finder1->getIterator());
}
+ public function testMultipleAppendCallsWithSorting()
+ {
+ $finder = $this->buildFinder()
+ ->sortByName()
+ ->append([self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_1000_1.php'])
+ ->append([self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_1002_0.php'])
+ ;
+
+ $this->assertOrderedIterator($this->toAbsolute(['qux_1000_1.php', 'qux_1002_0.php']), $finder->getIterator());
+ }
+
public function testCountDirectories()
{
$directory = Finder::create()->directories()->in(self::$tmpDir);
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index 6395782f07438..dc39d13e0f8e4 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -76,7 +76,7 @@ public function testCreateNamedBuilderWithTypeName()
{
$options = ['a' => '1', 'b' => '2'];
$resolvedOptions = ['a' => '2', 'b' => '3'];
- $resolvedType = $this->getMockResolvedType();
+ $resolvedType = $this->createMock(ResolvedFormTypeInterface::class);
$this->registry->expects($this->once())
->method('getType')
@@ -104,7 +104,7 @@ public function testCreateNamedBuilderFillsDataOption()
$givenOptions = ['a' => '1', 'b' => '2'];
$expectedOptions = array_merge($givenOptions, ['data' => 'DATA']);
$resolvedOptions = ['a' => '2', 'b' => '3', 'data' => 'DATA'];
- $resolvedType = $this->getMockResolvedType();
+ $resolvedType = $this->createMock(ResolvedFormTypeInterface::class);
$this->registry->expects($this->once())
->method('getType')
@@ -131,7 +131,7 @@ public function testCreateNamedBuilderDoesNotOverrideExistingDataOption()
{
$options = ['a' => '1', 'b' => '2', 'data' => 'CUSTOM'];
$resolvedOptions = ['a' => '2', 'b' => '3', 'data' => 'CUSTOM'];
- $resolvedType = $this->getMockResolvedType();
+ $resolvedType = $this->createMock(ResolvedFormTypeInterface::class);
$this->registry->expects($this->once())
->method('getType')
@@ -196,7 +196,7 @@ public function testCreateNamed()
{
$options = ['a' => '1', 'b' => '2'];
$resolvedOptions = ['a' => '2', 'b' => '3'];
- $resolvedType = $this->getMockResolvedType();
+ $resolvedType = $this->createMock(ResolvedFormTypeInterface::class);
$this->registry->expects($this->once())
->method('getType')
@@ -470,9 +470,4 @@ private function getMockFactory(array $methods = [])
->setConstructorArgs([$this->registry])
->getMock();
}
-
- private function getMockResolvedType()
- {
- return $this->createMock(ResolvedFormTypeInterface::class);
- }
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 3633f2e93f5e9..c93ad3ac1dc7b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -727,7 +727,7 @@ public function testGetUriForPath()
}
/**
- * @dataProvider getRelativeUriForPathData()
+ * @dataProvider getRelativeUriForPathData
*/
public function testGetRelativeUriForPath($expected, $pathinfo, $path)
{
diff --git a/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php b/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
index 758b9c16a8724..7d96f730d7eae 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/UrlHelperTest.php
@@ -20,7 +20,7 @@
class UrlHelperTest extends TestCase
{
/**
- * @dataProvider getGenerateAbsoluteUrlData()
+ * @dataProvider getGenerateAbsoluteUrlData
*/
public function testGenerateAbsoluteUrl($expected, $path, $pathinfo)
{
@@ -113,7 +113,7 @@ public function testGenerateAbsoluteUrlWithScriptFileName()
}
/**
- * @dataProvider getGenerateRelativePathData()
+ * @dataProvider getGenerateRelativePathData
*/
public function testGenerateRelativePath($expected, $path, $pathinfo)
{
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 409f9519393e4..18c077b5e21a4 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -74,11 +74,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private static $freshCache = [];
- public const VERSION = '5.2.2';
- public const VERSION_ID = 50202;
+ public const VERSION = '5.2.3';
+ public const VERSION_ID = 50203;
public const MAJOR_VERSION = 5;
public const MINOR_VERSION = 2;
- public const RELEASE_VERSION = 2;
+ public const RELEASE_VERSION = 3;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '07/2021';
diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
index 80c1b576be3e9..80d9796070bc0 100644
--- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php
@@ -31,7 +31,7 @@ public static function tearDownAfterClass(): void
public function testInjectClearersInConstructor()
{
- $clearer = $this->getMockClearer();
+ $clearer = $this->createMock(CacheClearerInterface::class);
$clearer
->expects($this->once())
->method('clear');
@@ -39,9 +39,4 @@ public function testInjectClearersInConstructor()
$chainClearer = new ChainCacheClearer([$clearer]);
$chainClearer->clear(self::$cacheDir);
}
-
- protected function getMockClearer()
- {
- return $this->createMock(CacheClearerInterface::class);
- }
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
index def3831851345..fab9a8a38f607 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
@@ -19,8 +19,6 @@
use Symfony\Component\HttpKernel\KernelEvents;
/**
- * Test AddRequestFormatsListener class.
- *
* @author Gildas Quemener
*/
class AddRequestFormatsListenerTest extends TestCase
@@ -47,7 +45,7 @@ public function testIsAnEventSubscriber()
public function testRegisteredEvent()
{
- $this->assertEquals(
+ $this->assertSame(
[KernelEvents::REQUEST => ['onKernelRequest', 100]],
AddRequestFormatsListener::getSubscribedEvents()
);
@@ -55,7 +53,7 @@ public function testRegisteredEvent()
public function testSetAdditionalFormats()
{
- $request = $this->getRequestMock();
+ $request = $this->createMock(Request::class);
$event = $this->getRequestEventMock($request);
$request->expects($this->once())
@@ -65,11 +63,6 @@ public function testSetAdditionalFormats()
$this->listener->onKernelRequest($event);
}
- protected function getRequestMock()
- {
- return $this->createMock(Request::class);
- }
-
protected function getRequestEventMock(Request $request)
{
$event = $this->createMock(RequestEvent::class);
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
index 20c9f9d8c9e44..ab92a7916877e 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php
@@ -40,7 +40,7 @@ public function testLocaleIsSetInOnKernelRequest()
->method('setLocale')
->with($this->equalTo('fr'));
- $event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
+ $event = new RequestEvent($this->createMock(HttpKernelInterface::class), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
$this->listener->onKernelRequest($event);
}
@@ -57,7 +57,7 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
$this->throwException(new \InvalidArgumentException())
);
- $event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
+ $event = new RequestEvent($this->createMock(HttpKernelInterface::class), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
$this->listener->onKernelRequest($event);
}
@@ -71,7 +71,7 @@ public function testLocaleIsSetInOnKernelFinishRequestWhenParentRequestExists()
$this->requestStack->push($this->createRequest('fr'));
$this->requestStack->push($subRequest = $this->createRequest('de'));
- $event = new FinishRequestEvent($this->createHttpKernel(), $subRequest, HttpKernelInterface::SUB_REQUEST);
+ $event = new FinishRequestEvent($this->createMock(HttpKernelInterface::class), $subRequest, HttpKernelInterface::SUB_REQUEST);
$this->listener->onKernelFinishRequest($event);
}
@@ -84,7 +84,7 @@ public function testLocaleIsSetToDefaultOnKernelFinishRequestWhenParentRequestDo
$this->requestStack->push($subRequest = $this->createRequest('de'));
- $event = new FinishRequestEvent($this->createHttpKernel(), $subRequest, HttpKernelInterface::SUB_REQUEST);
+ $event = new FinishRequestEvent($this->createMock(HttpKernelInterface::class), $subRequest, HttpKernelInterface::SUB_REQUEST);
$this->listener->onKernelFinishRequest($event);
}
@@ -104,15 +104,10 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
$this->requestStack->push($this->createRequest('fr'));
$this->requestStack->push($subRequest = $this->createRequest('de'));
- $event = new FinishRequestEvent($this->createHttpKernel(), $subRequest, HttpKernelInterface::SUB_REQUEST);
+ $event = new FinishRequestEvent($this->createMock(HttpKernelInterface::class), $subRequest, HttpKernelInterface::SUB_REQUEST);
$this->listener->onKernelFinishRequest($event);
}
- private function createHttpKernel()
- {
- return $this->createMock(HttpKernelInterface::class);
- }
-
private function createRequest($locale)
{
$request = new Request();
diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php
index 2984ba31d11da..52a7c29f41cb7 100644
--- a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php
+++ b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php
@@ -100,15 +100,16 @@ public function testSend()
public function testSendThrowsForErrorResponse()
{
$client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface {
- $xml = "
-
- i'm a teapot
- 418
-
- ";
-
- return new MockResponse($xml, [
+ $json = json_encode([
+ 'message' => 'i\'m a teapot',
+ 'type' => 'sender',
+ ]);
+
+ return new MockResponse($json, [
'http_code' => 418,
+ 'response_headers' => [
+ 'x-amzn-errortype' => '418',
+ ],
]);
});
diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesHttpAsyncAwsTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesHttpAsyncAwsTransportTest.php
index 5b79491fbcb0d..6bdd9b779d58d 100644
--- a/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesHttpAsyncAwsTransportTest.php
+++ b/src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesHttpAsyncAwsTransportTest.php
@@ -95,15 +95,16 @@ public function testSend()
public function testSendThrowsForErrorResponse()
{
$client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface {
- $xml = "
-
- i'm a teapot
- 418
-
- ";
-
- return new MockResponse($xml, [
+ $json = json_encode([
+ 'message' => 'i\'m a teapot',
+ 'type' => 'sender',
+ ]);
+
+ return new MockResponse($json, [
'http_code' => 418,
+ 'response_headers' => [
+ 'x-amzn-errortype' => '418',
+ ],
]);
});
diff --git a/src/Symfony/Component/Mailer/EventListener/MessageListener.php b/src/Symfony/Component/Mailer/EventListener/MessageListener.php
index dbf2570a27eac..f23c69d91dc74 100644
--- a/src/Symfony/Component/Mailer/EventListener/MessageListener.php
+++ b/src/Symfony/Component/Mailer/EventListener/MessageListener.php
@@ -58,7 +58,7 @@ public function addHeaderRule(string $headerName, int $rule): void
throw new InvalidArgumentException(sprintf('The "%d" rule is not supported.', $rule));
}
- $this->headerRules[$headerName] = $rule;
+ $this->headerRules[strtolower($headerName)] = $rule;
}
public function onMessage(MessageEvent $event): void
diff --git a/src/Symfony/Component/Mailer/Tests/EventListener/MessageListenerTest.php b/src/Symfony/Component/Mailer/Tests/EventListener/MessageListenerTest.php
index 6096f5614cb2c..41f71f72adf37 100644
--- a/src/Symfony/Component/Mailer/Tests/EventListener/MessageListenerTest.php
+++ b/src/Symfony/Component/Mailer/Tests/EventListener/MessageListenerTest.php
@@ -101,5 +101,17 @@ public function provideHeaders(): iterable
->add(new MailboxListHeader('bcc', [new Address('bcc-initial@example.com'), new Address('bcc-default@example.com'), new Address('bcc-default-1@example.com')]))
;
yield 'bcc, add another bcc (unique header)' => [$initialHeaders, $defaultHeaders, $expectedHeaders];
+
+ $initialHeaders = (new Headers())
+ ->add(new UnstructuredHeader('foo', 'initial'))
+ ;
+ $defaultHeaders = (new Headers())
+ ->add(new UnstructuredHeader('foo', 'bar'))
+ ->add(new UnstructuredHeader('bar', 'foo'))
+ ;
+ $rules = [
+ 'Foo' => MessageListener::HEADER_REPLACE,
+ ];
+ yield 'Capitalized header rule (case-insensitive), replace if set' => [$initialHeaders, $defaultHeaders, $defaultHeaders, $rules];
}
}
diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php
index 9217550d14709..4490c7521f366 100644
--- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php
+++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php
@@ -87,7 +87,7 @@ public function setup(): void
{
parent::setup();
- $this->executeStatement(implode("\n", $this->getTriggerSql()));
+ $this->executeStatement('BEGIN;'.implode("\n", $this->getTriggerSql()).'COMMIT;');
}
/**
@@ -109,7 +109,6 @@ public function getExtraSetupSqlForTable(Table $createdTable): array
private function getTriggerSql(): array
{
return [
- 'BEGIN;',
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
// create trigger function
sprintf(<<<'SQL'
@@ -124,7 +123,6 @@ private function getTriggerSql(): array
// register trigger
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON %1$s FOR EACH ROW EXECUTE PROCEDURE notify_%1$s();', $this->configuration['table_name']),
- 'COMMIT;',
];
}
diff --git a/src/Symfony/Component/Mime/Header/Headers.php b/src/Symfony/Component/Mime/Header/Headers.php
index 9493e2c2da234..b8d8da64f0718 100644
--- a/src/Symfony/Component/Mime/Header/Headers.php
+++ b/src/Symfony/Component/Mime/Header/Headers.php
@@ -143,7 +143,7 @@ public function addParameterizedHeader(string $name, string $value, array $param
*/
public function addHeader(string $name, $argument, array $more = []): self
{
- $parts = explode('\\', self::HEADER_CLASS_MAP[$name] ?? UnstructuredHeader::class);
+ $parts = explode('\\', self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class);
$method = 'add'.ucfirst(array_pop($parts));
if ('addUnstructuredHeader' === $method) {
$method = 'addTextHeader';
@@ -217,7 +217,7 @@ public function remove(string $name): void
public static function isUniqueHeader(string $name): bool
{
- return \in_array($name, self::UNIQUE_HEADERS, true);
+ return \in_array(strtolower($name), self::UNIQUE_HEADERS, true);
}
/**
diff --git a/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php b/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php
index 2255dbe7a7c8c..f465fb9e8515f 100644
--- a/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php
+++ b/src/Symfony/Component/Mime/Tests/Header/HeadersTest.php
@@ -239,6 +239,20 @@ public function testRemoveIsNotCaseSensitive()
$this->assertFalse($headers->has('Message-ID'));
}
+ public function testAddHeaderIsNotCaseSensitive()
+ {
+ $headers = new Headers();
+ $headers->addHeader('From', ['from@example.com']);
+
+ $this->assertInstanceOf(MailboxListHeader::class, $headers->get('from'));
+ $this->assertEquals([new Address('from@example.com')], $headers->get('from')->getBody());
+ }
+
+ public function testIsUniqueHeaderIsNotCaseSensitive()
+ {
+ $this->assertTrue(Headers::isUniqueHeader('From'));
+ }
+
public function testToStringJoinsHeadersTogether()
{
$headers = new Headers();
diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
index 70c8e7a113791..cd1924c63edf6 100644
--- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php
@@ -107,8 +107,8 @@ protected function getRememberMeToken()
protected function getResolver()
{
return new AuthenticationTrustResolver(
- 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken',
- 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\RememberMeToken'
+ AnonymousToken::class,
+ RememberMeToken::class
);
}
}
diff --git a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
index cb172d2b5138b..b7e2a411b392d 100644
--- a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
@@ -24,7 +24,7 @@ class ChainUserProviderTest extends TestCase
{
public function testLoadUserByUsername()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('loadUserByUsername')
@@ -32,12 +32,12 @@ public function testLoadUserByUsername()
->willThrowException(new UsernameNotFoundException('not found'))
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('loadUserByUsername')
->with($this->equalTo('foo'))
- ->willReturn($account = $this->getAccount())
+ ->willReturn($account = $this->createMock(UserInterface::class))
;
$provider = new ChainUserProvider([$provider1, $provider2]);
@@ -47,7 +47,7 @@ public function testLoadUserByUsername()
public function testLoadUserByUsernameThrowsUsernameNotFoundException()
{
$this->expectException(UsernameNotFoundException::class);
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('loadUserByUsername')
@@ -55,7 +55,7 @@ public function testLoadUserByUsernameThrowsUsernameNotFoundException()
->willThrowException(new UsernameNotFoundException('not found'))
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('loadUserByUsername')
@@ -69,14 +69,14 @@ public function testLoadUserByUsernameThrowsUsernameNotFoundException()
public function testRefreshUser()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
->willReturn(false)
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -89,7 +89,7 @@ public function testRefreshUser()
->willThrowException(new UnsupportedUserException('unsupported'))
;
- $provider3 = $this->getProvider();
+ $provider3 = $this->createMock(UserProviderInterface::class);
$provider3
->expects($this->once())
->method('supportsClass')
@@ -99,16 +99,16 @@ public function testRefreshUser()
$provider3
->expects($this->once())
->method('refreshUser')
- ->willReturn($account = $this->getAccount())
+ ->willReturn($account = $this->createMock(UserInterface::class))
;
$provider = new ChainUserProvider([$provider1, $provider2, $provider3]);
- $this->assertSame($account, $provider->refreshUser($this->getAccount()));
+ $this->assertSame($account, $provider->refreshUser($this->createMock(UserInterface::class)));
}
public function testRefreshUserAgain()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
@@ -121,7 +121,7 @@ public function testRefreshUserAgain()
->willThrowException(new UsernameNotFoundException('not found'))
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -131,17 +131,17 @@ public function testRefreshUserAgain()
$provider2
->expects($this->once())
->method('refreshUser')
- ->willReturn($account = $this->getAccount())
+ ->willReturn($account = $this->createMock(UserInterface::class))
;
$provider = new ChainUserProvider([$provider1, $provider2]);
- $this->assertSame($account, $provider->refreshUser($this->getAccount()));
+ $this->assertSame($account, $provider->refreshUser($this->createMock(UserInterface::class)));
}
public function testRefreshUserThrowsUnsupportedUserException()
{
$this->expectException(UnsupportedUserException::class);
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
@@ -154,7 +154,7 @@ public function testRefreshUserThrowsUnsupportedUserException()
->willThrowException(new UnsupportedUserException('unsupported'))
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -168,12 +168,12 @@ public function testRefreshUserThrowsUnsupportedUserException()
;
$provider = new ChainUserProvider([$provider1, $provider2]);
- $provider->refreshUser($this->getAccount());
+ $provider->refreshUser($this->createMock(UserInterface::class));
}
public function testSupportsClass()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
@@ -181,7 +181,7 @@ public function testSupportsClass()
->willReturn(false)
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -195,7 +195,7 @@ public function testSupportsClass()
public function testSupportsClassWhenNotSupported()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
@@ -203,7 +203,7 @@ public function testSupportsClassWhenNotSupported()
->willReturn(false)
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -217,7 +217,7 @@ public function testSupportsClassWhenNotSupported()
public function testAcceptsTraversable()
{
- $provider1 = $this->getProvider();
+ $provider1 = $this->createMock(UserProviderInterface::class);
$provider1
->expects($this->once())
->method('supportsClass')
@@ -230,7 +230,7 @@ public function testAcceptsTraversable()
->willThrowException(new UnsupportedUserException('unsupported'))
;
- $provider2 = $this->getProvider();
+ $provider2 = $this->createMock(UserProviderInterface::class);
$provider2
->expects($this->once())
->method('supportsClass')
@@ -240,11 +240,11 @@ public function testAcceptsTraversable()
$provider2
->expects($this->once())
->method('refreshUser')
- ->willReturn($account = $this->getAccount())
+ ->willReturn($account = $this->createMock(UserInterface::class))
;
$provider = new ChainUserProvider(new \ArrayObject([$provider1, $provider2]));
- $this->assertSame($account, $provider->refreshUser($this->getAccount()));
+ $this->assertSame($account, $provider->refreshUser($this->createMock(UserInterface::class)));
}
public function testPasswordUpgrades()
@@ -268,14 +268,4 @@ public function testPasswordUpgrades()
$provider = new ChainUserProvider([$provider1, $provider2]);
$provider->upgradePassword($user, 'foobar');
}
-
- protected function getAccount()
- {
- return $this->createMock(UserInterface::class);
- }
-
- protected function getProvider()
- {
- return $this->createMock(UserProviderInterface::class);
- }
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
index 617d27f99b4f8..2be5a50ded7b5 100644
--- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
@@ -54,7 +54,7 @@ protected function setUp(): void
{
$user = $this->createUser();
$this->tokenStorage = $this->createTokenStorage($user);
- $this->encoder = $this->createPasswordEncoder();
+ $this->encoder = $this->createMock(PasswordEncoderInterface::class);
$this->encoderFactory = $this->createEncoderFactory($this->encoder);
parent::setUp();
@@ -154,11 +154,6 @@ protected function createUser()
return $mock;
}
- protected function createPasswordEncoder($isPasswordValid = true)
- {
- return $this->createMock(PasswordEncoderInterface::class);
- }
-
protected function createEncoderFactory($encoder = null)
{
$mock = $this->createMock(EncoderFactoryInterface::class);
diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
index 94ff9228bca29..69953ae6fd14e 100644
--- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
@@ -25,7 +25,7 @@ public function testSessionIsNotChanged()
$request->expects($this->never())->method('getSession');
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::NONE);
- $strategy->onAuthentication($request, $this->getToken());
+ $strategy->onAuthentication($request, $this->createMock(TokenInterface::class));
}
public function testUnsupportedStrategy()
@@ -36,7 +36,7 @@ public function testUnsupportedStrategy()
$request->expects($this->never())->method('getSession');
$strategy = new SessionAuthenticationStrategy('foo');
- $strategy->onAuthentication($request, $this->getToken());
+ $strategy->onAuthentication($request, $this->createMock(TokenInterface::class));
}
public function testSessionIsMigrated()
@@ -45,7 +45,7 @@ public function testSessionIsMigrated()
$session->expects($this->once())->method('migrate')->with($this->equalTo(true));
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE);
- $strategy->onAuthentication($this->getRequest($session), $this->getToken());
+ $strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class));
}
public function testSessionIsInvalidated()
@@ -54,7 +54,7 @@ public function testSessionIsInvalidated()
$session->expects($this->once())->method('invalidate');
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::INVALIDATE);
- $strategy->onAuthentication($this->getRequest($session), $this->getToken());
+ $strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class));
}
private function getRequest($session = null)
@@ -67,9 +67,4 @@ private function getRequest($session = null)
return $request;
}
-
- private function getToken()
- {
- return $this->createMock(TokenInterface::class);
- }
}
diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
index 4b438c2d51fc9..c830359d269f0 100644
--- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
@@ -111,8 +111,9 @@ protected function extractAttributes(object $object, string $format = null, arra
// properties
foreach ($reflClass->getProperties() as $reflProperty) {
+ $isPublic = $reflProperty->isPublic();
+
if ($checkPropertyInitialization) {
- $isPublic = $reflProperty->isPublic();
if (!$isPublic) {
$reflProperty->setAccessible(true);
}
@@ -120,9 +121,10 @@ protected function extractAttributes(object $object, string $format = null, arra
unset($attributes[$reflProperty->name]);
continue;
}
- if (!$isPublic) {
- continue;
- }
+ }
+
+ if (!$isPublic) {
+ continue;
}
if ($reflProperty->isStatic() || !$this->isAllowedAttribute($object, $reflProperty->name, $format, $context)) {
diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DummyPrivatePropertyWithoutGetter.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyPrivatePropertyWithoutGetter.php
new file mode 100644
index 0000000000000..d20832131b29a
--- /dev/null
+++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyPrivatePropertyWithoutGetter.php
@@ -0,0 +1,23 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Serializer\Tests\Fixtures;
+
+final class DummyPrivatePropertyWithoutGetter
+{
+ private $foo = 'foo';
+ private $bar = 'bar';
+
+ public function getBar()
+ {
+ return $this->bar;
+ }
+}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/Features/CallbacksTestTrait.php b/src/Symfony/Component/Serializer/Tests/Normalizer/Features/CallbacksTestTrait.php
index ccb54d9c6fd25..459b01c92408f 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/Features/CallbacksTestTrait.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/Features/CallbacksTestTrait.php
@@ -29,7 +29,7 @@ public function testCallbacks($callbacks, $valueBar, $result)
}
/**
- * @dataProvider provideInvalidCallbacks()
+ * @dataProvider provideInvalidCallbacks
*/
public function testUncallableCallbacks($callbacks)
{
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
index 259a00751818c..f23bedea1fb58 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
@@ -33,6 +33,7 @@
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy;
use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy;
+use Symfony\Component\Serializer\Tests\Fixtures\DummyPrivatePropertyWithoutGetter;
use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy;
use Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy;
use Symfony\Component\Serializer\Tests\Fixtures\Php74DummyPrivate;
@@ -140,6 +141,15 @@ public function testNormalizeObjectWithUninitializedPrivateProperties()
);
}
+ public function testNormalizeObjectWithPrivatePropertyWithoutGetter()
+ {
+ $obj = new DummyPrivatePropertyWithoutGetter();
+ $this->assertEquals(
+ ['bar' => 'bar'],
+ $this->normalizer->normalize($obj, 'any')
+ );
+ }
+
public function testDenormalize()
{
$obj = $this->normalizer->denormalize(
diff --git a/src/Symfony/Component/Uid/BinaryUtil.php b/src/Symfony/Component/Uid/BinaryUtil.php
index 32e7e0dff3c6c..5e9741cbea200 100644
--- a/src/Symfony/Component/Uid/BinaryUtil.php
+++ b/src/Symfony/Component/Uid/BinaryUtil.php
@@ -40,6 +40,8 @@ class BinaryUtil
// 0x01b21dd213814000 is the number of 100-ns intervals between the
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
private const TIME_OFFSET_INT = 0x01b21dd213814000;
+ private const TIME_OFFSET_BIN = "\x01\xb2\x1d\xd2\x13\x81\x40\x00";
+ private const TIME_OFFSET_COM1 = "\xfe\x4d\xe2\x2d\xec\x7e\xbf\xff";
private const TIME_OFFSET_COM2 = "\xfe\x4d\xe2\x2d\xec\x7e\xc0\x00";
public static function toBase(string $bytes, array $map): string
@@ -114,20 +116,24 @@ public static function add(string $a, string $b): string
return $a;
}
+ /**
+ * @param string $time Count of 100-nanosecond intervals since the UUID epoch 1582-10-15 00:00:00 in hexadecimal
+ */
public static function timeToFloat(string $time): float
{
if (\PHP_INT_SIZE >= 8) {
- return (hexdec($time) - self::TIME_OFFSET_INT) / 10000000;
- }
-
- $time = str_pad(hex2bin($time), 8, "\0", \STR_PAD_LEFT);
- $time = self::add($time, self::TIME_OFFSET_COM2);
-
- if ($time >= self::TIME_OFFSET_COM2) {
- $time = -1 * self::toBase($time ^ "\xff\xff\xff\xff\xff\xff\xff\xff", self::BASE10);
+ $time = hexdec($time) - self::TIME_OFFSET_INT;
} else {
- $time[0] = $time[0] & "\x7F";
- $time = self::toBase($time, self::BASE10);
+ $time = str_pad(hex2bin($time), 8, "\0", \STR_PAD_LEFT);
+
+ if (self::TIME_OFFSET_BIN <= $time) {
+ $time = self::add($time, self::TIME_OFFSET_COM2);
+ $time[0] = $time[0] & "\x7F";
+ $time = self::toBase($time, self::BASE10);
+ } else {
+ $time = self::add($time, self::TIME_OFFSET_COM1);
+ $time = '-'.self::toBase($time ^ "\xff\xff\xff\xff\xff\xff\xff\xff", self::BASE10);
+ }
}
return $time / 10000000;
diff --git a/src/Symfony/Component/Uid/Tests/UuidTest.php b/src/Symfony/Component/Uid/Tests/UuidTest.php
index 5369477d3ca3e..6b5b27f3b5001 100644
--- a/src/Symfony/Component/Uid/Tests/UuidTest.php
+++ b/src/Symfony/Component/Uid/Tests/UuidTest.php
@@ -199,4 +199,13 @@ public function testFromStringOnExtendedClassReturnsStatic()
{
$this->assertInstanceOf(CustomUuid::class, CustomUuid::fromString(self::A_UUID_V4));
}
+
+ public function testGetTime()
+ {
+ $this->assertSame(103072857660.6847, ((new UuidV1('ffffffff-ffff-1fff-a456-426655440000'))->getTime()));
+ $this->assertSame(0.0000001, ((new UuidV1('13814001-1dd2-11b2-a456-426655440000'))->getTime()));
+ $this->assertSame(0.0, (new UuidV1('13814000-1dd2-11b2-a456-426655440000'))->getTime());
+ $this->assertSame(-0.0000001, (new UuidV1('13813fff-1dd2-11b2-a456-426655440000'))->getTime());
+ $this->assertSame(-12219292800.0, ((new UuidV1('00000000-0000-1000-a456-426655440000'))->getTime()));
+ }
}
diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
index 68e21606edcab..ea5e947be880b 100644
--- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
+++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php
@@ -21,13 +21,13 @@ class FilesLoaderTest extends TestCase
{
public function testCallsGetFileLoaderInstanceForeachPath()
{
- $loader = $this->getFilesLoader($this->getFileLoader());
+ $loader = $this->getFilesLoader($this->createMock(LoaderInterface::class));
$this->assertEquals(4, $loader->getTimesCalled());
}
public function testCallsActualFileLoaderForMetadata()
{
- $fileLoader = $this->getFileLoader();
+ $fileLoader = $this->createMock(LoaderInterface::class);
$fileLoader->expects($this->exactly(4))
->method('loadClassMetadata');
$loader = $this->getFilesLoader($fileLoader);
@@ -43,9 +43,4 @@ public function getFilesLoader(LoaderInterface $loader)
__DIR__.'/constraint-mapping.txt',
], $loader]);
}
-
- public function getFileLoader()
- {
- return $this->createMock(LoaderInterface::class);
- }
}
diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php
index 2de07d023142f..dcb104ccff065 100644
--- a/src/Symfony/Component/Yaml/Dumper.php
+++ b/src/Symfony/Component/Yaml/Dumper.php
@@ -68,7 +68,7 @@ public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0):
$output .= "\n";
}
- if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
+ if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
$blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
@@ -97,7 +97,7 @@ public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0):
if ($value instanceof TaggedValue) {
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
- if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
+ if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
// http://www.yaml.org/spec/1.2/spec.html#id2793979
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
diff --git a/src/Symfony/Contracts/Cache/composer.json b/src/Symfony/Contracts/Cache/composer.json
index f95df70f6496c..6f274f1774d5c 100644
--- a/src/Symfony/Contracts/Cache/composer.json
+++ b/src/Symfony/Contracts/Cache/composer.json
@@ -27,7 +27,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/Deprecation/composer.json b/src/Symfony/Contracts/Deprecation/composer.json
index 27aa491e11d99..88d3055927dea 100644
--- a/src/Symfony/Contracts/Deprecation/composer.json
+++ b/src/Symfony/Contracts/Deprecation/composer.json
@@ -24,7 +24,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/EventDispatcher/composer.json b/src/Symfony/Contracts/EventDispatcher/composer.json
index 36aeed02d3767..8eaf0354fd2d7 100644
--- a/src/Symfony/Contracts/EventDispatcher/composer.json
+++ b/src/Symfony/Contracts/EventDispatcher/composer.json
@@ -27,7 +27,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/HttpClient/composer.json b/src/Symfony/Contracts/HttpClient/composer.json
index 2dc9990e1e886..9ab9eaf76cc7a 100644
--- a/src/Symfony/Contracts/HttpClient/composer.json
+++ b/src/Symfony/Contracts/HttpClient/composer.json
@@ -26,7 +26,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/Service/composer.json b/src/Symfony/Contracts/Service/composer.json
index efbf399d1c900..524f6a6c6c1ec 100644
--- a/src/Symfony/Contracts/Service/composer.json
+++ b/src/Symfony/Contracts/Service/composer.json
@@ -27,7 +27,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/Translation/composer.json b/src/Symfony/Contracts/Translation/composer.json
index 311c38b28c2a9..907d28f0a878e 100644
--- a/src/Symfony/Contracts/Translation/composer.json
+++ b/src/Symfony/Contracts/Translation/composer.json
@@ -26,7 +26,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
diff --git a/src/Symfony/Contracts/composer.json b/src/Symfony/Contracts/composer.json
index eecf32761fb35..4675ba056954b 100644
--- a/src/Symfony/Contracts/composer.json
+++ b/src/Symfony/Contracts/composer.json
@@ -48,7 +48,6 @@
},
"minimum-stability": "dev",
"extra": {
- "branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
}