Bugfix Issue 559 ExecCountersNullGuard stdClass - sebiboga/testlink-upgraded GitHub Wiki
Bugfix โ Issue #559: getExecCountersByExecStatus() Always Returns Null
Date: 2026-08-26 ยท Commit: d91446a74
Summary
getExecCountersByExecStatus() in tlTestPlanMetrics.class.php always returned null due to a type mismatch in the guard condition, causing every test plan to show zero metrics on the Metrics Dashboard.
Symptom
- Both the modernized and legacy Metrics Dashboard showed Active TCs=0 and Progress=0% for all test plans.
- Plans without platforms showed all zeros, but plans WITH builds/executions were also affected.
Root Cause
The guard at lib/functions/tlTestPlanMetrics.class.php:1056 used is_array($builds) but $builds is a stdClass object (not an array), so the check was always false, short-circuiting the condition and always returning null.
Fix
// Before (broken):
if(is_null($builds) || is_array($builds) == false || count($builds) <= 0) { return null; }
// After (fixed):
if(is_null($builds->idSet) || count($builds->idSet) <= 0) { return null; }
One-line fix accessing the correct stdClass property. Matches upstream TestLink behavior.
Files Changed
lib/functions/tlTestPlanMetrics.class.phpโ lines 1054-1056
Verification
- Plan without platforms + build + TC + execution โ Active TCs=1, Passed=100%, Progress=100%
- Event Viewer: 0 new errors/warnings