Skip to content

Commit fa27b32

Browse files
committed
Reduce possibility of breaking the symfony Toolbar
By only dumping the needed relevant information needed for the toolbar/debug page, we avoid dumping data which could break the symfony toolbar (FileProfilerStorage), which cannot serialize Closures. This can happen if the publisher uses a factory In this case the UsageTrackingTokenStorage of the symfony authentication component uses the ContainerInterface/SessionLocator, which creates a Closure Fixes #19
1 parent c590470 commit fa27b32

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/DataCollector/MercureDataCollector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ public function collect(Request $request, Response $response, \Throwable $except
3636
'count' => 0,
3737
'duration' => 0.0,
3838
'memory' => 0,
39-
'publishers' => iterator_to_array($this->publishers),
39+
'publishers' => [],
4040
];
4141

42+
foreach ($this->publishers as $name => $publisher) {
43+
$this->data['publishers'][$name]['messages'] = $publisher->getMessages();
44+
}
45+
4246
foreach ($this->publishers as $name => $publisher) {
4347
$this->data['duration'] += $publisher->getDuration();
4448
$this->data['memory'] += $publisher->getMemory();

0 commit comments

Comments
 (0)