You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #52881 [DoctrineBridge] Global query time always at 0.00 ms on profiler (Maxime THIRY)
This PR was merged into the 6.4 branch.
Discussion
----------
[DoctrineBridge] Global query time always at 0.00 ms on profiler
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix #52880
| License | MIT
(original explanation made from 7.0 branch, now targeting 6.4 cf comments)
The related issue, when i explained the possible solution : symfony/symfony#52880
On `Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector`, updated the native return type from `int` to `float` for the method `getTime`.
Context :
```
public function getTime(): int
{
$time = 0;
foreach ($this->data['queries'] as $queries) {
foreach ($queries as $query) {
$time += $query['executionMS'];
}
}
return $time;
}
```
Inside this method, the value of `$time` was always a float smaller than 0. The transition to native return type (which was correct regarding to old phpdoc type) made the return cast int to the floating value, hence returning always 0.
I updated the return type to float and updated the test to check for the calculus on floating values.
I had to switch to usleep instead of sleep, since the value might not be an int.
Commits
-------
b78ca959f9 [DoctrineBridge] Fix global query time calculation in profiler
0 commit comments