From ca566204d34dba70e16da2d2f543523c0b0a6fd2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 23 Feb 2022 18:16:36 +0100 Subject: [PATCH 01/24] Fix deprecations on PHP 8.2 --- .github/workflows/unit-tests.yml | 2 +- .../Constraints/UniqueEntityValidatorTest.php | 4 +- .../LazyProxy/PhpDumper/ProxyDumperTest.php | 1 + .../AddAnnotationsCachedReaderPass.php | 9 +- .../FrameworkExtension.php | 5 +- .../Tests/Fixtures/includes/classes.php | 1 + .../Tests/Fixtures/includes/foo.php | 1 + src/Symfony/Component/DomCrawler/Crawler.php | 4 +- .../Tests/Fixtures/MockStream/MockStream.php | 2 + .../Tests/Normalizer/Features/ObjectDummy.php | 1 + .../Tests/Constraints/ImageValidatorTest.php | 1 + .../Component/VarDumper/Dumper/HtmlDumper.php | 2 +- .../Tests/Caster/ExceptionCasterTest.php | 2 +- .../VarDumper/Tests/Caster/SplCasterTest.php | 6 +- .../VarDumper/Tests/Dumper/HtmlDumperTest.php | 2 +- .../VarDumper/Tests/Fixtures/dumb-var.php | 1 + .../VarExporter/Internal/Exporter.php | 10 +- .../VarExporter/Internal/Hydrator.php | 71 +++++++------- .../Tests/Fixtures/array-object.php | 4 +- .../Tests/Fixtures/datetime-legacy.php | 92 +++++++++++++++++++ .../VarExporter/Tests/Fixtures/datetime.php | 32 +++---- .../VarExporter/Tests/InstantiatorTest.php | 7 +- .../VarExporter/Tests/VarExporterTest.php | 21 ++++- 23 files changed, 204 insertions(+), 77 deletions(-) create mode 100644 src/Symfony/Component/VarExporter/Tests/Fixtures/datetime-legacy.php diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2bea6308930c9..c0af4b709c4b2 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -26,7 +26,7 @@ jobs: - php: '8.1' mode: low-deps - php: '8.2' - mode: experimental + #mode: experimental fail-fast: false runs-on: ubuntu-20.04 diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index bc0041c20b64c..3032e41f132ea 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -13,9 +13,9 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\DBAL\Types\Type; +use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Tools\SchemaTool; use Doctrine\Persistence\ManagerRegistry; -use Doctrine\Persistence\Mapping\ClassMetadata; use Doctrine\Persistence\ObjectManager; use Doctrine\Persistence\ObjectRepository; use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper; @@ -111,7 +111,7 @@ protected function createEntityManagerMock($repositoryMock) ->willReturn($repositoryMock) ; - $classMetadata = $this->createMock(ClassMetadata::class); + $classMetadata = $this->createMock(ClassMetadataInfo::class); $classMetadata ->expects($this->any()) ->method('hasField') diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index 971f68cb74a58..b63a54b7bfbf0 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -194,6 +194,7 @@ function ($definition) { } } +#[\AllowDynamicProperties] final class DummyClass implements DummyInterface, SunnyInterface { private $ref; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php index 4f09e52bdcbd1..a0581ff21fb6f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -28,14 +29,18 @@ public function process(ContainerBuilder $container) // "annotation_reader" at build time don't get any cache foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) { $reader = $container->getDefinition($id); + $reader->setPublic(false); $properties = $reader->getProperties(); if (isset($properties['cacheProviderBackup'])) { $provider = $properties['cacheProviderBackup']->getValues()[0]; unset($properties['cacheProviderBackup']); $reader->setProperties($properties); - $container->set($id, null); - $container->setDefinition($id, $reader->replaceArgument(1, $provider)); + $reader->replaceArgument(1, $provider); + } elseif (4 <= \count($arguments = $reader->getArguments()) && $arguments[3] instanceof ServiceClosureArgument) { + $arguments[1] = $arguments[3]->getValues()[0]; + unset($arguments[3]); + $reader->setArguments($arguments); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 0d52c684b27d0..39351b15aca9c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1463,9 +1463,10 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde $container ->getDefinition('annotations.cached_reader') + ->setPublic(true) // set to false in AddAnnotationsCachedReaderPass ->replaceArgument(2, $config['debug']) - // temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs - ->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService))) + // reference the cache provider without using it until AddAnnotationsCachedReaderPass runs + ->addArgument(new ServiceClosureArgument(new Reference($cacheService))) ->addTag('annotations.cached_reader') ; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index bc68c74fd7776..a57561aa3337c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -56,6 +56,7 @@ public static function configureStatic1() class BarUserClass { + public $foo; public $bar; public function __construct(BarClass $bar) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php index 20bc928b9728c..c8a6b347a0029 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -4,6 +4,7 @@ class FooClass { + public $qux; public $foo; public $moo; diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index aacb94ad37f2f..462b6b1129d9e 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1214,11 +1214,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U set_error_handler(function () { throw new \Exception(); }); try { - return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset); + return mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], $charset); } catch (\Exception|\ValueError $e) { try { $htmlContent = iconv($charset, 'UTF-8', $htmlContent); - $htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8'); + $htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8'); } catch (\Exception|\ValueError $e) { } diff --git a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php index 3c66d8b9ac452..b9ebd6b1c6cc9 100644 --- a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php +++ b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php @@ -17,6 +17,8 @@ */ class MockStream { + public $context; + /** * Opens file or URL. * diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php b/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php index ac610f098607f..788313c2b8562 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php @@ -2,6 +2,7 @@ namespace Symfony\Component\Serializer\Tests\Normalizer\Features; +#[\AllowDynamicProperties] class ObjectDummy { protected $foo; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php index 81ba1224bbfe5..14d117ddbb77d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php @@ -33,6 +33,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase protected $imageLandscape; protected $imagePortrait; protected $image4By3; + protected $image16By9; protected $imageCorrupted; protected function createValidator() diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 8409a0c741325..88e5ba9284030 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -978,7 +978,7 @@ protected function dumpLine($depth, $endOfValue = false) } $this->lastDepth = $depth; - $this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8'); + $this->line = mb_encode_numericentity($this->line, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8'); if (-1 === $depth) { AbstractDumper::dumpLine(0); diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php index e39adfa78710d..71c34f7646940 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php @@ -175,7 +175,7 @@ public function testHtmlDump() trace: { %s%eVarDumper%eTests%eCaster%eExceptionCasterTest.php:%d - …%d + …%d } } diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php index ff308aaa0ccd2..5bba4e55fc8d7 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php @@ -166,11 +166,13 @@ public function testCastObjectStorageDumpsInfo() public function testCastArrayObject() { - $var = new \ArrayObject([123]); + $var = new + #[\AllowDynamicProperties] + class([123]) extends \ArrayObject {}; $var->foo = 234; $expected = << 123 diff --git a/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php b/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php index e5ad368330f1c..9921dc715a4dd 100644 --- a/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php @@ -66,7 +66,7 @@ public function testGet() 6 => {$intMax} "str" => "d&%s;j&%s;\\n" 7 => b""" - é\\x00test\\t\\n + é\\x00test\\t\\n ing """ "[]" => [] diff --git a/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php b/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php index 67e53badb6445..4ea8c8ba6ec08 100644 --- a/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php +++ b/src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php @@ -3,6 +3,7 @@ namespace Symfony\Component\VarDumper\Tests\Fixture; if (!class_exists(\Symfony\Component\VarDumper\Tests\Fixture\DumbFoo::class)) { + #[\AllowDynamicProperties] class DumbFoo { public $foo = 'foo'; diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index 4c49d87da61bf..c46eb50aa988d 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -108,7 +108,15 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount } $properties = ['SplObjectStorage' => ["\0" => $properties]]; $arrayValue = (array) $value; - } elseif ($value instanceof \Serializable || $value instanceof \__PHP_Incomplete_Class) { + } elseif ($value instanceof \Serializable + || $value instanceof \__PHP_Incomplete_Class + || $value instanceof \DatePeriod + || (\PHP_VERSION_ID >= 80200 && ( + $value instanceof \DateTimeInterface + || $value instanceof \DateTimeZone + || $value instanceof \DateInterval + )) + ) { ++$objectsCount; $objectsPool[$value] = [$id = \count($objectsPool), serialize($value), [], 0]; $value = new Reference($id); diff --git a/src/Symfony/Component/VarExporter/Internal/Hydrator.php b/src/Symfony/Component/VarExporter/Internal/Hydrator.php index 364d292d916e7..5ed6bdc948e63 100644 --- a/src/Symfony/Component/VarExporter/Internal/Hydrator.php +++ b/src/Symfony/Component/VarExporter/Internal/Hydrator.php @@ -55,45 +55,14 @@ public static function hydrate($objects, $values, $properties, $value, $wakeups) public static function getHydrator($class) { - if ('stdClass' === $class) { - return self::$hydrators[$class] = static function ($properties, $objects) { - foreach ($properties as $name => $values) { - foreach ($values as $i => $v) { - $objects[$i]->$name = $v; - } - } - }; - } - - if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) { - throw new ClassNotFoundException($class); - } - $classReflector = new \ReflectionClass($class); - - if (!$classReflector->isInternal()) { - return self::$hydrators[$class] = (self::$hydrators['stdClass'] ?? self::getHydrator('stdClass'))->bindTo(null, $class); - } - - if ($classReflector->name !== $class) { - return self::$hydrators[$classReflector->name] ?? self::getHydrator($classReflector->name); - } - switch ($class) { - case 'ArrayIterator': - case 'ArrayObject': - $constructor = \Closure::fromCallable([$classReflector->getConstructor(), 'invokeArgs']); - - return self::$hydrators[$class] = static function ($properties, $objects) use ($constructor) { + case 'stdClass': + return self::$hydrators[$class] = static function ($properties, $objects) { foreach ($properties as $name => $values) { - if ("\0" !== $name) { - foreach ($values as $i => $v) { - $objects[$i]->$name = $v; - } + foreach ($values as $i => $v) { + $objects[$i]->$name = $v; } } - foreach ($properties["\0"] ?? [] as $i => $v) { - $constructor($objects[$i], $v); - } }; case 'ErrorException': @@ -122,6 +91,38 @@ public static function getHydrator($class) }; } + if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) { + throw new ClassNotFoundException($class); + } + $classReflector = new \ReflectionClass($class); + + switch ($class) { + case 'ArrayIterator': + case 'ArrayObject': + $constructor = \Closure::fromCallable([$classReflector->getConstructor(), 'invokeArgs']); + + return self::$hydrators[$class] = static function ($properties, $objects) use ($constructor) { + foreach ($properties as $name => $values) { + if ("\0" !== $name) { + foreach ($values as $i => $v) { + $objects[$i]->$name = $v; + } + } + } + foreach ($properties["\0"] ?? [] as $i => $v) { + $constructor($objects[$i], $v); + } + }; + } + + if (!$classReflector->isInternal()) { + return self::$hydrators[$class] = (self::$hydrators['stdClass'] ?? self::getHydrator('stdClass'))->bindTo(null, $class); + } + + if ($classReflector->name !== $class) { + return self::$hydrators[$classReflector->name] ?? self::getHydrator($classReflector->name); + } + $propertySetters = []; foreach ($classReflector->getProperties() as $propertyReflector) { if (!$propertyReflector->isStatic()) { diff --git a/src/Symfony/Component/VarExporter/Tests/Fixtures/array-object.php b/src/Symfony/Component/VarExporter/Tests/Fixtures/array-object.php index 4e2d4d13a3d89..22fb5c9b247d9 100644 --- a/src/Symfony/Component/VarExporter/Tests/Fixtures/array-object.php +++ b/src/Symfony/Component/VarExporter/Tests/Fixtures/array-object.php @@ -2,8 +2,8 @@ return \Symfony\Component\VarExporter\Internal\Hydrator::hydrate( $o = [ - clone (($p = &\Symfony\Component\VarExporter\Internal\Registry::$prototypes)['ArrayObject'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('ArrayObject')), - clone $p['ArrayObject'], + clone (($p = &\Symfony\Component\VarExporter\Internal\Registry::$prototypes)['Symfony\\Component\\VarExporter\\Tests\\ArrayObject'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('Symfony\\Component\\VarExporter\\Tests\\ArrayObject')), + clone ($p['ArrayObject'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('ArrayObject')), ], null, [], diff --git a/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime-legacy.php b/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime-legacy.php new file mode 100644 index 0000000000000..7b217c5fb21b0 --- /dev/null +++ b/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime-legacy.php @@ -0,0 +1,92 @@ + 'O:10:"DatePeriod":6:{s:5:"start";O:8:"DateTime":3:{s:4:"date";s:26:"2012-07-01 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+00:00";}s:7:"current";N;s:3:"end";N;s:8:"interval";O:12:"DateInterval":16:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:7;s:1:"h";i:0;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";d:0;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";b:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}s:11:"recurrences";i:5;s:18:"include_start_date";b:1;}', + ]), + null, + [ + 'stdClass' => [ + 'date' => [ + '1970-01-01 00:00:00.000000', + '1970-01-01 00:00:00.000000', + ], + 'timezone_type' => [ + 1, + 1, + 3, + ], + 'timezone' => [ + '+00:00', + '+00:00', + 'Europe/Paris', + ], + 'y' => [ + 3 => 0, + ], + 'm' => [ + 3 => 0, + ], + 'd' => [ + 3 => 7, + ], + 'h' => [ + 3 => 0, + ], + 'i' => [ + 3 => 0, + ], + 's' => [ + 3 => 0, + ], + 'f' => [ + 3 => 0.0, + ], + 'weekday' => [ + 3 => 0, + ], + 'weekday_behavior' => [ + 3 => 0, + ], + 'first_last_day_of' => [ + 3 => 0, + ], + 'invert' => [ + 3 => 0, + ], + 'days' => [ + 3 => false, + ], + 'special_type' => [ + 3 => 0, + ], + 'special_amount' => [ + 3 => 0, + ], + 'have_weekday_relative' => [ + 3 => 0, + ], + 'have_special_relative' => [ + 3 => 0, + ], + ], + ], + [ + $o[0], + $o[1], + $o[2], + $o[3], + $o[4], + ], + [ + 1 => 0, + 1, + 2, + 3, + ] +); diff --git a/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime.php b/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime.php index 1c916458c4f1a..1de8fa03f0919 100644 --- a/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime.php +++ b/src/Symfony/Component/VarExporter/Tests/Fixtures/datetime.php @@ -1,25 +1,21 @@ [ - 'date' => [ - '1970-01-01 00:00:00.000000', - ], - 'timezone_type' => [ - 1, - ], - 'timezone' => [ - '+00:00', - ], - ], + $o[0], + $o[1], + $o[2], + $o[3], + $o[4], ], - $o[0], - [ - 1 => 0, - ] + [] ); diff --git a/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php b/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php index 744e576c0a0c9..cbd223642320b 100644 --- a/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php +++ b/src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php @@ -53,16 +53,16 @@ public function testInstantiate() $expected = [ "\0".__NAMESPACE__."\Bar\0priv" => 123, "\0".__NAMESPACE__."\Foo\0priv" => 234, + 'dyn' => 345, ]; - $actual = (array) Instantiator::instantiate(Bar::class, ['priv' => 123], [Foo::class => ['priv' => 234]]); + $actual = (array) Instantiator::instantiate(Bar::class, ['dyn' => 345, 'priv' => 123], [Foo::class => ['priv' => 234]]); ksort($actual); $this->assertSame($expected, $actual); - $e = Instantiator::instantiate('Exception', ['foo' => 123, 'trace' => [234]]); + $e = Instantiator::instantiate('Exception', ['trace' => [234]]); - $this->assertSame(123, $e->foo); $this->assertSame([234], $e->getTrace()); } } @@ -72,6 +72,7 @@ class Foo private $priv; } +#[\AllowDynamicProperties] class Bar extends Foo { private $priv; diff --git a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php index fffccd4b53db1..f87e4e9b01d1e 100644 --- a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php +++ b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php @@ -95,7 +95,9 @@ public function testExport(string $testName, $value, bool $staticValueExpected = $dump = "= 70406 || !\in_array($testName, ['array-object', 'array-iterator', 'array-object-custom', 'spl-object-storage', 'final-array-iterator', 'final-error'], true)) { + if (\PHP_VERSION_ID < 80200 && 'datetime' === $testName) { + $fixtureFile = __DIR__.'/Fixtures/'.$testName.'-legacy.php'; + } elseif (\PHP_VERSION_ID >= 70406 || !\in_array($testName, ['array-object', 'array-iterator', 'array-object-custom', 'spl-object-storage', 'final-array-iterator', 'final-error'], true)) { $fixtureFile = __DIR__.'/Fixtures/'.$testName.'.php'; } elseif (\PHP_VERSION_ID < 70400) { $fixtureFile = __DIR__.'/Fixtures/'.$testName.'-legacy.php'; @@ -127,9 +129,15 @@ public function provideExport() yield ['bool', true, true]; yield ['simple-array', [123, ['abc']], true]; yield ['partially-indexed-array', [5 => true, 1 => true, 2 => true, 6 => true], true]; - yield ['datetime', \DateTime::createFromFormat('U', 0)]; - - $value = new \ArrayObject(); + yield ['datetime', [ + \DateTime::createFromFormat('U', 0), + \DateTimeImmutable::createFromFormat('U', 0), + new \DateTimeZone('Europe/Paris'), + new \DateInterval('P7D'), + new \DatePeriod('R4/2012-07-01T00:00:00Z/P7D'), + ]]; + + $value = \PHP_VERSION_ID >= 70406 ? new ArrayObject() : new \ArrayObject(); $value[0] = 1; $value->foo = new \ArrayObject(); $value[1] = $value; @@ -436,3 +444,8 @@ public function unserialize($ser) throw new \BadMethodCallException(); } } + +#[\AllowDynamicProperties] +class ArrayObject extends \ArrayObject +{ +} From 1f060a07d11dd5a088bf926117cac40f4e9c2bf1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 28 Feb 2022 08:43:13 +0100 Subject: [PATCH 02/24] Update CHANGELOG for 4.4.38 --- CHANGELOG-4.4.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index 323705a5c8a53..af2b1a47f2ce5 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,42 @@ in 4.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/v4.4.0...v4.4.1 +* 4.4.38 (2022-02-28) + + * bug #44570 [WebProfilerBundle] add nonces to profiler (garak) + * bug #44839 MailerInterface: failed exception contract when enabling messenger (Giorgio Premi) + * bug #45529 [DependencyInjection] Don't reset env placeholders during compilation (nicolas-grekas) + * bug #45527 [HttpClient] Fix overriding default options with null (nicolas-grekas) + * bug #45531 [Serializer] Fix passing null to str_contains() (Erwin Dirks) + * bug #42458 [Validator][Tests] Fix AssertingContextualValidator not throwing on remaining expectations (fancyweb) + * bug #45496 [VarDumper] Fix dumping mysqli_driver instances (nicolas-grekas) + * bug #45495 [HttpFoundation] Fix missing ReturnTypeWillChange attributes (luxemate) + * bug #45482 [Cache] Add missing log when saving namespace (developer-av) + * bug #45479 [HttpKernel] Reset services between requests performed by KernelBrowser (nicolas-grekas) + * bug #44650 [Serializer] Make document type nodes ignorable (boenner) + * bug #45469 [SecurityBundle] fix autoconfiguring Monolog's ProcessorInterface (nicolas-grekas) + * bug #45414 [FrameworkBundle] KernelTestCase resets internal state on tearDown (core23) + * bug #45460 [Intl] fix wrong offset timezone PHP 8.1 (Lenny4) + * bug #45462 [HttpKernel] Fix extracting controller name from closures (nicolas-grekas) + * bug #45424 [DependencyInjection] Fix type binding (sveneld) + * bug #44259 [Security] AccountStatusException::$user should be nullable (Cantepie) + * bug #45323 [Serializer] Fix ignored callbacks in denormalization (benjaminmal) + * bug #45399 [FrameworkBundle] Fix sorting bug in sorting of tagged services by priority (Ahummeling) + * bug #45338 [Mailer] Fix string-cast of exceptions thrown by authenticator in EsmtpTransport (wikando-ck) + * bug #45339 [Cache] fix error handling when using Redis (nicolas-grekas) + * bug #45281 [Cache] Fix connecting to Redis via a socket file (alebedev80) + * bug #45289 [FrameworkBundle] Fix log channel of TagAwareAdapter (fancyweb) + * bug #45306 [PropertyAccessor] Add missing TypeError catch (b1rdex) + * bug #44868 [DependencyInjection][FrameworkBundle] Fix using PHP 8.1 enum as parameters (ogizanagi) + * bug #45261 [HttpClient] Fix Content-Length header when possible (nicolas-grekas) + * bug #45258 [DependencyInjection] Don't dump polyfilled classes in preload script (nicolas-grekas) + * bug #38534 [Serializer] make XmlEncoder stateless thus reentrant (connorhu) + * bug #42253 [Form] Do not fix URL protocol for relative URLs (bogkonstantin) + * bug #45256 [DomCrawler] ignore bad charsets (nicolas-grekas) + * bug #45255 [PropertyAccess] Fix handling of uninitialized property of parent class (filiplikavcan) + * bug #45204 [Validator] Fix minRatio and maxRatio when getting rounded (alexander-schranz) + * bug #45240 [Console] Revert StringInput bc break from #45088 (bobthecow) + * 4.4.37 (2022-01-28) * bug #44939 [Form] UrlType should not add protocol to emails (GromNaN) From 8e1157d36341d6be4b172111537f375b108d7b04 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 28 Feb 2022 08:43:17 +0100 Subject: [PATCH 03/24] Update CONTRIBUTORS for 4.4.38 --- CONTRIBUTORS.md | 78 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d287e27ee871e..c8eb4764f6c53 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -12,13 +12,13 @@ The Symfony Connect username in parenthesis allows to get more information - Tobias Schultze (tobion) - Robin Chalas (chalas_r) - Christophe Coevoet (stof) - - Wouter De Jong (wouterj) - Jérémy DERUSSÉ (jderusse) + - Wouter De Jong (wouterj) - Grégoire Pineau (lyrixx) - Maxime Steinhausser (ogizanagi) - Kévin Dunglas (dunglas) - - Jordi Boggiano (seldaek) - Thomas Calvet (fancyweb) + - Jordi Boggiano (seldaek) - Victor Berchet (victor) - Javier Eguiluz (javier.eguiluz) - Ryan Weaver (weaverryan) @@ -76,8 +76,8 @@ The Symfony Connect username in parenthesis allows to get more information - Saša Stamenković (umpirsky) - Peter Rehm (rpet) - Henrik Bjørnskov (henrikbjorn) - - Miha Vrhovnik - Antoine M (amakdessi) + - Miha Vrhovnik - Diego Saint Esteben (dii3g0) - Mathieu Piot (mpiot) - Konstantin Kudryashov (everzet) @@ -93,18 +93,18 @@ The Symfony Connect username in parenthesis allows to get more information - Eric Clemmons (ericclemmons) - Graham Campbell (graham) - Charles Sarrazin (csarrazi) + - Alexander Schranz (alexander-schranz) - Vasilij Dusko - Douglas Greenshields (shieldo) - David Buchmann (dbu) - - Alexander Schranz (alexander-schranz) - Arnout Boks (aboks) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - Fran Moreno (franmomu) + - Jérôme Vasseur (jvasseur) - Mathieu Santostefano (welcomattic) - Dariusz Ruminski - - Jérôme Vasseur (jvasseur) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) @@ -119,11 +119,11 @@ The Symfony Connect username in parenthesis allows to get more information - Alexandre Daubois (alexandre-daubois) - Julien Falque (julienfalque) - Baptiste Clavié (talus) + - Massimiliano Arione (garak) + - Mathias Arlaud (mtarld) - Antoine Hérault (herzult) - Paráda József (paradajozsef) - Vincent Langlet (deviling) - - Massimiliano Arione (garak) - - Mathias Arlaud (mtarld) - Arnaud Le Blanc (arnaud-lb) - Przemysław Bogusz (przemyslaw-bogusz) - Maxime STEINHAUSSER @@ -182,6 +182,7 @@ The Symfony Connect username in parenthesis allows to get more information - Juti Noppornpitak (shiroyuki) - Simon Berger - Anthony MARTIN (xurudragon) + - Alexander Menshchikov (zmey_kk) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) @@ -192,7 +193,6 @@ The Symfony Connect username in parenthesis allows to get more information - Guilherme Blanco (guilhermeblanco) - Marco Pivetta (ocramius) - SpacePossum - - Alexander Menshchikov (zmey_kk) - Pablo Godel (pgodel) - Andreas Braun - Jérémie Augustin (jaugustin) @@ -236,6 +236,7 @@ The Symfony Connect username in parenthesis allows to get more information - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Dawid Nowak + - Martin Hujer (martinhujer) - Roman Martinuk (a2a4) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) @@ -264,7 +265,6 @@ The Symfony Connect username in parenthesis allows to get more information - Dorian Villet (gnutix) - Michaël Perrin (michael.perrin) - Sergey Linnik (linniksa) - - Martin Hujer (martinhujer) - Richard Miller (mr_r_miller) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) @@ -281,6 +281,7 @@ The Symfony Connect username in parenthesis allows to get more information - Benjamin Dulau (dbenjamin) - Baptiste Lafontaine (magnetik) - Mathieu Lemoine (lemoinem) + - Justin Hileman (bobthecow) - Denis Brumann (dbrumann) - Christian Schmidt - Andreas Hucks (meandmymonkey) @@ -308,6 +309,7 @@ The Symfony Connect username in parenthesis allows to get more information - Dominique Bongiraud - dFayet - Jeremy Livingston (jeremylivingston) + - Karoly Gossler (connorhu) - soyuka - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) @@ -318,7 +320,6 @@ The Symfony Connect username in parenthesis allows to get more information - jeff - John Kary (johnkary) - fd6130 (fdtvui) - - Justin Hileman (bobthecow) - Blanchon Vincent (blanchonvincent) - Maciej Malarz (malarzm) - Michele Orselli (orso) @@ -346,7 +347,6 @@ The Symfony Connect username in parenthesis allows to get more information - Mantis Development - Loïc Faugeron - quentin neyrat (qneyrat) - - Karoly Gossler (connorhu) - Marcin Szepczynski (czepol) - Rob Frawley 2nd (robfrawley) - Ahmed Raafat @@ -415,8 +415,10 @@ The Symfony Connect username in parenthesis allows to get more information - Wodor Wodorski - Guilhem N (guilhemn) - Mohammad Emran Hasan (phpfour) + - Christopher Davis (chrisguitarguy) - Dmitriy Mamontov (mamontovdmitriy) - Ben Ramsey (ramsey) + - Hugo Alliaume (kocal) - Laurent Masforné (heisenberg) - Sergey (upyx) - Giorgio Premi @@ -482,6 +484,7 @@ The Symfony Connect username in parenthesis allows to get more information - Aurelijus Valeiša (aurelijus) - Jan Decavele (jandc) - Gustavo Piltcher + - flack (flack) - Stepan Tanasiychuk (stfalcon) - Ivan Kurnosov - Tiago Ribeiro (fixe) @@ -508,7 +511,6 @@ The Symfony Connect username in parenthesis allows to get more information - Mark Challoner (markchalloner) - Loïc Frémont (loic425) - Oleksandr Barabolia (oleksandrbarabolia) - - Christopher Davis (chrisguitarguy) - ivan - Greg Anderson - Tri Pham (phamuyentri) @@ -539,6 +541,7 @@ The Symfony Connect username in parenthesis allows to get more information - Dmytro Borysovskyi (dmytr0) - Tomasz Kowalczyk (thunderer) - Artur Eshenbrener + - Dries Vints - Thomas Perez (scullwm) - Yoann RENARD (yrenard) - Felix Labrecque @@ -548,6 +551,7 @@ The Symfony Connect username in parenthesis allows to get more information - Tim Goudriaan (codedmonkey) - Tarmo Leppänen (tarlepp) - Martin Auswöger + - Hubert Lenoir (hubert_lenoir) - Robbert Klarenbeek (robbertkl) - Hamza Makraz (makraz) - Eric Masoero (eric-masoero) @@ -556,7 +560,6 @@ The Symfony Connect username in parenthesis allows to get more information - hossein zolfi (ocean) - Clément Gautier (clementgautier) - Koen Reiniers (koenre) - - Hugo Alliaume (kocal) - Sanpi - Eduardo Gulias (egulias) - giulio de donato (liuggio) @@ -620,7 +623,6 @@ The Symfony Connect username in parenthesis allows to get more information - hubert lecorche (hlecorche) - Vladyslav Loboda - fritzmg - - flack (flack) - Marc Morales Valldepérez (kuert) - Jean-Baptiste GOMOND (mjbgo) - Vadim Kharitonov (virtuozzz) @@ -716,7 +718,6 @@ The Symfony Connect username in parenthesis allows to get more information - Jerzy (jlekowski) - Raulnet - Christian Wahler - - Dries Vints - Giso Stallenberg (gisostallenberg) - Gintautas Miselis - Rob Bast @@ -724,6 +725,7 @@ The Symfony Connect username in parenthesis allows to get more information - Pierre Rineau - Andreas Leathley (iquito) - Soufian EZ-ZANTAR (soezz) + - Arun Philip - Zander Baldwin - Marek Zajac - Adam Harvey @@ -769,6 +771,7 @@ The Symfony Connect username in parenthesis allows to get more information - nikos.sotiropoulos - Eduardo Oliveira (entering) - Oleksii Zhurbytskyi + - Bilge - Ilya Antipenko (aivus) - Ricardo Oliveira (ricardolotr) - Roy Van Ginneken (rvanginneken) @@ -799,7 +802,6 @@ The Symfony Connect username in parenthesis allows to get more information - alexpods - Dennis Langen (nijusan) - Adrien Wilmet (adrienfr) - - Hubert Lenoir (hubert_lenoir) - Adam Szaraniec (mimol) - Dariusz Ruminski - Erik Trapman (eriktrapman) @@ -926,6 +928,7 @@ The Symfony Connect username in parenthesis allows to get more information - Nicolas Martin (cocorambo) - Jon Gotlin (jongotlin) - Adrian Nguyen (vuphuong87) + - benjaminmal - Khoo Yong Jun - Sebastian Blum - Laurent Clouet @@ -973,6 +976,7 @@ The Symfony Connect username in parenthesis allows to get more information - Geoffrey Brier (geoffrey-brier) - Alexandre Parent - Roger Guasch (rogerguasch) + - DT Inier (gam6itko) - Vladimir Tsykun - Andrei O - Dustin Dobervich (dustin10) @@ -1050,7 +1054,6 @@ The Symfony Connect username in parenthesis allows to get more information - maxime.perrimond - Sascha Grossenbacher - cthulhu - - Arun Philip - Rémi Leclerc - Jonas Hünig - Szijarto Tamas @@ -1061,6 +1064,7 @@ The Symfony Connect username in parenthesis allows to get more information - Kristijan Kanalas - Stephan Vock - Benjamin Zikarsky (bzikarsky) + - “Filip - Marion Hurteau - Dmitrii Lozhkin - Sobhan Sharifi (50bhan) @@ -1176,6 +1180,7 @@ The Symfony Connect username in parenthesis allows to get more information - Wickex - tuqqu - Neagu Cristian-Doru (cristian-neagu) + - Dude (b1rdex) - Dave Marshall (davedevelopment) - Jakub Kulhan (jakubkulhan) - Shaharia Azam @@ -1203,6 +1208,7 @@ The Symfony Connect username in parenthesis allows to get more information - SnakePin - vladimir.panivko - Josiah (josiah) + - Dennis Væversted (srnzitcom) - Guillaume Verstraete (versgui) - Joschi Kuphal - John Bohn (jbohn) @@ -1221,7 +1227,6 @@ The Symfony Connect username in parenthesis allows to get more information - Christian Soronellas (theunic) - kick-the-bucket - fedor.f - - Bilge - Yosmany Garcia (yosmanyga) - Jeremiasz Major - Wouter de Wild @@ -1265,6 +1270,7 @@ The Symfony Connect username in parenthesis allows to get more information - Zhuravlev Alexander (scif) - Stefano Degenkamp (steef) - James Michael DuPont + - Christian Gripp (core23) - Jake (jakesoft) - Flinsch - Quentin Dreyer @@ -1625,6 +1631,7 @@ The Symfony Connect username in parenthesis allows to get more information - Georgi Georgiev - Maximilian Berghoff (electricmaxxx) - nacho + - TristanPouliquen - Piotr Antosik (antek88) - mwos - Volker Killesreiter (ol0lll) @@ -1643,6 +1650,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ken Marfilla (marfillaster) - benatespina (benatespina) - Denis Kop + - Andrey Lebedev (alebedev) - Jean-Guilhem Rouel (jean-gui) - Yoann MOROCUTTI - jfcixmedia @@ -1690,7 +1698,6 @@ The Symfony Connect username in parenthesis allows to get more information - Jakub Sacha - Julius Kiekbusch - Olaf Klischat - - benjaminmal - orlovv - Claude Dioudonnat - Jonathan Hedstrom @@ -1734,6 +1741,7 @@ The Symfony Connect username in parenthesis allows to get more information - Péter Buri (burci) - Evgeny Efimov (edefimov) - kaiwa + - Daniel Badura - Charles Sanquer (csanquer) - Albert Ganiev (helios-ag) - Neil Katin @@ -1762,6 +1770,7 @@ The Symfony Connect username in parenthesis allows to get more information - Amine Yakoubi - Eduardo García Sanz (coma) - Sergio (deverad) + - Arend Hummeling - Makdessi Alex - fduch (fduch) - Juan Miguel Besada Vidal (soutlink) @@ -1829,13 +1838,13 @@ The Symfony Connect username in parenthesis allows to get more information - Vlad Gapanovich (gapik) - Alexander Kurilo (kamazee) - Nyro (nyro) + - Konstantin Bogomolov - Marco - Marc Torres - Mark Spink - cesar - Alberto Aldegheri - Cesar Scur (cesarscur) - - “Filip - Dmitri Petmanson - heccjj - Alexandre Melard @@ -1918,6 +1927,7 @@ The Symfony Connect username in parenthesis allows to get more information - abluchet - Ruud Arentsen - Harald Tollefsen + - Tobias Bönner - Matthieu - Arend-Jan Tetteroo - Albin Kerouaton @@ -1979,6 +1989,7 @@ The Symfony Connect username in parenthesis allows to get more information - Volodymyr Kupriienko (greeflas) - Serhiy Lunak (slunak) - Wojciech Błoszyk (wbloszyk) + - Jiri Barous - Giorgio Premi - abunch - tamcy @@ -2000,6 +2011,7 @@ The Symfony Connect username in parenthesis allows to get more information - Frédéric Bouchery (fbouchery) - Patrick Daley (padrig) - Foxprodev + - developer-av - Max Summe - WedgeSama - Dale.Nash @@ -2103,6 +2115,7 @@ The Symfony Connect username in parenthesis allows to get more information - Simon Neidhold - Valentin VALCIU - Jeremiah VALERIE + - Alexandre Beaujour - Julien Menth - George Yiannoulopoulos - Yannick Snobbert @@ -2116,6 +2129,7 @@ The Symfony Connect username in parenthesis allows to get more information - bill moll - Benjamin Bender - PaoRuby + - Bizley - Jared Farrish - karl.rixon - raplider @@ -2236,12 +2250,14 @@ The Symfony Connect username in parenthesis allows to get more information - riadh26 - Konstantinos Alexiou - Andrii Boiko + - Dilek Erkut - Harold Iedema - WaiSkats - Morimoto Ryosuke - Ikhsan Agustian - Arnau González (arnaugm) - Simon Bouland (bouland) + - Christoph König (chriskoenig) - Jibé Barth (jibbarth) - Jm Aribau (jmaribau) - Matthew Foster (mfoster) @@ -2266,6 +2282,7 @@ The Symfony Connect username in parenthesis allows to get more information - Phil Davis - Gleb Sidora - David Stone + - Giorgio Premi - Gerhard Seidel (gseidel) - Jovan Perovic (jperovic) - Pablo Maria Martelletti (pmartelletti) @@ -2295,7 +2312,6 @@ The Symfony Connect username in parenthesis allows to get more information - Mickael GOETZ - Maciej Schmidt - botbotbot - - Dennis Væversted - Timon van der Vorm - nuncanada - František Bereň @@ -2390,6 +2406,7 @@ The Symfony Connect username in parenthesis allows to get more information - Roy-Orbison - Aaron Somi - kshida + - Yasmany Cubela Medina (bitgandtter) - Michał Dąbrowski (defrag) - Aryel Tupinamba (dfkimera) - Hans Höchtl (hhoechtl) @@ -2400,6 +2417,7 @@ The Symfony Connect username in parenthesis allows to get more information - Jawira Portugal (jawira) - Johannes Müller (johmue) - Jordi Llonch (jordillonch) + - Roman Igoshin (masterro) - Nicholas Ruunu (nicholasruunu) - Jeroen van den Nieuwenhuisen (nieuwenhuisen) - Cyril Pascal (paxal) @@ -2454,6 +2472,7 @@ The Symfony Connect username in parenthesis allows to get more information - Adam - Ivo - Ismo Vuorinen + - Valentin - Sören Bernstein - devel - taiiiraaa @@ -2556,6 +2575,7 @@ The Symfony Connect username in parenthesis allows to get more information - Veres Lajos - Ernest Hymel - Andrea Civita + - Nicolás Alonso - LoginovIlya - Nick Chiu - grifx @@ -2596,10 +2616,12 @@ The Symfony Connect username in parenthesis allows to get more information - David Windell - Frank Jogeleit - Ondřej Frei + - Volodymyr Panivko - Gabriel Birke - skafandri - Derek Bonner - martijn + - Jenne van der Meer - Storkeus - Alan Chen - Anton Zagorskii @@ -2610,10 +2632,12 @@ The Symfony Connect username in parenthesis allows to get more information - Even André Fiskvik - Agata - dakur + - Matthias Schmidt - florian-michael-mast - Александр Ли - Arjan Keeman - Vlad Dumitrache + - Alex Kalineskou - Erik van Wingerden - Valouleloup - robmro27 @@ -2675,6 +2699,7 @@ The Symfony Connect username in parenthesis allows to get more information - Kevin Verschaeve (keversc) - Kevin Herrera (kherge) - Luis Ramón López López (lrlopez) + - Vladislav Nikolayev (luxemate) - Martin Mandl (m2mtech) - Mehdi Mabrouk (mehdidev) - Bart Reunes (metalarend) @@ -2693,6 +2718,7 @@ The Symfony Connect username in parenthesis allows to get more information - Pablo Monterde Perez (plebs) - Pierre-Olivier Vares (povares) - Jimmy Leger (redpanda) + - Samaël Villette (samadu61) - Marcin Szepczynski (szepczynski) - Cyrille Jouineau (tuxosaurus) - Vladimir Chernyshev (volch) @@ -2721,6 +2747,7 @@ The Symfony Connect username in parenthesis allows to get more information - Gabriel Moreira - Alexey Popkov - ChS + - michal - Alexis MARQUIS - Joseph Deray - Damian Sromek @@ -2792,6 +2819,7 @@ The Symfony Connect username in parenthesis allows to get more information - Michel Bardelmeijer - Tomas Kmieliauskas - Ikko Ashimine + - Erwin Dirks - Brad Jones - Billie Thompson - lol768 @@ -2801,6 +2829,7 @@ The Symfony Connect username in parenthesis allows to get more information - Johannes - Jörg Rühl - George Dietrich + - jannick-holm - wesleyh - sergey - Menno Holtkamp @@ -2811,6 +2840,7 @@ The Symfony Connect username in parenthesis allows to get more information - Michael Genereux - patrick-mcdougle - Dariusz Czech + - Clemens Krack - Bruno Baguette - Jack Wright - MrNicodemuz @@ -2867,6 +2897,8 @@ The Symfony Connect username in parenthesis allows to get more information - bokonet - Arrilot - ampaze + - Gabrielle Langer + - Chris McGehee - Markus Staab - Pierre-Louis LAUNAY - djama @@ -2914,6 +2946,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ilya Bulakh - David Soria Parra - Sergiy Sokolenko + - Cantepie - detinkin - Ahmed Abdulrahman - dinitrol @@ -2971,7 +3004,6 @@ The Symfony Connect username in parenthesis allows to get more information - Juan Ases García (ases) - Siragusa (asiragusa) - Daniel Basten (axhm3a) - - Dude (b1rdex) - Benedict Massolle (bemas) - Gerard Berengue Llobera (bere) - Bernd Matzner (bmatzner) @@ -2981,7 +3013,6 @@ The Symfony Connect username in parenthesis allows to get more information - Choong Wei Tjeng (choonge) - Kousuke Ebihara (co3k) - Loïc Vernet (coil) - - Christian Gripp (core23) - Christoph Schaefer (cvschaefer) - Damon Jones (damon__jones) - Alexandre Fiocre (demos77) @@ -3087,6 +3118,7 @@ The Symfony Connect username in parenthesis allows to get more information - Florent Cailhol - szymek - Ryan Linnit + - a.dmitryuk - Kovacs Nicolas - craigmarvelley - Stano Turza From 85e4a8fd67b3789fc82e67e4d367928c9503ceed Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 28 Feb 2022 08:43:20 +0100 Subject: [PATCH 04/24] Update VERSION for 4.4.38 --- 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 61c18ff703eb3..74a8e904ac9e9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.38-DEV'; + public const VERSION = '4.4.38'; public const VERSION_ID = 40438; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 38; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 05868b29c1b687d2a2da5498facc703bff82bfbb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 28 Feb 2022 08:57:26 +0100 Subject: [PATCH 05/24] Bump Symfony version to 4.4.39 --- 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 74a8e904ac9e9..5676a967ac8d8 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.38'; - public const VERSION_ID = 40438; + public const VERSION = '4.4.39-DEV'; + public const VERSION_ID = 40439; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 38; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 39; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2022'; public const END_OF_LIFE = '11/2023'; From 733825867d3aa30356270dfe995b9225a5ae490f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 28 Feb 2022 09:04:32 +0100 Subject: [PATCH 06/24] Bump Symfony version to 5.4.6 --- 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 67adbd34ee7d9..528eff079af96 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.5'; - public const VERSION_ID = 50405; + public const VERSION = '5.4.6-DEV'; + public const VERSION_ID = 50406; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 5; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 6; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From c555813c3514be308f40e1381a6fc6cb6eb98cfb Mon Sep 17 00:00:00 2001 From: Xavier Coureau Date: Mon, 28 Feb 2022 12:53:56 +0100 Subject: [PATCH 07/24] [WebProfilerBundle] Fixes HTML syntax regression introduced by #44570 --- .../WebProfilerBundle/Resources/views/Profiler/base.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig index eee81b8311c76..9426753b00e57 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig @@ -8,13 +8,13 @@ {% block head %} - + {{ include('@WebProfiler/Profiler/profiler.css.twig') }} {% endblock %} - + document.body.classList.add( localStorage.getItem('symfony/profiler/theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'theme-dark' : 'theme-light'), localStorage.getItem('symfony/profiler/width') || 'width-normal' From 721996a14439c15e81e1d8fec96e2c1ce4f1533a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 28 Feb 2022 14:17:32 +0100 Subject: [PATCH 08/24] [HttpClient] fix checking for unset property on PHP <= 7.1.4 --- src/Symfony/Component/HttpClient/HttpClientTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/HttpClientTrait.php b/src/Symfony/Component/HttpClient/HttpClientTrait.php index de1689490e623..57d48aade8db2 100644 --- a/src/Symfony/Component/HttpClient/HttpClientTrait.php +++ b/src/Symfony/Component/HttpClient/HttpClientTrait.php @@ -189,7 +189,7 @@ private static function mergeDefaultOptions(array $options, array $defaultOption $options += $defaultOptions; - foreach (self::$emptyDefaults ?? [] as $k => $v) { + foreach (isset(self::$emptyDefaults) ? self::$emptyDefaults : [] as $k => $v) { if (!isset($options[$k])) { $options[$k] = $v; } From b5b86dd0afd72de9705249d36bb4498a5b698005 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 28 Feb 2022 14:07:25 +0100 Subject: [PATCH 09/24] [FrameworkBundle] require ext-sodium in tests --- .appveyor.yml | 1 + composer.json | 1 - .../Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php | 3 +++ src/Symfony/Bundle/FrameworkBundle/composer.json | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b8ca657e6ffc0..0fef0e75e8814 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -45,6 +45,7 @@ install: - echo extension=php_fileinfo.dll >> php.ini-max - echo extension=php_pdo_sqlite.dll >> php.ini-max - echo extension=php_curl.dll >> php.ini-max + - echo extension=php_sodium.dll >> php.ini-max - copy /Y php.ini-max php.ini - cd c:\projects\symfony - IF NOT EXIST composer.phar (appveyor DownloadFile https://github.com/composer/composer/releases/download/2.0.0/composer.phar) diff --git a/composer.json b/composer.json index 2f8b36e9d0fc1..64b68d530c80d 100644 --- a/composer.json +++ b/composer.json @@ -134,7 +134,6 @@ "masterminds/html5": "^2.6", "monolog/monolog": "^1.25.1|^2", "nyholm/psr7": "^1.0", - "paragonie/sodium_compat": "^1.8", "pda/pheanstalk": "^4.0", "php-http/httplug": "^1.0|^2.0", "phpstan/phpdoc-parser": "^1.0", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php index a9b88b1763bd5..de096ccb22de0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php @@ -6,6 +6,9 @@ use Symfony\Bundle\FrameworkBundle\Secrets\SodiumVault; use Symfony\Component\Filesystem\Filesystem; +/** + * @requires extension sodium + */ class SodiumVaultTest extends TestCase { private $secretsDir; diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 2360acaa3f0cd..36e77447ca657 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -66,7 +66,6 @@ "symfony/property-info": "^4.4|^5.0|^6.0", "symfony/web-link": "^4.4|^5.0|^6.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "paragonie/sodium_compat": "^1.8", "twig/twig": "^2.10|^3.0", "symfony/phpunit-bridge": "^5.3|^6.0" }, From e97819473fa764299e263a2c86931ca5a49edadd Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 29 Jan 2022 16:14:18 -0500 Subject: [PATCH 10/24] [Console] Revert StringInput bc break from #45088 --- src/Symfony/Component/Console/Input/StringInput.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Input/StringInput.php b/src/Symfony/Component/Console/Input/StringInput.php index 76f1d5030a7a7..56bb66cbfd143 100644 --- a/src/Symfony/Component/Console/Input/StringInput.php +++ b/src/Symfony/Component/Console/Input/StringInput.php @@ -24,7 +24,8 @@ */ class StringInput extends ArgvInput { - public const REGEX_STRING = '([^\s\\\\]+?)'; + public const REGEX_STRING = '([^\s]+?)(?:\s|(? Date: Tue, 1 Mar 2022 09:27:55 +0100 Subject: [PATCH 11/24] Update CHANGELOG for 5.3.16 --- CHANGELOG-5.3.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-5.3.md b/CHANGELOG-5.3.md index 5a78040e1dfc5..c5d301c5a57d6 100644 --- a/CHANGELOG-5.3.md +++ b/CHANGELOG-5.3.md @@ -7,6 +7,10 @@ in 5.3 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.3.0...v5.3.1 +* 5.3.16 (2022-03-01) + + * bug #45590 [Console] Revert StringInput bc break from #45088 (bobthecow) + * 5.3.15 (2022-01-29) * security #cve-2022-xxxx [FrameworkBundle] Enable CSRF in FORM by default (jderusse) From 0116b3cc168ec73948e4eba837baa34094e2859f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 1 Mar 2022 09:28:00 +0100 Subject: [PATCH 12/24] Update VERSION for 5.3.16 --- src/Symfony/Component/HttpKernel/Kernel.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 90134cd4ee693..ce07a37e6d2a1 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -75,11 +75,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.3.15'; - public const VERSION_ID = 50315; + public const VERSION = '5.3.16'; + public const VERSION_ID = 50316; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 3; - public const RELEASE_VERSION = 15; + public const RELEASE_VERSION = 16; public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '01/2022'; From 4453bdb74959821f2168ecaade0ff44bd54a7a56 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 1 Mar 2022 13:09:24 +0100 Subject: [PATCH 13/24] [FrameworkBundle] Fix resetting container between tests --- src/Symfony/Bundle/FrameworkBundle/Client.php | 7 +------ .../FrameworkBundle/Test/KernelTestCase.php | 17 ++++++----------- .../FrameworkBundle/Tests/KernelBrowserTest.php | 10 ++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index a27a7141dfba2..97b19cce3a499 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -19,7 +19,6 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\Profiler\Profile as HttpProfile; -use Symfony\Contracts\Service\ResetInterface; /** * Client simulates a browser and makes requests to a Kernel object. @@ -117,12 +116,8 @@ protected function doRequest($request) // avoid shutting down the Kernel if no request has been performed yet // WebTestCase::createClient() boots the Kernel but do not handle a request if ($this->hasPerformedRequest && $this->reboot) { - $container = $this->kernel->getContainer(); + $this->kernel->boot(); $this->kernel->shutdown(); - - if ($container instanceof ResetInterface) { - $container->reset(); - } } else { $this->hasPerformedRequest = true; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index b87018bbd6b3f..a65a17b4c53e2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -14,7 +14,6 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Contracts\Service\ResetInterface; /** * KernelTestCase is the base class for tests needing a Kernel. @@ -39,8 +38,6 @@ abstract class KernelTestCase extends TestCase protected static $booted = false; - private static $kernelContainer; - private function doTearDown() { static::ensureKernelShutdown(); @@ -77,11 +74,12 @@ protected static function bootKernel(array $options = []) { static::ensureKernelShutdown(); - static::$kernel = static::createKernel($options); - static::$kernel->boot(); + $kernel = static::createKernel($options); + $kernel->boot(); + self::$kernel = $kernel; static::$booted = true; - self::$kernelContainer = $container = static::$kernel->getContainer(); + $container = static::$kernel->getContainer(); static::$container = $container->has('test.service_container') ? $container->get('test.service_container') : $container; return static::$kernel; @@ -132,14 +130,11 @@ protected static function createKernel(array $options = []) protected static function ensureKernelShutdown() { if (null !== static::$kernel) { + static::$kernel->boot(); static::$kernel->shutdown(); static::$booted = false; } - if (self::$kernelContainer instanceof ResetInterface) { - self::$kernelContainer->reset(); - } - - static::$container = self::$kernelContainer = null; + static::$container = null; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php index 96eaaea7612af..404a239b51282 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php @@ -51,6 +51,16 @@ public function testEnableRebootKernel() $client->request('GET', '/'); } + public function testRequestAfterKernelShutdownAndPerformedRequest() + { + $this->expectNotToPerformAssertions(); + + $client = static::createClient(['test_case' => 'TestServiceContainer']); + $client->request('GET', '/'); + static::ensureKernelShutdown(); + $client->request('GET', '/'); + } + private function getKernelMock() { $mock = $this->getMockBuilder($this->getKernelClass()) From c028b5081c7aba3e51ac55553c1d43d6ea3cd91a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 1 Mar 2022 15:07:45 +0100 Subject: [PATCH 14/24] Fix merge --- src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index 4315ea8dad616..00bb3043b9e9c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -103,7 +103,7 @@ protected static function getContainer(): ContainerInterface } try { - return self::$kernelContainer->get('test.service_container'); + return self::$kernel->getContainer()->get('test.service_container'); } catch (ServiceNotFoundException $e) { throw new \LogicException('Could not find service "test.service_container". Try updating the "framework.test" config to "true".', 0, $e); } From f4a208915ef1e0e7d6eee72653d04c52cf7b261f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Mar 2022 11:44:57 +0100 Subject: [PATCH 15/24] [HttpKernel] Guard against bad profile data --- .../HttpKernel/Profiler/FileProfilerStorage.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 1ef58dc74cb92..d729994c1f0cc 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -123,7 +123,11 @@ public function read($token): ?Profile $file = 'compress.zlib://'.$file; } - return $this->createProfileFromData($token, unserialize(file_get_contents($file))); + if (!$data = unserialize(file_get_contents($file))) { + return null; + } + + return $this->createProfileFromData($token, $data); } /** @@ -297,7 +301,11 @@ protected function createProfileFromData($token, $data, $parent = null) $file = 'compress.zlib://'.$file; } - $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); + if (!$childData = unserialize(file_get_contents($file))) { + continue; + } + + $profile->addChild($this->createProfileFromData($token, $childData, $profile)); } return $profile; From 83d32b1092a568b752f9fdbbe042d1f0ea3f79ff Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Mar 2022 13:56:28 +0100 Subject: [PATCH 16/24] Fix merge --- .../Cache/Tests/Adapter/TagAwareAdapterTest.php | 11 +++-------- .../Translation/PseudoLocalizationTranslator.php | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index 7ff7aee11cfe4..ab12b0c5f380c 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -54,7 +54,7 @@ public function testPrune() public function testKnownTagVersionsTtl() { $itemsPool = new FilesystemAdapter('', 10); - $tagsPool = $this->createMock(AdapterInterface::class); + $tagsPool = new ArrayAdapter(); $pool = new TagAwareAdapter($itemsPool, $tagsPool, 10); @@ -62,13 +62,8 @@ public function testKnownTagVersionsTtl() $item->tag(['baz']); $item->expiresAfter(100); - $tag = $this->createMock(CacheItemInterface::class); - $tag->expects(self::exactly(2))->method('get')->willReturn(10); - $tag->expects(self::exactly(2))->method('set')->willReturn($tag); - - $tagsPool->expects(self::exactly(2))->method('getItems')->willReturn([ - 'baz'.TagAwareAdapter::TAGS_PREFIX => $tag, - ]); + $tag = $tagsPool->getItem('baz'.TagAwareAdapter::TAGS_PREFIX); + $tagsPool->save($tag->set(10)); $pool->save($item); $this->assertTrue($pool->getItem('foo')->isHit()); diff --git a/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php b/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php index 3fdc1aa4dc950..e004986a55f71 100644 --- a/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php +++ b/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php @@ -123,7 +123,7 @@ private function getParts(string $originalTrans): array return [[true, true, $originalTrans]]; } - $html = mb_convert_encoding($originalTrans, 'HTML-ENTITIES', mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8'); + $html = mb_encode_numericentity($originalTrans, [0x80, 0xFFFF, 0, 0xFFFF], mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8'); $useInternalErrors = libxml_use_internal_errors(true); From 1f37bb82e69ef15a8fec8c8efae8a40498afbb82 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Mar 2022 14:05:48 +0100 Subject: [PATCH 17/24] Fix merge --- .../Notifier/Tests/Event/FailedMessageEventTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php b/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php index cf35a8483de9c..f3c199f538f31 100644 --- a/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php +++ b/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php @@ -15,7 +15,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; -final class FailedMessageEventTest extends TestCase +class FailedMessageEventTest extends TestCase { /** * @dataProvider messagesProvider @@ -47,6 +47,8 @@ public function testFailedMessageEventIsDisptachIfError() $clientMock = $this->createMock(HttpClientInterface::class); $transport = new class($clientMock, $eventDispatcherMock) extends AbstractTransport { + public NullTransportException $exception; + public function __construct($client, EventDispatcherInterface $dispatcher = null) { $this->exception = new NullTransportException(); @@ -65,6 +67,7 @@ public function supports(MessageInterface $message): bool public function __toString(): string { + return ''; } }; From 96c8e7aa4327be29fb22da6a80bc94208640f77b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Mar 2022 14:06:58 +0100 Subject: [PATCH 18/24] - --- .../Component/Notifier/Tests/Event/FailedMessageEventTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php b/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php index f3c199f538f31..7e4f690b1690a 100644 --- a/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php +++ b/src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php @@ -47,7 +47,7 @@ public function testFailedMessageEventIsDisptachIfError() $clientMock = $this->createMock(HttpClientInterface::class); $transport = new class($clientMock, $eventDispatcherMock) extends AbstractTransport { - public NullTransportException $exception; + public $exception; public function __construct($client, EventDispatcherInterface $dispatcher = null) { From 4ae613e4f8de9a223046a0391386576322a269d9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Mar 2022 14:18:14 +0100 Subject: [PATCH 19/24] - --- .../Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php index 0bb9591e185df..034cd001aaebb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php @@ -162,7 +162,8 @@ public function testExtractEnum() $validator = Validation::createValidatorBuilder() ->addMethodMapping('loadValidatorMetadata') - ->enableAnnotationMapping() + ->enableAnnotationMapping(true) + ->addDefaultDoctrineAnnotationReader() ->addLoader(new DoctrineLoader(DoctrineTestHelper::createTestEntityManager(), '{^Symfony\\\\Bridge\\\\Doctrine\\\\Tests\\\\Fixtures\\\\DoctrineLoader}')) ->getValidator() ; From b909acf2eecc36624cd1277c1aa863bf4cb01b52 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Fri, 4 Mar 2022 07:24:56 +0100 Subject: [PATCH 20/24] [HttpFoundation] Fix PHP 8.1 deprecation in isNotModified --- src/Symfony/Component/HttpFoundation/Response.php | 3 +-- .../HttpFoundation/Tests/ResponseTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index bd990e9c04ae7..bfdc1b24a789a 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -1079,8 +1079,7 @@ public function isNotModified(Request $request): bool $lastModified = $this->headers->get('Last-Modified'); $modifiedSince = $request->headers->get('If-Modified-Since'); - if ($ifNoneMatchEtags = $request->getETags()) { - $etag = $this->getEtag(); + if (($ifNoneMatchEtags = $request->getETags()) && (null !== $etag = $this->getEtag())) { if (0 == strncmp($etag, 'W/', 2)) { $etag = substr($etag, 2); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 473406287dd09..734961b80e88b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -284,6 +284,20 @@ public function testIsNotModifiedIfModifiedSinceAndEtagWithoutLastModified() $this->assertFalse($response->isNotModified($request)); } + public function testIfNoneMatchWithoutETag() + { + $request = new Request(); + $request->headers->set('If-None-Match', 'randomly_generated_etag'); + + $this->assertFalse((new Response())->isNotModified($request)); + + // Test wildcard + $request = new Request(); + $request->headers->set('If-None-Match', '*'); + + $this->assertFalse((new Response())->isNotModified($request)); + } + public function testIsValidateable() { $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(\DATE_RFC2822)]); From 102746537d4abdc72a85c6f0d798fc185386e296 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 4 Mar 2022 15:13:35 +0100 Subject: [PATCH 21/24] do not pass DBAL connections to PDO adapters --- .../FrameworkBundle/DependencyInjection/Configuration.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 7664455fff87d..f09893cc1cfc1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -18,6 +18,7 @@ use Psr\Log\LogLevel; use Symfony\Bundle\FullStack; use Symfony\Component\Asset\Package; +use Symfony\Component\Cache\Adapter\DoctrineAdapter; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\NodeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; @@ -1078,7 +1079,7 @@ private function addCacheSection(ArrayNodeDefinition $rootNode, callable $willBe ->scalarNode('default_redis_provider')->defaultValue('redis://localhost')->end() ->scalarNode('default_memcached_provider')->defaultValue('memcached://localhost')->end() ->scalarNode('default_doctrine_dbal_provider')->defaultValue('database_connection')->end() - ->scalarNode('default_pdo_provider')->defaultValue($willBeAvailable('doctrine/dbal', Connection::class) ? 'database_connection' : null)->end() + ->scalarNode('default_pdo_provider')->defaultValue($willBeAvailable('doctrine/dbal', Connection::class) && class_exists(DoctrineAdapter::class) ? 'database_connection' : null)->end() ->arrayNode('pools') ->useAttributeAsKey('name') ->prototype('array') From 758539a1306549469c3fa9412199510ff20f4492 Mon Sep 17 00:00:00 2001 From: "Phil E. Taylor" Date: Wed, 2 Mar 2022 20:15:30 +0000 Subject: [PATCH 22/24] [redis-messenger] remove undefined array key warnings --- .../Component/Messenger/Bridge/Redis/Transport/Connection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php index 6c8445fefcfcc..152ea850d12d1 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php @@ -346,10 +346,12 @@ public function get(): ?array $queuedMessageCount = $this->rawCommand('ZCOUNT', 0, $now); while ($queuedMessageCount--) { - if (![$queuedMessage, $expiry] = $this->rawCommand('ZPOPMIN', 1)) { + if (!$message = $this->rawCommand('ZPOPMIN', 1)) { break; } + [$queuedMessage, $expiry] = $message; + if (\strlen($expiry) === \strlen($now) ? $expiry > $now : \strlen($expiry) < \strlen($now)) { // if a future-placed message is popped because of a race condition with // another running consumer, the message is readded to the queue From e073bfc63c64c097673dacb93ee4b178de901e11 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 5 Mar 2022 22:14:47 +0100 Subject: [PATCH 23/24] Update CHANGELOG for 5.4.6 --- CHANGELOG-5.4.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG-5.4.md b/CHANGELOG-5.4.md index 7658ece3a6a90..0d0bcc40bafd3 100644 --- a/CHANGELOG-5.4.md +++ b/CHANGELOG-5.4.md @@ -7,6 +7,18 @@ in 5.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.4.0...v5.4.1 +* 5.4.6 (2022-03-05) + + * bug #45619 [redis-messenger] remove undefined array key warnings (PhilETaylor) + * bug #45637 [Cache] do not pass DBAL connections to PDO adapters (xabbuh) + * bug #45631 [HttpFoundation] Fix PHP 8.1 deprecation in `Response::isNotModified` (HypeMC) + * bug #45610 [HttpKernel] Guard against bad profile data (nicolas-grekas) + * bug #45532 Fix deprecations on PHP 8.2 (nicolas-grekas) + * bug #45595 [FrameworkBundle] Fix resetting container between tests (nicolas-grekas) + * bug #45590 [Console] Revert StringInput bc break from #45088 (bobthecow) + * bug #45585 [HttpClient] fix checking for unset property on PHP <= 7.1.4 (nicolas-grekas) + * bug #45583 [WebProfilerBundle] Fixes HTML syntax regression introduced by #44570 (xavismeh) + * 5.4.5 (2022-02-28) * bug #45351 [WebProfilerBundle] Log section minor fixes (missing "notice" filter, log priority, accessibility) (Amunak) From 11bb129b3d387d354aa0a7b2eed912c54f1b1d70 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 5 Mar 2022 22:14:51 +0100 Subject: [PATCH 24/24] Update VERSION for 5.4.6 --- 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 528eff079af96..0c87dbd502065 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.6-DEV'; + public const VERSION = '5.4.6'; public const VERSION_ID = 50406; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 6; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy