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
{{ message }}
Repository navigation
[Bug]: QueryLog drops queries with zero elapsed time, query counters fail at random #26
QueryLog::log() drops a query whose elapsed is 0.0. It skips entries with if (empty($context['elapsed'])) (src/Database/QueryLog.php:42), and empty(0.0) is true. A query that finishes faster than the clock's resolution is therefore not counted, so assertNumReads() / assertNumWrites() fail at random ("expected 1, got 0").
Is this a regression?
No.
To Reproduce
A fast query on SQLite (in memory), on a runner with a coarse clock.
captureReadQueries() around it, then assertNumReads(1).
Sometimes fails with 0 reads. It failed the first CI run of test: raise line coverage #25 (PHP 8.2) and passed on rerun.
Deterministic: call $log->log('debug', 'SELECT 1', ['elapsed' => 0.0]) — the query is not recorded.
Expected behaviour
Every executed query is recorded: check isset($context['elapsed']) (or array_key_exists) instead of empty().
Activity