Bugfix Issue 648 Xmlrpc TestSuiteUpdate Testsuitename EWarning - sebiboga/testlink-upgraded GitHub Wiki
Issue 648 — xmlrpc createTestSuite update: E_WARNING "Undefined array key testsuitename" when name omitted
Issue: #648
Branch: fix/issue-648
Status: FIXED & VERIFIED (2026-08-26)
Symptom
Calling tl.createTestSuite with action=update without passing testsuitename produces an E_WARNING in the Event Viewer despite the operation succeeding:
E_WARNING Undefined array key "testsuitename" - lib/api/xmlrpc/v1/xmlrpc.class.php:4461
A secondary warning was also triggered:
E_WARNING Undefined variable $result - lib/functions/testsuite.class.php:253
Both warnings are pure log noise — testsuite::update() at testsuite.class.php:237 guards !is_null($name) so null name means "don't change".
Root cause chain
createTestSuite()builds$optdefaults for theupdatecase atxmlrpc.class.php:4382:self::$testSuiteNameParamName => null.- Lines 4419-4423 populate
$optfrom$this->argswhen present — correct normalization. - But the code at lines 4438, 4461, and 4485 reads
$args[self::$testSuiteNameParamName]from the raw request struct (the function parameter$args), not from the normalized$opt. Whentestsuitenameis absent, this is an undefined key → E_WARNING. - In
testsuite.class.php, when bothnameanddetailsare null, no SQL UPDATE executes and$resultis never assigned. Line 253if (!$result)reads the undefined variable → secondary E_WARNING.
Fix — isset-default normalization
Two edits:
-
xmlrpc.class.php:4458-4460: Addedisset-default guard fortestsuitename, mirroring the existing$detailsguard at lines 4454-4456:if( !isset( $args[self::$testSuiteNameParamName] ) ) { $args[self::$testSuiteNameParamName] = null; } -
testsuite.class.php:219: Initialized$result = null;at method entry. Changed line 253 toif (!is_null($result) && !$result)to avoid false error when no SQL executed.
No behavior change — update with null name skips the name SQL as before; update with a name works as before.
Files changed
| File | Change |
|---|---|
lib/api/xmlrpc/v1/xmlrpc.class.php |
+3 lines: isset-default for testsuitename (:4458-4460) |
lib/functions/testsuite.class.php |
+1 line: $result = null init (:219); 1 line changed: null-safe check (:253) |
tmp/TLU_Test_Cases.md |
Suite 648 regression entry (6 cases) |
Verification
php -lpasses for both files.- Repro re-run: update WITHOUT
testsuitename→ 0 events (was: 2 E_WARNING entries). - Regression: update WITH
testsuitename→ name changes, 0 events. - Regression: create test suite → still works, 0 events.