From 345a6329dd735aed0b2942d5d354eb0ac32c29e5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 2 Feb 2019 10:17:05 +0100 Subject: [PATCH 01/20] do not overwrite the constraint being evaluated --- .../Validator/Constraints/FormValidator.php | 14 +++++------ .../Constraints/FormValidatorTest.php | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 08d679a4b5..b2c52ae1f3 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -26,10 +26,10 @@ class FormValidator extends ConstraintValidator /** * {@inheritdoc} */ - public function validate($form, Constraint $constraint) + public function validate($form, Constraint $formConstraint) { - if (!$constraint instanceof Form) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Form'); + if (!$formConstraint instanceof Form) { + throw new UnexpectedTypeException($formConstraint, __NAMESPACE__.'\Form'); } if (!$form instanceof FormInterface) { @@ -62,8 +62,8 @@ class FormValidator extends ConstraintValidator // Otherwise validate a constraint only once for the first // matching group foreach ($groups as $group) { - if (\in_array($group, $constraint->groups)) { - $validator->atPath('data')->validate($form->getData(), $constraint, $group); + if (\in_array($group, $formConstraint->groups)) { + $validator->atPath('data')->validate($form->getData(), $formConstraint, $group); if (\count($this->context->getViolations()) > 0) { break; } @@ -113,7 +113,7 @@ class FormValidator extends ConstraintValidator ? (string) $form->getViewData() : \gettype($form->getViewData()); - $this->context->setConstraint($constraint); + $this->context->setConstraint($formConstraint); $this->context->buildViolation($config->getOption('invalid_message')) ->setParameters(array_replace(['{{ value }}' => $clientDataAsString], $config->getOption('invalid_message_parameters'))) ->setInvalidValue($form->getViewData()) @@ -125,7 +125,7 @@ class FormValidator extends ConstraintValidator // Mark the form with an error if it contains extra fields if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) { - $this->context->setConstraint($constraint); + $this->context->setConstraint($formConstraint); $this->context->buildViolation($config->getOption('extra_fields_message')) ->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"') ->setInvalidValue($form->getExtraData()) diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index 399f2d70ca..89e491b63f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -13,16 +13,20 @@ namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper; use Symfony\Component\Form\Extension\Validator\Constraints\Form; use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\SubmitButtonBuilder; +use Symfony\Component\Translation\IdentityTranslator; use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Context\ExecutionContext; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; +use Symfony\Component\Validator\Validation; /** * @author Bernhard Schussek @@ -649,6 +653,27 @@ class FormValidatorTest extends ConstraintValidatorTestCase return ['group1', 'group2']; } + public function testCauseForNotAllowedExtraFieldsIsTheFormConstraint() + { + $form = $this + ->getBuilder('form', null, ['constraints' => [new NotBlank(['groups' => ['foo']])]]) + ->setCompound(true) + ->setDataMapper(new PropertyPathMapper()) + ->getForm(); + $form->submit([ + 'extra_data' => 'foo', + ]); + + $context = new ExecutionContext(Validation::createValidator(), $form, new IdentityTranslator()); + $constraint = new Form(); + + $this->validator->initialize($context); + $this->validator->validate($form, $constraint); + + $this->assertCount(1, $context->getViolations()); + $this->assertSame($constraint, $context->getViolations()->get(0)->getConstraint()); + } + private function getMockExecutionContext() { $context = $this->getMockBuilder('Symfony\Component\Validator\Context\ExecutionContextInterface')->getMock(); From 590850fe29cc15dcc6981a32efd275488de4eb20 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 2 Feb 2019 11:16:32 +0100 Subject: [PATCH 02/20] fix some minor typos --- .../Component/Intl/NumberFormatter/NumberFormatter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index a257e36947..e0c6c236ad 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -484,7 +484,7 @@ class NumberFormatter * @param string $currency Parameter to receive the currency name (reference) * @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended * - * @return bool|string The parsed numeric value of false on error + * @return bool|string The parsed numeric value or false on error * * @see http://www.php.net/manual/en/numberformatter.parsecurrency.php * @@ -502,7 +502,7 @@ class NumberFormatter * @param int $type Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default. * @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended * - * @return int|float|false The parsed value of false on error + * @return int|float|false The parsed value or false on error * * @see http://www.php.net/manual/en/numberformatter.parse.php */ From 00453879a9a6685bf3f095cd01f6079f0b8b3777 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:22:32 +0100 Subject: [PATCH 03/20] updated CHANGELOG for 3.4.22 --- CHANGELOG-3.4.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 7300e7f9cf..8dabce2aaf 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,31 @@ in 3.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.4.0...v3.4.1 +* 3.4.22 (2019-02-03) + + * bug #30046 [DI] Fix dumping Doctrine-like service graphs (nicolas-grekas) + * bug #30028 [Form] fix some docblocks and type checks (xabbuh) + * bug #30037 Disable Twig in the profiler menu when Twig is not used (javiereguiluz) + * bug #30026 [VarDumper] dont implement Serializable in Stub (nicolas-grekas) + * bug #30034 [Config] ensure moving away from Serializable wont break cache:clear (nicolas-grekas) + * bug #30006 [Security] don't do nested calls to serialize() (nicolas-grekas, Renan) + * bug #30007 [FrameworkBundle] Support use of hyphen in asset package name (damaya, XuruDragon) + * bug #29764 [HttpFoundation] Check file exists before unlink (adam-mospan) + * bug #29783 [HttpFoundation] MemcachedSessionHandler::close() must close connection (grachevko) + * bug #29844 [Console] Fixed #29835: ConfirmationQuestion with default true for answer '0' (mrthehud) + * bug #29869 [Debug][ErrorHandler] Preserve our error handler when a logger sets another one (fancyweb) + * bug #29926 [Form] Changed UrlType input type to text when default_protocol is not null (MatTheCat) + * bug #29961 [Translation] Concatenated translation messages (Stadly) + * bug #29920 [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends (fancyweb) + * bug #29863 [Security] Do not mix password_*() API with libsodium one (chalasr) + * bug #29894 [DependencyInjection] the string "0" is a valid service identifier (xabbuh) + * bug #29885 Update MimeType extensions (fabpot) + * bug #29875 [TwigBridge] fix compatibility with Twig >= 2.6.1 (xabbuh) + * bug #29873 [Debug] remove return type hint for PHP 5 compatibility (xabbuh) + * bug #29837 Fix SwiftMailerHandler to support Monolog's latest reset functionality (Seldaek) + * bug #29853 Revert "bug #29597 [DI] fix reporting bindings on overriden services as unused" (mmarynich) + * bug #29833 [DebugClassLoader] expose proxyfied findFile() method (fancyweb) + * 3.4.21 (2019-01-06) * bug #29494 [HttpFoundation] Fix request uri when it starts with double slashes (alquerci) From a9b7b5a5e4b45f1666d069f75b7d50a24bfe354e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:22:40 +0100 Subject: [PATCH 04/20] update CONTRIBUTORS for 3.4.22 --- CONTRIBUTORS.md | 56 +++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 877cf0c796..b6b40057db 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,15 +10,15 @@ Symfony is the result of the work of many people who made the code better - Christian Flothmann (xabbuh) - Tobias Schultze (tobion) - Christophe Coevoet (stof) + - Robin Chalas (chalas_r) - Jordi Boggiano (seldaek) - Victor Berchet (victor) - - Robin Chalas (chalas_r) - Kévin Dunglas (dunglas) - Maxime Steinhausser (ogizanagi) - Jakub Zalas (jakubzalas) - Johannes S (johannes) - - Kris Wallsmith (kriswallsmith) - Ryan Weaver (weaverryan) + - Kris Wallsmith (kriswallsmith) - Javier Eguiluz (javier.eguiluz) - Roland Franssen (ro0) - Grégoire Pineau (lyrixx) @@ -61,14 +61,14 @@ Symfony is the result of the work of many people who made the code better - Kevin Bond (kbond) - Pierre du Plessis (pierredup) - Henrik Bjørnskov (henrikbjorn) + - Alexander M. Turek (derrabus) - Miha Vrhovnik - Diego Saint Esteben (dii3g0) - - Alexander M. Turek (derrabus) - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) + - Mathieu Piot (mpiot) - Florin Patan (florinpatan) - Gábor Egyed (1ed) - - Mathieu Piot (mpiot) - Titouan Galopin (tgalopin) - Vladimir Reznichenko (kalessil) - Michel Weimerskirch (mweimerskirch) @@ -82,11 +82,11 @@ Symfony is the result of the work of many people who made the code better - Issei Murasawa (issei_m) - Arnout Boks (aboks) - Deni + - Grégoire Paris (greg0ire) - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Douglas Greenshields (shieldo) - - Grégoire Paris (greg0ire) - Valentin Udaltsov (vudaltsov) + - Douglas Greenshields (shieldo) - Dariusz Ruminski - Lee McDermott - Brandon Turner @@ -109,12 +109,13 @@ Symfony is the result of the work of many people who made the code better - Brice BERNARD (brikou) - Baptiste Clavié (talus) - marc.weistroff + - Tomáš Votruba (tomas_votruba) - David Buchmann (dbu) - lenar - Alexander Schwenn (xelaris) - Włodzimierz Gajda (gajdaw) - Chris Wilkinson (thewilkybarkid) - - Tomáš Votruba (tomas_votruba) + - Jérôme Vasseur (jvasseur) - Peter Kokot (maastermedia) - Jacob Dreesen (jdreesen) - Florian Voutzinos (florianv) @@ -124,7 +125,6 @@ Symfony is the result of the work of many people who made the code better - Daniel Wehner (dawehner) - excelwebzone - Gordon Franke (gimler) - - Jérôme Vasseur (jvasseur) - Javier Spagnoletti (phansys) - Fabien Pennequin (fabienpennequin) - Eric GELOEN (gelo) @@ -144,6 +144,7 @@ Symfony is the result of the work of many people who made the code better - Daniel Gomes (danielcsgomes) - Gabriel Caruso - Hidenori Goto (hidenorigoto) + - Thomas Calvet (fancyweb) - Arnaud Kleinpeter (nanocom) - Jannik Zschiesche (apfelbox) - Guilherme Blanco (guilhermeblanco) @@ -175,6 +176,7 @@ Symfony is the result of the work of many people who made the code better - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba + - Tyson Andre - GDIBass - SpacePossum - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent) @@ -182,7 +184,6 @@ Symfony is the result of the work of many people who made the code better - Matthieu Napoli (mnapoli) - Florent Mata (fmata) - Warnar Boekkooi (boekkooi) - - Thomas Calvet (fancyweb) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - Daniel Espendiller @@ -198,6 +199,7 @@ Symfony is the result of the work of many people who made the code better - Mathieu Lemoine (lemoinem) - Christian Schmidt - Andreas Hucks (meandmymonkey) + - Tom Van Looy (tvlooy) - Noel Guilbert (noel) - Yanick Witschi (toflar) - Marek Štípek (maryo) @@ -205,6 +207,7 @@ Symfony is the result of the work of many people who made the code better - bronze1man - sun (sun) - Larry Garfield (crell) + - George Mponos (gmponos) - Michaël Perrin (michael.perrin) - Nikolay Labinskiy (e-moe) - Martin Schuhfuß (usefulthink) @@ -227,17 +230,16 @@ Symfony is the result of the work of many people who made the code better - Justin Hileman (bobthecow) - Blanchon Vincent (blanchonvincent) - Michele Orselli (orso) - - Tom Van Looy (tvlooy) - Sven Paulus (subsven) - Rui Marinho (ruimarinho) - Eugene Wissner - Pascal Montoya - - George Mponos (gmponos) - Julien Brochet (mewt) - Leo Feyer - Tristan Darricau (nicofuma) - Marcel Beerta (mazen) - Pavel Batanov (scaytrase) + - Samuel NELA (snela) - Loïc Faugeron - Hidde Wieringa (hiddewie) - Marco Pivetta (ocramius) @@ -282,7 +284,6 @@ Symfony is the result of the work of many people who made the code better - GordonsLondon - Jan Sorgalla (jsor) - Ray - - Tyson Andre - Chekote - Thomas Adam - Viktor Bocharskyi (bocharsky_bw) @@ -290,7 +291,6 @@ Symfony is the result of the work of many people who made the code better - Diego Agulló (aeoris) - Andreas Schempp (aschempp) - jdhoek - - Samuel NELA (snela) - Massimiliano Arione (garak) - Bob den Otter (bopp) - Frank de Jonge (frenkynet) @@ -301,6 +301,7 @@ Symfony is the result of the work of many people who made the code better - Colin O'Dell (colinodell) - Giorgio Premi - Jan Schädlich (jschaedl) + - Ben Davies (bendavies) - Beau Simensen (simensen) - Michael Hirschler (mvhirsch) - Robert Kiss (kepten) @@ -313,6 +314,7 @@ Symfony is the result of the work of many people who made the code better - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Remon van de Kamp (rpkamp) + - Mathieu Lechat - Marc Weistroff (futurecat) - Christian Schmidt - MatTheCat @@ -356,7 +358,6 @@ Symfony is the result of the work of many people who made the code better - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) - Gennady Telegin (gtelegin) - - Ben Davies (bendavies) - Erin Millard - Artur Melo (restless) - Matthew Lewinski (lewinski) @@ -379,11 +380,11 @@ Symfony is the result of the work of many people who made the code better - Felix Labrecque - Yaroslav Kiliba - Terje Bråten - - Mathieu Lechat - Robbert Klarenbeek (robbertkl) - JhonnyL - David Badura (davidbadura) - hossein zolfi (ocean) + - Alexander Schranz (alexander-schranz) - Clément Gautier (clementgautier) - Sanpi - Eduardo Gulias (egulias) @@ -483,7 +484,6 @@ Symfony is the result of the work of many people who made the code better - Marek Pietrzak - Luc Vieillescazes (iamluc) - franek (franek) - - Alexander Schranz (alexander-schranz) - Christian Wahler - Gintautas Miselis - Rob Bast @@ -606,6 +606,7 @@ Symfony is the result of the work of many people who made the code better - Sebastian Blum - aubx - Marvin Butkereit + - Renan - Ricky Su (ricky) - Gildas Quéméner (gquemener) - Charles-Henri Bruyand @@ -675,6 +676,7 @@ Symfony is the result of the work of many people who made the code better - Michael Devery (mickadoo) - Antoine Corcy - Sascha Grossenbacher + - Emanuele Panzeri (thepanz) - Szijarto Tamas - Robin Lehrmann (robinlehrmann) - Catalin Dan @@ -713,6 +715,7 @@ Symfony is the result of the work of many people who made the code better - Mark Sonnabaum - Massimiliano Braglia (massimilianobraglia) - Richard Quadling + - Raphaëll Roussel - jochenvdv - Arturas Smorgun (asarturas) - Alexander Volochnev (exelenz) @@ -731,6 +734,7 @@ Symfony is the result of the work of many people who made the code better - Pascal Helfenstein - Anthony GRASSIOT (antograssiot) - Baldur Rensch (brensch) + - Anthony MARTIN (xurudragon) - Pierre Rineau - Vladyslav Petrovych - Alex Xandra Albert Sim @@ -738,6 +742,7 @@ Symfony is the result of the work of many people who made the code better - Sergey Yastrebov - Trent Steel (trsteel88) - Yuen-Chi Lian + - Tarjei Huse (tarjei) - Besnik Br - Jose Gonzalez - Oleksii Zhurbytskyi @@ -764,6 +769,7 @@ Symfony is the result of the work of many people who made the code better - John Bohn (jbohn) - Marc Morera (mmoreram) - Saif Eddin Gmati (azjezz) + - Stadly - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) @@ -853,6 +859,7 @@ Symfony is the result of the work of many people who made the code better - Jelle Kapitein - Benoît Bourgeois - mantulo + - Stefan Kruppa - corphi - grizlik - Derek ROTH @@ -885,6 +892,7 @@ Symfony is the result of the work of many people who made the code better - Forfarle (forfarle) - Harry Walter (haswalt) - Johnson Page (jwpage) + - Michael Käfer (michael_kaefer) - Ruben Gonzalez (rubenruateltek) - Michael Roterman (wtfzdotnet) - Arno Geurts @@ -950,6 +958,7 @@ Symfony is the result of the work of many people who made the code better - Franz Wilding (killerpoke) - ProgMiner - Oleg Golovakhin (doc_tr) + - Joost van Driel - Icode4Food (icode4food) - Radosław Benkel - kevin.nadin @@ -996,6 +1005,7 @@ Symfony is the result of the work of many people who made the code better - Wojciech Sznapka - Gavin Staniforth - Ariel J. Birnbaum + - Pablo Borowicz - Mathieu Santostefano - Arjan Keeman - Máximo Cuadros (mcuadros) @@ -1031,6 +1041,7 @@ Symfony is the result of the work of many people who made the code better - Sergey Novikov (s12v) - Marcos Quesada (marcos_quesada) - Matthew Vickery (mattvick) + - MARYNICH Mikhail (mmarynich-ext) - Viktor Novikov (panzer_commander) - Paul Mitchum (paul-m) - Angel Koilov (po_taka) @@ -1085,6 +1096,7 @@ Symfony is the result of the work of many people who made the code better - Andrew Tch - Alexander Cheprasov - Rodrigo Díez Villamuera (rodrigodiez) + - James Hudson - e-ivanov - Einenlum - Jochen Bayer (jocl) @@ -1095,6 +1107,7 @@ Symfony is the result of the work of many people who made the code better - wizhippo - Mathias STRASSER (roukmoute) - Thomason, James + - Gordienko Vladislav - Viacheslav Sychov - Alexandre Quercia (alquerci) - Helmut Hummel (helhum) @@ -1157,7 +1170,6 @@ Symfony is the result of the work of many people who made the code better - Vacheslav Silyutin - Juan Traverso - Alain Flaus (halundra) - - Tarjei Huse (tarjei) - tsufeki - Philipp Strube - Clement Herreman (clemherreman) @@ -1240,6 +1252,7 @@ Symfony is the result of the work of many people who made the code better - Berat Doğan - Guillaume LECERF - Juanmi Rodriguez Cerón + - renanbr - Andy Raines - Anthony Ferrara - Geoffrey Pécro (gpekz) @@ -1290,7 +1303,6 @@ Symfony is the result of the work of many people who made the code better - WedgeSama - Felds Liscia - Chihiro Adachi (chihiro-adachi) - - Emanuele Panzeri (thepanz) - Raphaëll Roussel - Tadcka - Beth Binkovitz @@ -1404,6 +1416,7 @@ Symfony is the result of the work of many people who made the code better - Gavin Staniforth - Alessandro Tagliapietra (alex88) - Biji (biji) + - Alex Teterin (errogaht) - Gunnar Lium (gunnarlium) - Tiago Garcia (tiagojsag) - Artiom @@ -1446,6 +1459,7 @@ Symfony is the result of the work of many people who made the code better - Paul Seiffert (seiffert) - Vasily Khayrulin (sirian) - Stefan Koopmanschap (skoop) + - Stas Soroka (stasyan) - Stefan Hüsges (tronsha) - Jake Bishop (yakobeyak) - Dan Blows @@ -1546,6 +1560,7 @@ Symfony is the result of the work of many people who made the code better - Muhammed Akbulut - Aaron Somi - Michał Dąbrowski (defrag) + - Konstantin Grachev (grachevko) - Simone Fumagalli (hpatoio) - Brian Graham (incognito) - Kevin Vergauwen (innocenzo) @@ -1635,6 +1650,7 @@ Symfony is the result of the work of many people who made the code better - Darryl Hein (xmmedia) - Sadicov Vladimir (xtech) - Kevin EMO (zarcox) + - Andrzej - Alexander Zogheb - Rémi Blaise - Nicolas Séverin @@ -1869,6 +1885,7 @@ Symfony is the result of the work of many people who made the code better - Şəhriyar İmanov - Alexis BOYER - Kaipi Yann + - adam-mospan - Sam Williams - Guillaume Aveline - Adrian Philipp @@ -1906,7 +1923,6 @@ Symfony is the result of the work of many people who made the code better - Shude - Ondřej Führer - Sema - - Michael Käfer - Elan Ruusamäe - Thorsten Hallwas - Michael Squires @@ -2074,9 +2090,9 @@ Symfony is the result of the work of many people who made the code better - drublic - Andreas Streichardt - Pascal Hofmann - - Stefan Kruppa - smokeybear87 - Gustavo Adrian + - damaya - Kevin Weber - Ben Scott - Dionysis Arvanitis From 6abe200ebf52e70ca2b5edcbfaf6b56ad19c6f79 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:22:50 +0100 Subject: [PATCH 05/20] updated VERSION for 3.4.22 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 66a3fba2e1..54bcfd1719 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.22-DEV'; + const VERSION = '3.4.22'; const VERSION_ID = 30422; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; const RELEASE_VERSION = 22; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 205b0ba2ccdb23cc6295773b14be322c7e818649 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:46:56 +0100 Subject: [PATCH 06/20] bumped Symfony version to 3.4.23 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 54bcfd1719..c97924b778 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.22'; - const VERSION_ID = 30422; + const VERSION = '3.4.23-DEV'; + const VERSION_ID = 30423; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 22; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 23; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2020'; const END_OF_LIFE = '11/2021'; From 40204a42485bf9bb3343229393d3bb50aa2398c3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:47:28 +0100 Subject: [PATCH 07/20] updated CHANGELOG for 4.2.3 --- CHANGELOG-4.2.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CHANGELOG-4.2.md b/CHANGELOG-4.2.md index 1c2372bb2e..96994ff620 100644 --- a/CHANGELOG-4.2.md +++ b/CHANGELOG-4.2.md @@ -7,6 +7,40 @@ in 4.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/v4.2.0...v4.2.1 +* 4.2.3 (2019-02-03) + + * bug #30050 [Cache] fix pruning pdo cache for vendors that throw on execute (bendavies) + * bug #30046 [DI] Fix dumping Doctrine-like service graphs (nicolas-grekas) + * bug #30028 [Form] fix some docblocks and type checks (xabbuh) + * bug #30037 Disable Twig in the profiler menu when Twig is not used (javiereguiluz) + * bug #30026 [VarDumper] dont implement Serializable in Stub (nicolas-grekas) + * bug #30034 [Config] ensure moving away from Serializable wont break cache:clear (nicolas-grekas) + * bug #29532 [Messenger] fixed RabbitMQ arguments not passed as integer values (thePanz) + * bug #30013 [Routing] dont redirect routes with greedy trailing vars with no explicit slash (nicolas-grekas) + * bug #30006 [Security] don't do nested calls to serialize() (nicolas-grekas, Renan) + * bug #30007 [FrameworkBundle] Support use of hyphen in asset package name (damaya, XuruDragon) + * bug #30004 Fix format strings for deprecation notices (TysonAndre) + * bug #29984 [VarDumper] Fixed search bar (ro0NL) + * bug #29764 [HttpFoundation] Check file exists before unlink (adam-mospan) + * bug #29783 [HttpFoundation] MemcachedSessionHandler::close() must close connection (grachevko) + * bug #29794 Always pass $key to NullAdapter->createCacheItem (TysonAndre) + * bug #29844 [Console] Fixed #29835: ConfirmationQuestion with default true for answer '0' (mrthehud) + * bug #29869 [Debug][ErrorHandler] Preserve our error handler when a logger sets another one (fancyweb) + * bug #29900 [Cache] PDO-based cache pool table autocreation does not work (errogaht) + * bug #29926 [Form] Changed UrlType input type to text when default_protocol is not null (MatTheCat) + * bug #29961 [Translation] Concatenated translation messages (Stadly) + * bug #29847 [Cache] fix used variable name (xabbuh) + * bug #29920 [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends (fancyweb) + * bug #29922 Avoid dots in generated class names (derrabus) + * bug #29863 [Security] Do not mix password_*() API with libsodium one (chalasr) + * bug #29894 [DependencyInjection] the string "0" is a valid service identifier (xabbuh) + * bug #29885 Update MimeType extensions (fabpot) + * bug #29875 [TwigBridge] fix compatibility with Twig >= 2.6.1 (xabbuh) + * bug #29873 [Debug] remove return type hint for PHP 5 compatibility (xabbuh) + * bug #29837 Fix SwiftMailerHandler to support Monolog's latest reset functionality (Seldaek) + * bug #29853 Revert "bug #29597 [DI] fix reporting bindings on overriden services as unused" (mmarynich) + * bug #29833 [DebugClassLoader] expose proxyfied findFile() method (fancyweb) + * 4.2.2 (2019-01-06) * bug #29494 [HttpFoundation] Fix request uri when it starts with double slashes (alquerci) From c41a86937970b822cf3bf25814077e79f77b239f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:47:33 +0100 Subject: [PATCH 08/20] updated VERSION for 4.2.3 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 981aa0f39c..c5e351ca3a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.2.3-DEV'; + const VERSION = '4.2.3'; const VERSION_ID = 40203; const MAJOR_VERSION = 4; const MINOR_VERSION = 2; const RELEASE_VERSION = 3; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2019'; const END_OF_LIFE = '01/2020'; From d4f4d8aca78a8382bb21a85abc7e488f8f8c1c49 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 3 Feb 2019 13:51:55 +0100 Subject: [PATCH 09/20] bumped Symfony version to 4.2.4 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index c5e351ca3a..b8765902c9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.2.3'; - const VERSION_ID = 40203; + const VERSION = '4.2.4-DEV'; + const VERSION_ID = 40204; const MAJOR_VERSION = 4; const MINOR_VERSION = 2; - const RELEASE_VERSION = 3; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 4; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2019'; const END_OF_LIFE = '01/2020'; From 972b9711295b85331879b9c46d396080325840ed Mon Sep 17 00:00:00 2001 From: Samuel NELA Date: Sat, 2 Feb 2019 15:27:05 +0100 Subject: [PATCH 10/20] [Filesystem] Fixed some docblocks and typos --- .../Exception/IOExceptionInterface.php | 2 +- .../Component/Filesystem/Filesystem.php | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php b/src/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php index c11965a424..f9d4644a87 100644 --- a/src/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php +++ b/src/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php @@ -21,7 +21,7 @@ interface IOExceptionInterface extends ExceptionInterface /** * Returns the associated path for the exception. * - * @return string The path + * @return string|null The path */ public function getPath(); } diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index aa9afb349d..3c61fc1504 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -137,8 +137,8 @@ class Filesystem * Sets access and modification time of file. * * @param string|iterable $files A filename, an array of files, or a \Traversable instance to create - * @param int $time The touch time as a Unix timestamp - * @param int $atime The access time as a Unix timestamp + * @param int|null $time The touch time as a Unix timestamp, if not supplied the current system time is used + * @param int|null $atime The access time as a Unix timestamp, if not supplied the current system time is used * * @throws IOException When touch fails */ @@ -193,7 +193,7 @@ class Filesystem * @param int $umask The mode mask (octal) * @param bool $recursive Whether change the mod recursively or not * - * @throws IOException When the change fail + * @throws IOException When the change fails */ public function chmod($files, $mode, $umask = 0000, $recursive = false) { @@ -214,7 +214,7 @@ class Filesystem * @param string $user The new owner user name * @param bool $recursive Whether change the owner recursively or not * - * @throws IOException When the change fail + * @throws IOException When the change fails */ public function chown($files, $user, $recursive = false) { @@ -241,7 +241,7 @@ class Filesystem * @param string $group The group name * @param bool $recursive Whether change the group recursively or not * - * @throws IOException When the change fail + * @throws IOException When the change fails */ public function chgrp($files, $group, $recursive = false) { @@ -519,14 +519,14 @@ class Filesystem * - existing files in the target directory will be overwritten, except if they are newer (see the `override` option) * - files in the target directory that do not exist in the source directory will not be deleted (see the `delete` option) * - * @param string $originDir The origin directory - * @param string $targetDir The target directory - * @param \Traversable $iterator Iterator that filters which files and directories to copy - * @param array $options An array of boolean options - * Valid options are: - * - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false) - * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false) - * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) + * @param string $originDir The origin directory + * @param string $targetDir The target directory + * @param \Traversable|null $iterator Iterator that filters which files and directories to copy, if null a recursive iterator is created + * @param array $options An array of boolean options + * Valid options are: + * - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false) + * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) * * @throws IOException When file type is unknown */ From 146ae74fac1f928b143c206ca4c7e9b61a1e1cee Mon Sep 17 00:00:00 2001 From: Dimitri Gritsajuk Date: Tue, 5 Feb 2019 09:26:51 +0100 Subject: [PATCH 11/20] [Messenger] Fix DataCollector template --- .../views/Collector/messenger.html.twig | 116 +++++++++--------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig index ed11837380..f3e8fecece 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/messenger.html.twig @@ -30,15 +30,15 @@ {% endblock %} {% block menu %} - - {{ include('@WebProfiler/Icon/messenger.svg') }} - Messages - {% if collector.exceptionsCount > 0 %} - - {{ collector.exceptionsCount }} - - {% endif %} - + + {{ include('@WebProfiler/Icon/messenger.svg') }} + Messages + {% if collector.exceptionsCount > 0 %} + + {{ collector.exceptionsCount }} + + {% endif %} + {% endblock %} {% block head %} @@ -71,31 +71,31 @@

No messages have been collected.

{% else %} +
+
+ {% set messages = collector.messages %} + {% set exceptionsCount = collector.exceptionsCount %} +

All{{ messages|length }}

-
-
- {% set messages = collector.messages %} - {% set exceptionsCount = collector.exceptionsCount %} -

All{{ messages|length }}

- -
-

Ordered list of dispatched messages across all your buses

- {{ helper.render_bus_messages(messages, true) }} +
+

Ordered list of dispatched messages across all your buses

+ {{ helper.render_bus_messages(messages, true) }} +
-
- {% for bus in collector.buses %} -
- {% set messages = collector.messages(bus) %} - {% set exceptionsCount = collector.exceptionsCount(bus) %} -

{{ bus }}{{ messages|length }}

+ {% for bus in collector.buses %} +
+ {% set messages = collector.messages(bus) %} + {% set exceptionsCount = collector.exceptionsCount(bus) %} +

{{ bus }}{{ messages|length }}

-
-

Ordered list of messages dispatched on the {{ bus }} bus

- {{ helper.render_bus_messages(messages) }} -
+
+

Ordered list of messages dispatched on the {{ bus }} bus

+ {{ helper.render_bus_messages(messages) }} +
+
+ {% endfor %}
- {% endfor %} {% endif %} {% endblock %} @@ -105,24 +105,24 @@ {% for dispatchCall in messages %} - - - + + + @@ -133,7 +133,7 @@ {% set link = caller.file|file_link(caller.line) %} {% if link %} {{ caller.name }} - {% else %} + {% else %} {{ caller.name }} {% endif %} {% else %} @@ -150,10 +150,10 @@ {% if showBus %} - - - - + + + + {% endif %} @@ -170,12 +170,12 @@ {% if dispatchCall.exception is defined %} - - - - + + + + {% endif %}
- {{ profiler_dump(dispatchCall.message.type) }} - {% if showBus %} - {{ dispatchCall.bus }} - {% endif %} - {% if dispatchCall.exception is defined %} - exception - {% endif %} - - {{ include('@Twig/images/icon-minus-square.svg') }} - {{ include('@Twig/images/icon-plus-square.svg') }} - -
+ {{ profiler_dump(dispatchCall.message.type) }} + {% if showBus %} + {{ dispatchCall.bus }} + {% endif %} + {% if dispatchCall.exception is defined %} + exception + {% endif %} + + {{ include('@Twig/images/icon-minus-square.svg') }} + {{ include('@Twig/images/icon-plus-square.svg') }} + +
Bus{{ dispatchCall.bus }}
Bus{{ dispatchCall.bus }}
Message
Exception - {{ profiler_dump(dispatchCall.exception.value, maxDepth=1) }} -
Exception + {{ profiler_dump(dispatchCall.exception.value, maxDepth=1) }} +
From b45cbf6e9eec34f80f63ccb84998697e2e1453a6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 Feb 2019 09:03:17 +0100 Subject: [PATCH 12/20] [PhpUnitBridge] fix PHP 5.3 compat --- .../PhpUnit/DeprecationErrorHandler.php | 24 +++++++++---------- .../DeprecationErrorHandler/default.phpt | 2 +- .../acme/lib/deprecation_riddled.php | 2 +- .../shutdown_deprecations.phpt | 2 +- .../weak_vendors_on_non_vendor.phpt | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 3b444d5d95..b81eff528a 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -54,9 +54,9 @@ class DeprecationErrorHandler if (false === $mode) { $mode = getenv('SYMFONY_DEPRECATIONS_HELPER'); } - if (self::MODE_DISABLED !== $mode - && self::MODE_WEAK !== $mode - && self::MODE_WEAK_VENDORS !== $mode + if (DeprecationErrorHandler::MODE_DISABLED !== $mode + && DeprecationErrorHandler::MODE_WEAK !== $mode + && DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode && (!isset($mode[0]) || '/' !== $mode[0]) ) { $mode = preg_match('/^[1-9][0-9]*$/', $mode) ? (int) $mode : 0; @@ -106,7 +106,7 @@ class DeprecationErrorHandler ); $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) { $mode = $getMode(); - if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || self::MODE_DISABLED === $mode) { + if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) { $ErrorHandler = $UtilPrefix.'ErrorHandler'; return $ErrorHandler::handleError($type, $msg, $file, $line, $context); @@ -114,7 +114,7 @@ class DeprecationErrorHandler $trace = debug_backtrace(); $group = 'other'; - $isVendor = self::MODE_WEAK_VENDORS === $mode && $inVendors($file); + $isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file); $i = \count($trace); while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) { @@ -131,7 +131,7 @@ class DeprecationErrorHandler // \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest() // then we need to use the serialized information to determine // if the error has been triggered from vendor code. - $isVendor = self::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']); + $isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']); } else { $class = isset($trace[$i]['object']) ? \get_class($trace[$i]['object']) : $trace[$i]['class']; $method = $trace[$i]['function']; @@ -168,13 +168,13 @@ class DeprecationErrorHandler exit(1); } - if ('legacy' !== $group && self::MODE_WEAK !== $mode) { + if ('legacy' !== $group && DeprecationErrorHandler::MODE_WEAK !== $mode) { $ref = &$deprecations[$group][$msg]['count']; ++$ref; $ref = &$deprecations[$group][$msg][$class.'::'.$method]; ++$ref; } - } elseif (self::MODE_WEAK !== $mode) { + } elseif (DeprecationErrorHandler::MODE_WEAK !== $mode) { $ref = &$deprecations[$group][$msg]['count']; ++$ref; } @@ -207,7 +207,7 @@ class DeprecationErrorHandler $currErrorHandler = set_error_handler('var_dump'); restore_error_handler(); - if (self::MODE_WEAK === $mode) { + if (DeprecationErrorHandler::MODE_WEAK === $mode) { $colorize = function ($str) { return $str; }; } if ($currErrorHandler !== $deprecationHandler) { @@ -219,7 +219,7 @@ class DeprecationErrorHandler }; $groups = array('unsilenced', 'remaining'); - if (self::MODE_WEAK_VENDORS === $mode) { + if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) { $groups[] = 'remaining vendor'; } array_push($groups, 'legacy', 'other'); @@ -255,7 +255,7 @@ class DeprecationErrorHandler $displayDeprecations($deprecations); // store failing status - $isFailing = self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']; + $isFailing = DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']; // reset deprecations array foreach ($deprecations as $group => $arrayOrInt) { @@ -270,7 +270,7 @@ class DeprecationErrorHandler } } $displayDeprecations($deprecations); - if ($isFailing || self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) { + if ($isFailing || DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) { exit(1); } }); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index e06e9bd869..7a0595a7dd 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -25,7 +25,7 @@ class Test { public static function getGroups() { - return []; + return array(); } } EOPHP diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php index 5229a7a7cc..16a58246d2 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php @@ -7,7 +7,7 @@ class Test { public static function getGroups() { - return []; + return array(); } } EOPHP diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt index 1bb1551663..fddeed6085 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt @@ -25,7 +25,7 @@ class Test { public static function getGroups() { - return []; + return array(); } } EOPHP diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt index b37b623cf2..e20c7adf6b 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt @@ -25,7 +25,7 @@ class Test { public static function getGroups() { - return []; + return array(); } } EOPHP From 506231f353c6851d9c8ae918593bc3ab2fbf389a Mon Sep 17 00:00:00 2001 From: enomotodev Date: Mon, 4 Feb 2019 11:03:54 +0900 Subject: [PATCH 13/20] [VarDumper] Fixed phpDoc --- src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 72c8258a62..30cd1a1b19 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -39,7 +39,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface /** * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput - * @param string $charset The default character encoding to use for non-UTF8 strings + * @param string|null $charset The default character encoding to use for non-UTF8 strings * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation */ public function __construct($output = null, $charset = null, $flags = 0) From 8bf12f89a39caba44304ea78e342ee87d047eb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20de=20Guillebon?= Date: Mon, 4 Feb 2019 11:57:42 +0100 Subject: [PATCH 14/20] Fix wrong value in file id attribute for Xliff 2.0 --- .../Translation/Dumper/XliffFileDumper.php | 6 +++++- .../Tests/Dumper/XliffFileDumperTest.php | 15 +++++++++++++++ .../Tests/fixtures/resources-2.0+intl-icu.xlf | 11 +++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Translation/Tests/fixtures/resources-2.0+intl-icu.xlf diff --git a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php index 8ee8d5a009..2718da010d 100644 --- a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php @@ -141,7 +141,11 @@ class XliffFileDumper extends FileDumper $xliff->setAttribute('trgLang', str_replace('_', '-', $messages->getLocale())); $xliffFile = $xliff->appendChild($dom->createElement('file')); - $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); + if (MessageCatalogue::INTL_DOMAIN_SUFFIX === substr($domain, -($suffixLength = \strlen(MessageCatalogue::INTL_DOMAIN_SUFFIX)))) { + $xliffFile->setAttribute('id', substr($domain, 0, -$suffixLength).'.'.$messages->getLocale()); + } else { + $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); + } foreach ($messages->all($domain) as $source => $target) { $translation = $dom->createElement('unit'); diff --git a/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php index c634a27936..6377132f70 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php @@ -54,6 +54,21 @@ class XliffFileDumperTest extends TestCase ); } + public function testFormatIcuCatalogueXliff2() + { + $catalogue = new MessageCatalogue('en_US'); + $catalogue->add([ + 'foo' => 'bar', + ], 'messages'.MessageCatalogue::INTL_DOMAIN_SUFFIX); + + $dumper = new XliffFileDumper(); + + $this->assertStringEqualsFile( + __DIR__.'/../fixtures/resources-2.0+intl-icu.xlf', + $dumper->formatCatalogue($catalogue, 'messages'.MessageCatalogue::INTL_DOMAIN_SUFFIX, ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) + ); + } + public function testFormatCatalogueWithCustomToolInfo() { $options = [ diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0+intl-icu.xlf b/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0+intl-icu.xlf new file mode 100644 index 0000000000..6294f162fd --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources-2.0+intl-icu.xlf @@ -0,0 +1,11 @@ + + + + + + foo + bar + + + + From 872efe572977b9565ad29e404150ea52223ab0fa Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 1 Feb 2019 19:00:30 +0100 Subject: [PATCH 15/20] [Routing] fix perf issue when dumping large number of routes --- .../Routing/Matcher/Dumper/PhpMatcherDumper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index 61b2ed320a..754e903d89 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -159,6 +159,7 @@ EOF; foreach ($collection->all() as $name => $route) { $compiledRoute = $route->compile(); + $staticPrefix = rtrim($compiledRoute->getStaticPrefix(), '/'); $hostRegex = $compiledRoute->getHostRegex(); $regex = $compiledRoute->getRegex(); if ($hasTrailingSlash = '/' !== $route->getPath()) { @@ -173,9 +174,9 @@ EOF; if ($hasTrailingSlash) { $url = substr($url, 0, -1); } - foreach ($dynamicRegex as list($hostRx, $rx)) { - if (preg_match($rx, $url) && (!$host || !$hostRx || preg_match($hostRx, $host))) { - $dynamicRegex[] = [$hostRegex, $regex]; + foreach ($dynamicRegex as list($hostRx, $rx, $prefix)) { + if (('' === $prefix || 0 === strpos($url, $prefix)) && preg_match($rx, $url) && (!$host || !$hostRx || preg_match($hostRx, $host))) { + $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); continue 2; } @@ -183,7 +184,7 @@ EOF; $staticRoutes[$url][$name] = [$route, $hasTrailingSlash]; } else { - $dynamicRegex[] = [$hostRegex, $regex]; + $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); } } From deb8e950916654be53b347a3e1b3e18909ea7a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Stamenkovi=C4=87?= Date: Mon, 14 Jan 2019 17:30:34 +0100 Subject: [PATCH 16/20] [Form] CsrfValidationListener marks the token as invalid if it is not a string --- .../Csrf/EventListener/CsrfValidationListener.php | 2 +- .../Csrf/EventListener/CsrfValidationListenerTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php index 452bca443f..8f90d21c29 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php @@ -59,7 +59,7 @@ class CsrfValidationListener implements EventSubscriberInterface if ($form->isRoot() && $form->getConfig()->getOption('compound') && !$postRequestSizeExceeded) { $data = $event->getData(); - if (!isset($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) { + if (!isset($data[$this->fieldName]) || !\is_string($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) { $errorMessage = $this->errorMessage; if (null !== $this->translator) { diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php index 43e9acad05..1b409a3903 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php @@ -64,6 +64,16 @@ class CsrfValidationListenerTest extends TestCase $this->assertSame($data, $event->getData()); } + public function testArrayCsrfToken() + { + $event = new FormEvent($this->form, ['csrf' => []]); + + $validation = new CsrfValidationListener('csrf', $this->tokenManager, 'unknown', 'Invalid.'); + $validation->preSubmit($event); + + $this->assertNotEmpty($this->form->getErrors()); + } + public function testMaxPostSizeExceeded() { $serverParams = $this From 40bd76c9d4fb151cf45a4fd24247e1ddc99402d4 Mon Sep 17 00:00:00 2001 From: Anthony MARTIN Date: Thu, 7 Feb 2019 11:16:18 +0100 Subject: [PATCH 17/20] [FrameworkBundle] Update the xsd to match the actual session configuration | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Update the FrameworkBundle xsd to match the actual session configuration --- .../FrameworkBundle/Resources/config/schema/symfony-1.0.xsd | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index adbf4e5c57..531f7dddb9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -120,6 +120,7 @@ + From 7782e60b00c20b7b017812be09f2268d63335366 Mon Sep 17 00:00:00 2001 From: Anthony MARTIN Date: Thu, 7 Feb 2019 12:48:39 +0100 Subject: [PATCH 18/20] [FrameworkBundle] update xsd to match the 4.2 configuration | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/A Update the FrameworkBundle xsd to match the 4.2 configuration --- .../Resources/config/schema/symfony-1.0.xsd | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index f004de6c2a..77fc569a1e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -35,7 +35,6 @@ - @@ -76,10 +75,6 @@ - - - - @@ -90,18 +85,13 @@ - - - - - - + @@ -114,12 +104,12 @@ + - @@ -239,7 +229,6 @@ - @@ -259,6 +248,7 @@ + @@ -316,6 +306,7 @@ + @@ -353,6 +344,14 @@ + + + + + + + + From 436c3b94020dfdd1675539407702ae18c936536a Mon Sep 17 00:00:00 2001 From: Anthony MARTIN Date: Thu, 7 Feb 2019 19:28:32 +0100 Subject: [PATCH 19/20] [FrameworkBundle] fix xsd --- .../FrameworkBundle/Resources/config/schema/symfony-1.0.xsd | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 77fc569a1e..108b5f3ca0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -306,7 +306,6 @@ - From 02adcc33a29c432dbc65bfb3464214512acc54da Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 7 Feb 2019 19:39:48 +0100 Subject: [PATCH 20/20] fix merge --- .../Extension/Csrf/EventListener/CsrfValidationListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php index ddab59cfb3..7c5181e17d 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php @@ -66,8 +66,10 @@ class CsrfValidationListener implements EventSubscriberInterface if ($form->isRoot() && $form->getConfig()->getOption('compound') && !$postRequestSizeExceeded) { $data = $event->getData(); - $csrfToken = new CsrfToken($this->tokenId, $data[$this->fieldName] ?? null); - if (!isset($data[$this->fieldName]) || !\is_string($data[$this->fieldName]) || !$this->tokenManager->isTokenValid($csrfToken)) { + $csrfValue = \is_string($data[$this->fieldName] ?? null) ? $data[$this->fieldName] : null; + $csrfToken = new CsrfToken($this->tokenId, $csrfValue); + + if (null === $csrfValue || !$this->tokenManager->isTokenValid($csrfToken)) { $errorMessage = $this->errorMessage; if (null !== $this->translator) {