Bugfix Issue 1557 isIssueTrackerEnabled NullResult EWarning - sebiboga/testlink-upgraded GitHub Wiki
Bugfix — Issue #1557: PHP 8 E_WARNING in isIssueTrackerEnabled() when test project id does not exist
Every ASIDE init for a non-existent / stale test project id wrote an E_WARNING to the events table:
E_WARNING
Trying to access array offset on null - in .../lib/functions/testproject.class.php - Line 3487
source: GUI - Test Project ID : 1
HTTP stays 200 — the symptom only shows in the Event Viewer / events table (log_level 2, activity=PHP).
Reproduce at HEAD (fresh-import CI box, zero testprojects rows):
curl -b <cookies> "http://localhost:8082/api/aside/index.php?action=init&tproject_id=1&tplan_id=2"
→ HTTP 200 + one new E_WARNING row per call (events ids 2, 3 observed live).
-
lib/functions/database.class.php:785 get_recordset()inits$output = null; a 0-row SELECT returnsnull. -
lib/functions/testproject.class.php:3479 isIssueTrackerEnabled($id)→$ret[0]['issue_tracker_enabled'](line 3487) — offset access onnullthrows the PHP 8 warning. - Triggered whenever the referenced
tproject_idhas no row. -
Blast radius:
api/aside/index.php:125,lib/general/asideMenu.php:71,lib/results/resultsNavigator.php:126— all consume the value only inside a boolean-AND report filter ((enabled=='bts') && $btsEnabled); no strict-type checks exist, sonulland0are behaviourally identical.
Branch fix/issue-1557, commit 98d4d1f0b:
$ret = $this->db->get_recordset($sql);
if( !is_array($ret) || !isset($ret[0]['issue_tracker_enabled']) )
{
return 0;
}
return $ret[0]['issue_tracker_enabled'];Fail-closed 0 (= issue tracker disabled, the schema default) hides nothing beyond the BTS report affordances for a project that does not exist. Happy path untouched. Rejected: a displayInfo() unknown-project page (behaviour change beyond a log bug), changing get_recordset() to return [] (database-contract change, wide blast radius), unifying the sibling isCodeTrackerEnabled() (drive-by refactor).
- R1 non-existent id 1 (events cleared first): 3× ASIDE init → HTTP 200 each,
eventscount stays 0 (pre-fix: 1 E_WARNING per call). - R2 valid id 100 (
issue_tracker_enabled=1seeded): HTTP 200, full ASIDE JSON,eventsstays 0. - R3
php -lclean on all 4 touched-path PHP files. - R4 Event hygiene: zero Error/Warning rows after the matrix; Event Viewer clean:

Regression suite 1557 3/3 PASS in tmp/TLU_Test_Cases.md. No user-facing strings → no i18n changes.