Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5fbd0dc

Browse filesBrowse files
Merge branch '6.0' into 6.1
* 6.0: - - Fix merge Fix merge [HttpKernel] Guard against bad profile data Fix merge [FrameworkBundle] Fix resetting container between tests Fix deprecations on PHP 8.2
2 parents 88497f2 + a7e1a27 commit 5fbd0dc
Copy full SHA for 5fbd0dc

File tree

Expand file treeCollapse file tree

31 files changed

+241
-109
lines changed
Filter options
Expand file treeCollapse file tree

31 files changed

+241
-109
lines changed

‎.github/workflows/unit-tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/unit-tests.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- php: '8.1'
3030
mode: low-deps
3131
- php: '8.2'
32-
mode: experimental
32+
#mode: experimental
3333
fail-fast: false
3434

3535
runs-on: ubuntu-20.04

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
use Doctrine\Common\Collections\ArrayCollection;
1515
use Doctrine\DBAL\Types\Type;
16+
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1617
use Doctrine\ORM\Tools\SchemaTool;
1718
use Doctrine\Persistence\ManagerRegistry;
18-
use Doctrine\Persistence\Mapping\ClassMetadata;
1919
use Doctrine\Persistence\ObjectManager;
2020
use Doctrine\Persistence\ObjectRepository;
2121
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
@@ -111,7 +111,7 @@ protected function createEntityManagerMock($repositoryMock)
111111
->willReturn($repositoryMock)
112112
;
113113

114-
$classMetadata = $this->createMock(ClassMetadata::class);
114+
$classMetadata = $this->createMock(ClassMetadataInfo::class);
115115
$classMetadata
116116
->expects($this->any())
117117
->method('hasField')

‎src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public function testExtractEnum()
159159

160160
$validator = Validation::createValidatorBuilder()
161161
->addMethodMapping('loadValidatorMetadata')
162-
->enableAnnotationMapping()
162+
->enableAnnotationMapping(true)
163+
->addDefaultDoctrineAnnotationReader()
163164
->addLoader(new DoctrineLoader(DoctrineTestHelper::createTestEntityManager(), '{^Symfony\\\\Bridge\\\\Doctrine\\\\Tests\\\\Fixtures\\\\DoctrineLoader}'))
164165
->getValidator()
165166
;

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ function ($definition) {
185185
}
186186
}
187187

188+
#[\AllowDynamicProperties]
188189
final class DummyClass implements DummyInterface, SunnyInterface
189190
{
190191
private $ref;

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617

@@ -28,14 +29,18 @@ public function process(ContainerBuilder $container)
2829
// "annotation_reader" at build time don't get any cache
2930
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
3031
$reader = $container->getDefinition($id);
32+
$reader->setPublic(false);
3133
$properties = $reader->getProperties();
3234

3335
if (isset($properties['cacheProviderBackup'])) {
3436
$provider = $properties['cacheProviderBackup']->getValues()[0];
3537
unset($properties['cacheProviderBackup']);
3638
$reader->setProperties($properties);
37-
$container->set($id, null);
38-
$container->setDefinition($id, $reader->replaceArgument(1, $provider));
39+
$reader->replaceArgument(1, $provider);
40+
} elseif (4 <= \count($arguments = $reader->getArguments()) && $arguments[3] instanceof ServiceClosureArgument) {
41+
$arguments[1] = $arguments[3]->getValues()[0];
42+
unset($arguments[3]);
43+
$reader->setArguments($arguments);
3944
}
4045
}
4146
}

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,9 +1610,10 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16101610

16111611
$container
16121612
->getDefinition('annotations.cached_reader')
1613+
->setPublic(true) // set to false in AddAnnotationsCachedReaderPass
16131614
->replaceArgument(2, $config['debug'])
1614-
// temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1615-
->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService)))
1615+
// reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1616+
->addArgument(new ServiceClosureArgument(new Reference($cacheService)))
16161617
->addTag('annotations.cached_reader')
16171618
;
16181619

‎src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\HttpKernel\KernelInterface;
2323
use Symfony\Component\HttpKernel\Profiler\Profile as HttpProfile;
2424
use Symfony\Component\Security\Core\User\UserInterface;
25-
use Symfony\Contracts\Service\ResetInterface;
2625

2726
/**
2827
* Simulates a browser and makes requests to a Kernel object.
@@ -157,12 +156,8 @@ protected function doRequest(object $request): Response
157156
// avoid shutting down the Kernel if no request has been performed yet
158157
// WebTestCase::createClient() boots the Kernel but do not handle a request
159158
if ($this->hasPerformedRequest && $this->reboot) {
160-
$container = $this->kernel->getContainer();
159+
$this->kernel->boot();
161160
$this->kernel->shutdown();
162-
163-
if ($container instanceof ResetInterface) {
164-
$container->reset();
165-
}
166161
} else {
167162
$this->hasPerformedRequest = true;
168163
}

‎src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
+5-14Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\DependencyInjection\ContainerInterface;
1616
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1717
use Symfony\Component\HttpKernel\KernelInterface;
18-
use Symfony\Contracts\Service\ResetInterface;
1918

2019
/**
2120
* KernelTestCase is the base class for tests needing a Kernel.
@@ -35,8 +34,6 @@ abstract class KernelTestCase extends TestCase
3534

3635
protected static $booted = false;
3736

38-
private static ?ContainerInterface $kernelContainer = null;
39-
4037
protected function tearDown(): void
4138
{
4239
static::ensureKernelShutdown();
@@ -69,12 +66,11 @@ protected static function bootKernel(array $options = []): KernelInterface
6966
{
7067
static::ensureKernelShutdown();
7168

72-
static::$kernel = static::createKernel($options);
73-
static::$kernel->boot();
69+
$kernel = static::createKernel($options);
70+
$kernel->boot();
71+
self::$kernel = $kernel;
7472
static::$booted = true;
7573

76-
self::$kernelContainer = static::$kernel->getContainer();
77-
7874
return static::$kernel;
7975
}
8076

@@ -95,7 +91,7 @@ protected static function getContainer(): ContainerInterface
9591
}
9692

9793
try {
98-
return self::$kernelContainer->get('test.service_container');
94+
return self::$kernel->getContainer()->get('test.service_container');
9995
} catch (ServiceNotFoundException $e) {
10096
throw new \LogicException('Could not find service "test.service_container". Try updating the "framework.test" config to "true".', 0, $e);
10197
}
@@ -144,14 +140,9 @@ protected static function createKernel(array $options = []): KernelInterface
144140
protected static function ensureKernelShutdown()
145141
{
146142
if (null !== static::$kernel) {
143+
static::$kernel->boot();
147144
static::$kernel->shutdown();
148145
static::$booted = false;
149146
}
150-
151-
if (self::$kernelContainer instanceof ResetInterface) {
152-
self::$kernelContainer->reset();
153-
}
154-
155-
self::$kernelContainer = null;
156147
}
157148
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/KernelBrowserTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ public function testEnableRebootKernel()
5151
$client->request('GET', '/');
5252
}
5353

54+
public function testRequestAfterKernelShutdownAndPerformedRequest()
55+
{
56+
$this->expectNotToPerformAssertions();
57+
58+
$client = static::createClient(['test_case' => 'TestServiceContainer']);
59+
$client->request('GET', '/');
60+
static::ensureKernelShutdown();
61+
$client->request('GET', '/');
62+
}
63+
5464
private function getKernelMock()
5565
{
5666
$mock = $this->getMockBuilder($this->getKernelClass())

‎src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,16 @@ public function testPrune()
5454
public function testKnownTagVersionsTtl()
5555
{
5656
$itemsPool = new FilesystemAdapter('', 10);
57-
$tagsPool = $this->createMock(AdapterInterface::class);
57+
$tagsPool = new ArrayAdapter();
5858

5959
$pool = new TagAwareAdapter($itemsPool, $tagsPool, 10);
6060

6161
$item = $pool->getItem('foo');
6262
$item->tag(['baz']);
6363
$item->expiresAfter(100);
6464

65-
$tag = $this->createMock(CacheItemInterface::class);
66-
$tag->expects(self::exactly(2))->method('get')->willReturn(10);
67-
$tag->expects(self::exactly(2))->method('set')->willReturn($tag);
68-
69-
$tagsPool->expects(self::exactly(2))->method('getItems')->willReturn(new \ArrayIterator([
70-
'baz'.TagAwareAdapter::TAGS_PREFIX => $tag,
71-
]));
65+
$tag = $tagsPool->getItem('baz'.TagAwareAdapter::TAGS_PREFIX);
66+
$tagsPool->save($tag->set(10));
7267

7368
$pool->save($item);
7469
$this->assertTrue($pool->getItem('foo')->isHit());

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static function configureStatic1()
5656

5757
class BarUserClass
5858
{
59+
public $foo;
5960
public $bar;
6061

6162
public function __construct(BarClass $bar)

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
class FooClass
66
{
7+
public $qux;
78
public $foo;
89
public $moo;
910

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
10751075
set_error_handler(function () { throw new \Exception(); });
10761076

10771077
try {
1078-
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
1078+
return mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], $charset);
10791079
} catch (\Exception|\ValueError $e) {
10801080
try {
10811081
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
1082-
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
1082+
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8');
10831083
} catch (\Exception|\ValueError $e) {
10841084
}
10851085

‎src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class MockStream
1919
{
20+
public $context;
21+
2022
/**
2123
* Opens file or URL.
2224
*

‎src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ public function read(string $token): ?Profile
121121
$file = 'compress.zlib://'.$file;
122122
}
123123

124-
return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
124+
if (!$data = unserialize(file_get_contents($file))) {
125+
return null;
126+
}
127+
128+
return $this->createProfileFromData($token, $data);
125129
}
126130

127131
/**
@@ -287,7 +291,11 @@ protected function createProfileFromData(string $token, array $data, Profile $pa
287291
$file = 'compress.zlib://'.$file;
288292
}
289293

290-
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
294+
if (!$childData = unserialize(file_get_contents($file))) {
295+
continue;
296+
}
297+
298+
$profile->addChild($this->createProfileFromData($token, $childData, $profile));
291299
}
292300

293301
return $profile;

‎src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Tests/Event/FailedMessageEventTest.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
1616
use Symfony\Contracts\HttpClient\HttpClientInterface;
1717

18-
final class FailedMessageEventTest extends TestCase
18+
class FailedMessageEventTest extends TestCase
1919
{
2020
/**
2121
* @dataProvider messagesProvider
@@ -47,6 +47,8 @@ public function testFailedMessageEventIsDisptachIfError()
4747
$clientMock = $this->createMock(HttpClientInterface::class);
4848

4949
$transport = new class($clientMock, $eventDispatcherMock) extends AbstractTransport {
50+
public $exception;
51+
5052
public function __construct($client, EventDispatcherInterface $dispatcher = null)
5153
{
5254
$this->exception = new NullTransportException();
@@ -65,6 +67,7 @@ public function supports(MessageInterface $message): bool
6567

6668
public function __toString(): string
6769
{
70+
return '';
6871
}
6972
};
7073

‎src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Symfony\Component\Serializer\Tests\Normalizer\Features;
44

5+
#[\AllowDynamicProperties]
56
class ObjectDummy
67
{
78
protected $foo;

‎src/Symfony/Component/Translation/PseudoLocalizationTranslator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/PseudoLocalizationTranslator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private function getParts(string $originalTrans): array
123123
return [[true, true, $originalTrans]];
124124
}
125125

126-
$html = mb_convert_encoding($originalTrans, 'HTML-ENTITIES', mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8');
126+
$html = mb_encode_numericentity($originalTrans, [0x80, 0xFFFF, 0, 0xFFFF], mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8');
127127

128128
$useInternalErrors = libxml_use_internal_errors(true);
129129

‎src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class ImageValidatorTest extends ConstraintValidatorTestCase
2828
protected $imageLandscape;
2929
protected $imagePortrait;
3030
protected $image4By3;
31+
protected $image16By9;
3132
protected $imageCorrupted;
3233
protected $notAnImage;
3334

‎src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ protected function dumpLine(int $depth, bool $endOfValue = false)
960960
}
961961
$this->lastDepth = $depth;
962962

963-
$this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');
963+
$this->line = mb_encode_numericentity($this->line, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8');
964964

965965
if (-1 === $depth) {
966966
AbstractDumper::dumpLine(0);

‎src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testHtmlDump()
175175
<span class=sf-dump-meta>trace</span>: {<samp data-depth=2 class=sf-dump-compact>
176176
<span class=sf-dump-meta title="%sExceptionCasterTest.php
177177
Stack level %d."><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%e</span>Tests%eCaster%eExceptionCasterTest.php</span>:<span class=sf-dump-num>%d</span>
178-
&hellip;%d
178+
&#8230;%d
179179
</samp>}
180180
</samp>}
181181
</bar>

‎src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ public function testCastObjectStorageDumpsInfo()
166166

167167
public function testCastArrayObject()
168168
{
169-
$var = new \ArrayObject([123]);
169+
$var = new
170+
#[\AllowDynamicProperties]
171+
class([123]) extends \ArrayObject {};
170172
$var->foo = 234;
171173

172174
$expected = <<<EOTXT
173-
ArrayObject {
175+
ArrayObject@anonymous {
174176
+"foo": 234
175177
-storage: array:1 [
176178
0 => 123

‎src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testGet()
6666
<span class=sf-dump-key>6</span> => <span class=sf-dump-num>{$intMax}</span>
6767
"<span class=sf-dump-key>str</span>" => "<span class=sf-dump-str title="5 characters">d&%s;j&%s;<span class="sf-dump-default sf-dump-ns">\\n</span></span>"
6868
<span class=sf-dump-key>7</span> => b"""
69-
<span class=sf-dump-str title="11 binary or non-UTF-8 characters">&eacute;<span class="sf-dump-default">\\x01</span>test<span class="sf-dump-default">\\t</span><span class="sf-dump-default sf-dump-ns">\\n</span></span>
69+
<span class=sf-dump-str title="11 binary or non-UTF-8 characters">&#233;<span class="sf-dump-default">\\x01</span>test<span class="sf-dump-default">\\t</span><span class="sf-dump-default sf-dump-ns">\\n</span></span>
7070
<span class=sf-dump-str title="11 binary or non-UTF-8 characters">ing</span>
7171
"""
7272
"<span class=sf-dump-key>[]</span>" => []

‎src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Symfony\Component\VarDumper\Tests\Fixture;
44

55
if (!class_exists(\Symfony\Component\VarDumper\Tests\Fixture\DumbFoo::class)) {
6+
#[\AllowDynamicProperties]
67
class DumbFoo
78
{
89
public $foo = 'foo';

‎src/Symfony/Component/VarExporter/Internal/Exporter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarExporter/Internal/Exporter.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,15 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount
106106
}
107107
$properties = ['SplObjectStorage' => ["\0" => $properties]];
108108
$arrayValue = (array) $value;
109-
} elseif ($value instanceof \Serializable || $value instanceof \__PHP_Incomplete_Class) {
109+
} elseif ($value instanceof \Serializable
110+
|| $value instanceof \__PHP_Incomplete_Class
111+
|| $value instanceof \DatePeriod
112+
|| (\PHP_VERSION_ID >= 80200 && (
113+
$value instanceof \DateTimeInterface
114+
|| $value instanceof \DateTimeZone
115+
|| $value instanceof \DateInterval
116+
))
117+
) {
110118
++$objectsCount;
111119
$objectsPool[$value] = [$id = \count($objectsPool), serialize($value), [], 0];
112120
$value = new Reference($id);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.