Skip to content

Commit 563aab5

Browse files
committed
Make sure a serialized DumpDataCollector can be unserialized
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 8d4cc9a commit 563aab5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

DataCollector/DumpDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
class DumpDataCollector extends DataCollector implements DataDumperInterface
3333
{
34-
private ?Stopwatch $stopwatch;
34+
private ?Stopwatch $stopwatch = null;
3535
private string|FileLinkFormatter|false $fileLinkFormat;
3636
private int $dataCount = 0;
3737
private bool $isCollected = true;

Tests/DataCollector/DumpDataCollectorTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ public function testDump()
5454

5555
$this->assertStringMatchesFormat('%a;a:%d:{i:0;a:5:{s:4:"data";%c:39:"Symfony\Component\VarDumper\Cloner\Data":%a', serialize($collector));
5656
$this->assertSame(0, $collector->getDumpsCount());
57-
$this->assertSame("O:60:\"Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\":1:{s:7:\"\0*\0data\";a:2:{i:0;b:0;i:1;s:5:\"UTF-8\";}}", serialize($collector));
57+
58+
$serialized = serialize($collector);
59+
$this->assertSame("O:60:\"Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\":1:{s:7:\"\0*\0data\";a:2:{i:0;b:0;i:1;s:5:\"UTF-8\";}}", $serialized);
60+
61+
$this->assertInstanceOf(DumpDataCollector::class, unserialize($serialized));
5862
}
5963

6064
public function testDumpWithServerConnection()

0 commit comments

Comments
 (0)