MantisBT - TestLink
View Issue Details
0008658TestLinkAPI - XMLRPCpublic2019-05-08 19:392019-06-19 20:54
lczub 
fman 
normalminoralways
assignedreopened 
1.9.19 (2019 Q1) 
1.9.20 Raijing DEV 
postgresql
READY FOR TESTING
0008658: API-XMLRPC - getTestCaseAttachments returns no attachment, uploaded with uploadTestCaseAttachment
With TL 1.9.19 and current github code following round trip does not work anymore, what was the case with 1.9.17 and 1.19.18
a) upload attachment to test case via XMLRPC call *uploadTestCaseAttachment* with parameter *testcaseid*
b) download attachment from test case via XMLRPC call *getTestCaseAttachments* with parameter *testcaseid*

With 1.19.19, only an empty response is returned.

Can it be, that the 1.19.19 change on *getTestCaseAttachments*, the new optional parameter *version* either isn't optional or must be although introduce on *uploadTestCaseAttachment* ?
- I haven't see in _xmlrpc.class.php_ a matching change on *uploadTestCaseAttachment*.
Could it be, that *uploadTestCaseAttachment* stores the attachments with a different key as *getTestCaseAttachments* it now expect?
No tags attached.
related to 0008660resolved fman API-XMLRPC - PHP Fatal error, when calling getTestCaseAttachments with unknown testcaseid 
child of 0008549assigned fman Availables hot-fixes for 1.9.19 & How To get full fixed package from GitHub 
Issue History
2019-05-08 19:39lczubNew Issue
2019-05-09 08:14fmanNote Added: 0028818
2019-05-16 14:32fmanRelationship addedrelated to 0008660
2019-05-28 18:25fmanNote Added: 0028879
2019-05-28 18:25fmanQA Team - Task Workflow Status => READY FOR TESTING
2019-05-28 18:25fmanNote Added: 0028880
2019-05-28 18:25fmanStatusnew => resolved
2019-05-28 18:25fmanFixed in Version => 1.9.20 Raijing DEV
2019-05-28 18:25fmanResolutionopen => fixed
2019-05-28 18:25fmanAssigned To => fman
2019-05-28 18:26fmanRelationship addedchild of 0008549
2019-05-29 20:22lczubNote Added: 0028886
2019-05-29 20:22lczubStatusresolved => assigned
2019-05-29 20:22lczubResolutionfixed => reopened
2019-06-19 20:54lczubNote Added: 0028957

Notes
(0028818)
fman   
2019-05-09 08:14   
attachments now are managed at Test Case Version level and not Test Case anymore, may be this piece of code has not been refactored
(0028879)
fman   
2019-05-28 18:25   
https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/55574272c9113eaf334dbc90b89a1b333d3bdcd4 [^]
(0028880)
fman   
2019-05-28 18:25   
https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/55574272c9113eaf334dbc90b89a1b333d3bdcd4 [^]
(0028886)
lczub   
2019-05-29 20:22   
Retest with latest commit 99385ea61 failed

uploadTestCaseAttachment with args 'testcaseid' and 'version' works
- attachment is accessable inside the web client

getTestCaseAttachments with args 'testcaseid' and 'version' aborts with an internal server error. Error Log reports an SQL syntax failure:

ERROR ON exec_query() - database.class.php
-1 - FEHLER: Syntaxfehler bei »AND« LINE 1: SELECT id FROM attachments WHERE fk_id = AND fk_table = 't... ^ - SELECT id FROM attachments WHERE fk_id = AND fk_table = 'tcversions' ORDER BY id ASC
THE MESSAGE : SELECT id FROM attachments WHERE fk_id = AND fk_table = 'tcversions' ORDER BY id ASC Query failed: errorcode[-1] errormsg:FEHLER: Syntaxfehler bei »AND« LINE 1: SELECT id FROM attachments WHERE fk_id = AND fk_table = 't... ^
(0028957)
lczub   
2019-06-19 20:54   
Error still occur with latest github code state 2bb1e8f47, when calling getTestCaseAttachments with optional paramter 'version'

Error does not occur, when calling getTestCaseAttachments without the optional paramter 'version'

Reason is, that $this->tcVersionID has only a value, when $this->checkTestCaseVersionNumberAncestry() is called what only happens when getTestCaseAttachments is called without parameter 'version'

Following mod avoids for me the error :

    public function getTestCaseAttachments($args) {
...
        if( $status_ok &&
            !$this->_isParamPresent( self::$versionNumberParamName ) ) {
          try {
            $tc = $this->getTestCase($args,self::THROW_ON_ERROR);
            $this->args[self::$versionNumberParamName] = $tc[0][self::$versionNumberParamName];
          } catch (Exception $e) {
            return $this->errors;
          }

// LC 190619 Start fix Mantis 8658 - this->tcVersionID NONE, when optional arg version is set
// $map = $this->checkTestCaseVersionNumberAncestry();
// $status_ok = $map["status_ok"];
        }
          $map = $this->checkTestCaseVersionNumberAncestry();
          $status_ok = $map["status_ok"];
// LC 190619 End fix Mantis 8658

        if($status_ok) {
            $tcvid = $this->tcVersionID;

...