Welcome Guest, Not a member yet? Register   Sign In
Critical Bug - XMLRPC | dateTime.iso8601
#1

[eluser]Elliot Haughin[/eluser]
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:

Code:
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)
Code:
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:
Code:
var $xmlrpcDateTime    = 'dateTime.iso8601';
to:
Code:
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.
#2

[eluser]Derek Jones[/eluser]
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.
#3

[eluser]Derek Jones[/eluser]
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'.




Theme © iAndrew 2016 - Forum software by © MyBB