Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003993TestLinkAPI - XMLRPCpublic2010-11-09 08:352011-03-17 19:07
Reporterpablobitton 
Assigned Tofman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.9 RC 1 
Fixed in Version2.0 (planned) 
Summary0003993: [API] getFullPath can receive a list of node ids instead of one node
Descriptionwe use it intensively and require a method that gets a list.
the internal function it uses is called get_full_path_verbose and excepts both list and string..

another function can be provided, or this function can just remove the check for int and pass the argument on..
TagsNo tags attached.
Database (MySQL,Postgres,etc)N/A
Browser
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Filespatch file icon xmlrpc.class.php.patch [^] (878 bytes) 2010-11-10 18:43 [Show Content]
zip file icon fix-3993.zip [^] (86,273 bytes) 2010-11-20 16:15

- Relationships
has duplicate 0002719closedfman please expose new API function : get_full_path_verbose 
child of 0004039closed Availables Fixes for 1.9.0 (Prague) 

-  Notes
(0012357)
fman (administrator)
2010-11-10 09:04

>> we use it intensively and require a method that gets a list.
open to review your contribution.
(0012374)
pablobitton (reporter)
2010-11-10 12:03

in function getFullPath:
line 3651 there is a check for $nodeID

the check is wrong

$nodeID can be single number or a list.

the check is going like this:

if (!is_int($nodeID) && $nodeID <=0)
    error.....

1. if $nodeID is a list, check should be done for every item on a list
not is tries to check $nodeID <=0 is $nodeID is not int....??

2. if $nodeID is a negative number, check would not raise error because second part of if would be executed (here i am not sure)
(0012377)
fman (administrator)
2010-11-10 14:17

Open to contribution means: provide full code tested
(0012393)
pablobitton (reporter)
2010-11-10 18:44

attached patch as a file and also here in a note:




--- xmlrpc.class.php.orig 2010-11-10 21:29:16.000000000 +0200
+++ xmlrpc.class.php 2010-11-10 21:34:54.000000000 +0200
@@ -3647,13 +3647,16 @@
       
         if( $status_ok )
         {
- $nodeID=$this->args[self::$nodeIDParamName];
- if( !is_int($nodeID) || $nodeID <= 0 )
- {
- $msg = $msg_prefix . sprintf(NODEID_IS_NOT_INTEGER_STR);
- $this->errors[] = new IXR_Error(NODEID_IS_NOT_INTEGER, $msg);
- $status_ok=false;
- }
+ $nodeID=$this->args[self::$nodeIDParamName];
+ foreach ((array)$nodeID as $item)
+ {
+ if( !is_int($item) || ( is_int($item) && $item <= 0 ))
+ {
+ $msg = $msg_prefix . sprintf(NODEID_IS_NOT_INTEGER_STR);
+ $this->errors[] = new IXR_Error(NODEID_IS_NOT_INTEGER, $msg);
+ $status_ok=false;
+ }
+ }
         }
         
         if( $status_ok )
(0012443)
pablobitton (reporter)
2010-11-14 07:53

fman, is it enough?
(0012673)
fman (administrator)
2010-11-20 15:21
edited on: 2010-11-20 15:22

Is not enough, you have missed error check on this piece of code:

 $full_path = $this->tprojectMgr->tree_manager->get_full_path_verbose($nodeIDSet);
            if(is_null($full_path))
            {
                $msg = $msg_prefix . sprintf(NODEID_DOESNOT_EXIST_STR,$nodeID);
                $this->errors[] = new IXR_Error(NODEID_DOESNOT_EXIST, $msg);
                $status_ok=false;
            }

(0012674)
fman (administrator)
2010-11-20 16:08

Refactored (for TL 2.0) when path can not be found instead of returning error, data structure returned will be identical, to data structure returned when everything OK, but instead of array with path, NULL will be returned
(0012675)
fman (administrator)
2010-11-20 16:16

please use attached fix and let us know results
(0012678)
pablobitton (reporter)
2010-11-21 08:07

seems working for now, I will continue testing and let you know if there is a problem
(0013038)
fman (administrator)
2010-12-19 16:14

no more user feedback

- Issue History
Date Modified Username Field Change
2010-11-09 08:35 pablobitton New Issue
2010-11-10 09:04 fman Note Added: 0012357
2010-11-10 12:03 pablobitton Note Added: 0012374
2010-11-10 14:17 fman Note Added: 0012377
2010-11-10 18:43 pablobitton File Added: xmlrpc.class.php.patch
2010-11-10 18:44 pablobitton Note Added: 0012393
2010-11-14 07:53 pablobitton Note Added: 0012443
2010-11-20 15:21 fman Note Added: 0012673
2010-11-20 15:22 fman Note Edited: 0012673 View Revisions
2010-11-20 16:08 fman Note Added: 0012674
2010-11-20 16:15 fman File Added: fix-3993.zip
2010-11-20 16:16 fman Note Added: 0012675
2010-11-20 16:16 fman Assigned To => fman
2010-11-20 16:16 fman Status new => feedback
2010-11-20 16:16 fman Fixed in Version => 2.0 (planned)
2010-11-20 16:53 fman Relationship added child of 0004039
2010-11-21 08:07 pablobitton Note Added: 0012678
2010-11-21 08:07 pablobitton Status feedback => assigned
2010-11-21 17:25 fman Database mysql => N/A
2010-11-21 17:25 fman Summary getFullPath can receive a list of node ids instead of one node => [API] getFullPath can receive a list of node ids instead of one node
2010-12-19 16:14 fman Note Added: 0013038
2010-12-19 16:14 fman Status assigned => resolved
2010-12-19 16:14 fman Resolution open => fixed
2010-12-19 16:15 fman Relationship added has duplicate 0002719
2011-03-17 19:07 fman Status resolved => closed
2013-04-25 17:30 fman Category TL API => XMLRPC API
2013-04-25 17:30 fman Category XMLRPC API => API - XMLRPC



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker