Repository navigation
Bugfix Issue 517 BuildEdit EWarning GetById Guard
Issue: #517
Branch: fix/issue-517
Commit: e1470e507
Date: 2026-08-25
Under PHP 8.x, buildEdit.php generated multiple E_WARNING ("Trying to access array offset on false") errors when build::get_by_id() returned false for a non-existent or invalid build ID. This affected three code paths:
-
edit()(line 224): 10+ array key accesses on$binfoafterget_by_id()returned false -
doDelete()(line 293):$build['name']accessed on false result -
doUpdate()(line 565):$oldObjData['name']accessed on false result
Two additional warnings from the original report (trim(null) at line 642 and undefined $col2hide) were already fixed in prior commits.
build::get_by_id() uses fetch_array() which returns false when no row matches the given ID. The callers in edit(), doDelete(), and doUpdate() accessed array keys on this boolean result without checking whether the lookup succeeded.
Added if (!$result) early-return guards after each get_by_id() call:
-
edit(): If$binfois false, returns an$opwithstatus_ok = 0anduser_feedback = lang_get("cannot_update_build") -
doDelete(): If$buildis false, returns an$opwithuser_feedback = lang_get("cannot_delete_build") -
doUpdate(): If$oldObjDatais false, returns an$opwithuser_feedback = lang_get("cannot_update_build")
All three guards use existing i18n keys — no new locale strings needed.
| File | Change |
|---|---|
lib/plan/buildEdit.php |
+20 lines, 3 early-return false guards |
- PHP syntax check: no errors
- Browser: edit with invalid build_id=99999 → "Error while updating build!" displayed, no warnings
- Browser: edit with valid build_id=1 → form loads correctly
- Browser: create build without release date → no trim(null) deprecation warning
- Console: zero JS errors on all tested pages