Commit cf85540
committed
bug symfony#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 symfony#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#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
-------
b78ca95 [DoctrineBridge] Fix global query time calculation in profilerFile tree
3 files changed
+32
-2
lines changed- src/Symfony/Bridge/Doctrine
- DataCollector
- Tests/DataCollector
3 files changed
+32
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
76 | 106 | | |
77 | 107 | | |
78 | 108 | | |
| |||
0 commit comments