8000 bug #49301 [HttpClient] Fix data collector (fancyweb) · symfony/symfony@d75f031 · GitHub
[go: up one dir, main page]

Skip to content

Commit d75f031

Browse files
bug #49301 [HttpClient] Fix data collector (fancyweb)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpClient] Fix data collector | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | - | Tickets | #49219 | License | MIT | Doc PR | - It fixes HTTP requests not showing anymore in the profiler panel because `lateCollect()` overrides `request_count` to 0. It also fixes the wrong error count. Commits ------- 8ec869e [HttpClient] Fix data collector
2 parents f988bdd + 8ec869e commit d75f031

File tree

1 file changed

+4
-3
lines changed

1 file changed< 8000 /h2>
+4
-3
lines changed

src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function collect(Request $request, Response $response, \Throwable $except
4343

4444
public function lateCollect()
4545
{
46-
$this->data['request_count'] = 0;
47-
$this->data['error_count'] = 0;
46+
$this->data['request_count'] = $this->data['request_count'] ?? 0;
47+
$this->data['error_count'] = $this->data['error_count'] ?? 0;
4848
$this->data += ['clients' => []];
4949

5050
foreach ($this->clients as $name => $client) {
@@ -59,7 +59,8 @@ public function lateCollect()
5959

6060
$this->data['clients'][$name]['traces'] = array_merge($this->data['clients'][$name]['traces'], $traces);
6161
$this->data['request_count'] += \count($traces);
62-
$this->data['error_count'] += $this->data['clients'][$name]['error_count'] += $errorCount;
62+
$this->data['error_count'] += $errorCount;
63+
$this->data['clients'][$name]['error_count'] += $errorCount;
6364

6465
$client->reset();
6566
}

0 commit comments

Comments
 (0)
0