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

[Bug][DoctrineBridge] Global query time always at 0.00 ms on profiler #52880

Copy link
Copy link
Closed
@maximethiry

Description

@maximethiry
Issue body actions

Symfony version(s) affected

7.0

Description

Since I updated a project from 6.3 to 7.0, the global query time for Doctrine queries is always at 0.00 ms on the profiler.

For the same http request :
Screenshot from 2023-12-04 05-33-24
Screenshot from 2023-12-04 05-33-39

How to reproduce

Do multiple doctrine calls on a same http request

Possible Solution

After a few tests, it seems that the problem comes from the switch to native return types on Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector method.

For context :

public function getTime(): int
{
    $time = 0;
    foreach ($this->data['queries'] as $queries) {
        foreach ($queries as $query) {
            $time += $query['executionMS'];
        }
    }

    return $time;
}

Inside the getTime method, when I check what's inside $time before the return, I have a float smaller than 0 (something like 0.0015671253204346 for example)
So when returning, this value is casted to int and become 0.

After changing the return type of the getTime method to float, the calculation worked again.

Working on a PR.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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