10000 symfony/http-client - Stop working with profiler · Issue #49219 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

symfony/http-client - Stop working with profiler #49219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jdupouyes opened this issue Feb 3, 2023 · 6 comments
Closed

symfony/http-client - Stop working with profiler #49219

jdupouyes opened this issue Feb 3, 2023 · 6 comments

Comments

@jdupouyes
Copy link

Symfony version(s) affected

5.4.20

Description

With symfony/http-client 5.4.20 HTTP requests no longer appear in the HTTP Client tab of the Symfony profiler.

How to reproduce

Create a controller with an action with an HttpClientInterface parameter.
In the action code, make a call to a valid URL with the client:

<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\HttpClient\HttpClientInterface;

class TestController extends AbstractController
{
    /**
     * @Route("/test")
     */
    public function test(HttpClientInterface $httpClient): Response
    {
        $httpClient->request('GET','http://google.com');
        return $this->render('index.html.twig');
    }
}

With the project in dev mode with debug activated, call the route and go to the profiler:

  • With symfony/http-client 5.4.19 an entry is added to the HTTP Client tab of the profiler

image

  • With symfony/http-client 5.4.20 the HTTP Client tab of the profiler is empty

image

Possible Solution

No response

Additional Context

No response

@schodemeiss
Copy link

This seems to have appeared after the CVE fixes.

@bigfoot90
Copy link
bigfoot90 commented Feb 3, 2023

Same for 6.2.5 version too.

I can see the requests tracked by commenting out the IF-ELSE in
vendor/symfony/web-profiler-bundle/Resources/views/Collector/http_client.html.twig file
screencapture-localhost-profiler-5401a9-2023-02-03-21_11_46

@fpaterno
Copy link
fpaterno commented Feb 4, 2023

Problem has appeared with this PR : 3cb1d70

I feel reset() should be called first (at the beginnig of the method)

@OskarStark
Copy link
Contributor

cc @nicolas-grekas

nicolas-grekas added a commit that referenced this issue Feb 10, 2023
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
symfony-splitter pushed a commit to symfony/http-client that referenced this issue Feb 10, 2023
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       | symfony/symfony#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
-------

8ec869e51e [HttpClient] Fix data collector
@dmamchyts
Copy link
dmamchyts commented Feb 13, 2023

What about the same fix into 6.2 and other versions?

image

@fancyweb
Copy link
Contributor

@dmamchyts The patch you screenshotted was already merged in 6.2.

#49301 is a new patch that has been merged in 5.4 and will be merged up to 6.2. You have to wait until the next release cycle which should be at the end of the month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants
0