Part of the EllisLab Network
   
 
Critical Bug - XMLRPC | dateTime.iso8601
Posted: 07 May 2008 11:32 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  252
Joined  03-26-2006

OK, So I’ve triple checked that this is actually a bug, and it is.
I’m currently using CI’s XMLRPC Library to communicate with a Java XML-RPC Server.

The method I am using requires data in the following structure:

string userToken
Date from
Date to

The dates are iso8601 dates.

So, here’s the controller:

function games_played($from = null, $to = null)
        
{
            
if ( empty($from) || empty($to) )
            
{
                $from     
= $this->from;
                
$to        = $this->to;
            
}
        
            $request
=     array(
                            array(
$this->api->user_token,     'string' ),
                            array(
date('Ymd\TH:i:s', $from),     'dateTime.iso8601' ),
                            array(
date('Ymd\TH:i:s', $to),        'dateTime.iso8601' )
                        );
            
            if (
$games_played = $this->api->call('AdminAPI.getTotalGamesPlayed', $request) )
            
{
                
return $games_played;
            
}
            
else
            
{

            }
        }

Now, the problem is, that the ‘dateTime.iso8601’ is completely ignored, and those vars get sent as strings.

I’ve run through the library and found exactly where the error occurs:

Line 234 (Xmlrpc.php)

if ( ! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1']])))

The test first lowers the datatype in the comparison, which fails, because the xmlrpcTypes array has a dateTime.iso8601 as the key, not datetime.iso8601 (lower case).

The possible fixes are:

Change line 41 from:

var $xmlrpcDateTime    = 'dateTime.iso8601';

to:

var $xmlrpcDateTime    = 'datetime.iso8601';

then fix any errors that causes....

Or, just remove the strtolower on line 234.

I know this is a pretty specific and unusual bug, but I’m using this library for all of my code at work, so it’s pretty important.

 Signature 

Elliot Haughin CodeIgniter Blog | FilePanda - Free File Sharing | CodeIgniter CMS

Twitter | Flickr

Profile
 
 
Posted: 08 May 2008 12:56 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15007
Joined  06-03-2002

Looks to be the same as this bug report, Elliot.  Since XML tags are case-sensitive, I’m of the mind to just remove the strtolower().  But I know in the past that some services that use XML-RPC for legacy reasons send tags either in all upper or all lowercase, so I’m worried about the impact that might inadvertently have.

 Signature 
Profile
 
 
Posted: 12 May 2008 11:58 AM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15007
Joined  06-03-2002

Ok, the rest of the library is assuming that case folding has been enabled, so we will just switch the $xmlrpcDateTime property to ‘datetime.iso8601’.

 Signature 
Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 61065 Total Logged-in Users: 17
Total Topics: 73886 Total Anonymous Users: 1
Total Replies: 398532 Total Guests: 304
Total Posts: 472418    
Members ( View Memberlist )