Bugfix Issue 746 TestsuiteDelete NullReturn - sebiboga/testlink-upgraded GitHub Wiki
Issue 746 โ testsuite::delete() returns null: no test suite can be deleted via PHP API
Issue: #746
Branch: fix/issue-746-testsuite-delete ยท Commit: 2d1218b10 (fix, +1/-0)
Status: FIXED & VERIFIED (2026-08-26)
Symptom
testsuite::delete($suiteId) returns null for ALL test suites when called
via the PHP API (BFF suite_delete action). The BFF endpoint reports:
{"status":"ok","message":"Suite deleted","result":null}
Programmatic callers checking the return value see a falsy null and
conclude deletion failed, even though the SQL DELETE operations execute
correctly at the database level.
Reproduced live against http://localhost:8082 (PHP 8.x, MariaDB):
fixtures created through the BFF API, deletion confirmed working at DB
level but returning null to callers.
Root cause chain
lib/functions/testsuite.class.php:287-318โtestsuite::delete()has NOreturnstatement. PHP functions without explicit returns yieldnull.api/testcases/index.php:882-883โ BFF API captures this null:$ret = $tsuiteMgr->delete($sid);and includes it as"result": $ret.lib/functions/testcase.class.php:1655โtestcase::delete()returns1on success, establishing the expected pattern thattestsuite::delete()violates.
Blast radius
testsuite::delete()callers:api/testcases/index.php:882(BFFsuite_delete) โ affected: null resultlib/testcases/containerEdit.php:659viadelete_deep()โ not affected: return value is never checked
- All programmatic consumers of
testsuite::delete()receive falsy null, unable to verify deletion success.
Approach โ add return statement (minimal)
At the end of testsuite::delete(), add return true; after the final
event_signal() call.
Rejected alternatives:
- Changing the return type to a result map (like
create()returns{status_ok, msg, id}) โ over-engineered for a delete method; the existingtestcase::delete()only returns1. - Adding parameter validation or null checks on
$tsuite_infoโ out of scope; the method works correctly for valid IDs.
Verification (Suite 746 โ all PASS, see tmp/TLU_Test_Cases.md)
| Case | Result |
|---|---|
TC-746-01 BFF API suite_delete returns "result":true |
PASS |
| TC-746-02 Suite + child TC fully cleaned up after delete | PASS |
| TC-746-03 Pre-fix returned null, post-fix returns true | PASS |
| Event Viewer | No new Error/Warning entries |
php -l lib/functions/testsuite.class.php |
No syntax errors |