Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007902TestLinkAPI - XMLRPCpublic2017-03-28 09:452017-04-03 20:05
Reporterlczub 
Assigned Tofman 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Fixed in Version1.9.17 (2017 Q2) 
Summary0007902: (github code) API-XMLRPC - getRequirements raise PHP Fatal error
DescriptionProblem with latest TL DEV1.9.17 code from github ( commit 0c8feb6 ):
- calling xml-rpc api method getRequirements with optional arguments 'testplanid' and 'platformid' raises a PHP Fatal error

reason is, that method TestlinkXMLRPCServer->getRequirements calls 'checkTestPlanID' and 'checkPlatformIdentity' as functions and not methods
Steps To ReproducePHP Fatal error: Call to undefined function checkTestPlanID() in /usr/local/www/testlink-git/lib/api/xmlrpc/v1/xmlrpc.class.php on line 8020

PHP Fatal error: Call to undefined function checkPlatformIdentity() in /usr/local/www/testlink-git/lib/api/xmlrpc/v1/xmlrpc.class.php on line 8025
Additional InformationSuggestion for fix xmlrpc.class.php:8006...

  public function getRequirements($args)
  {
    ...
    // check if a context (test plan/platform) is provided
      if ($this->_isParamPresent(self::$testPlanIDParamName)) {
//WRONG $status_ok = checkTestPlanID($msg_prefix);
        $status_ok = $this->checkTestPlanID($msg_prefix);
        $context['tplan_id'] = $this->args[self::$testPlanIDParamName];

        if ( $status_ok ) {
          if ($this->_isParamPresent(self::$platformIDParamName)) {
//WRONG $status_ok = checkPlatformIdentity($this->args[self::$testPlanIDParamName],
            $status_ok = $this->checkPlatformIdentity($this->args[self::$testPlanIDParamName],
                                               $this->args[self::$platformIDParamName],
                                               $msg_prefix);
            $context['platform_id'] = $this->args[self::$platformIDParamName];
          }
        }
      }
    }
...
TagsNo tags attached.
Database (MySQL,Postgres,etc)postgresql 9.6.2
Browser
PHP Version
TestCaseID
QA Team - Task Workflow StatusREADY FOR TESTING
Attached Files

- Relationships

-  Notes
(0026218)
fman (administrator)
2017-03-28 14:52

thanks for help

regards
(0026219)
lczub (reporter)
2017-03-28 20:19

method getRequirements() includes an additional failure.
it calls $this->checkPlatformIdentity with the second argument as integer platformID instead a map of platform infos. Result is, that valid testPlanID - platformID combinations returns an error message:
- 3040: (getRequirements) - Platform (name=/id=1126) is not linked to test plan (name:TestPlan_API_GENERIC A)

suggestion for better fix:

  public function getRequirements($args)
  {
    ...
    // check if a context (test plan/platform) is provided
      if ($this->_isParamPresent(self::$testPlanIDParamName)) {
//WRONG $status_ok = checkTestPlanID($msg_prefix);
        $status_ok = $this->checkTestPlanID($msg_prefix);
        $context['tplan_id'] = $this->args[self::$testPlanIDParamName];

        if ( $status_ok ) {
          if ($this->_isParamPresent(self::$platformIDParamName)) {
//WRONG $status_ok = checkPlatformIdentity($this->args[self::$testPlanIDParamName],
//WRONG $this->args[self::$platformIDParamName],
            $status_ok = $this->checkPlatformIdentity($this->args[self::$testPlanIDParamName],
                                               null,
                                               $msg_prefix);
            $context['platform_id'] = $this->args[self::$platformIDParamName];
          }
        }
      }
    }
(0026220)
fman (administrator)
2017-03-28 20:29

I'm sorry this is what happens when I trust blindly to a contribution.
I will check things better in future.
(0026232)
atisne (reporter)
2017-03-31 09:12

A fix is available in the merge request https://github.com/TestLinkOpenSourceTRMS/testlink-code/pull/94 [^]

Sorry for the lack of test and thanks for your report.
(0026237)
lczub (reporter)
2017-04-03 19:49

Retest with github commit 4aa14ae passed

Calling xml-rpc api method getRequirements with optional arguments 'testplanid' and 'platformid' raises no PHP Fatal error
Calling xml-rpc api method getRequirements with a valid 'testplanid' + 'platformid' combination returns know an expected list with requirements.
(0026238)
fman (administrator)
2017-04-03 20:05

great!

- Issue History
Date Modified Username Field Change
2017-03-28 09:45 lczub New Issue
2017-03-28 14:52 fman Note Added: 0026218
2017-03-28 20:19 lczub Note Added: 0026219
2017-03-28 20:29 fman Note Added: 0026220
2017-03-31 09:12 atisne Note Added: 0026232
2017-04-03 19:49 lczub Note Added: 0026237
2017-04-03 20:05 fman Note Added: 0026238
2017-04-03 20:05 fman QA Team - Task Workflow Status => READY FOR TESTING
2017-04-03 20:05 fman Status new => resolved
2017-04-03 20:05 fman Fixed in Version => 1.9.17 (2017 Q2)
2017-04-03 20:05 fman Resolution open => fixed
2017-04-03 20:05 fman Assigned To => fman



Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker