ID: 45187 Comment by: kawai at apache dot org Reported By: pickscrape at gmail dot com Status: Open Bug Type: XMLRPC-EPI related Operating System: Linux PHP Version: 5.2.6 New Comment:
IMHO, this is not a bug but may be a feature request. By the way, if we're going to support DateTime class object, how do you think what the result of xmlrpc_decode_request should be look like (keeping backword compatibility, of cource)? Previous Comments: ------------------------------------------------------------------------ [2008-06-14 16:45:37] pickscrape at gmail dot com Yes, that's kinda the point to this bug report. When xmlrpc_encode_request walks the parameters array (recursively), any DateTime objects it encounters should be encoded as XMLRPC datetime parameters (exactly like your snippet and the latter half of my example demonstrate) transparently. In other words, I'd expect the output from the first part of my script to be identical to the output from the second. ------------------------------------------------------------------------ [2008-06-14 12:59:49] kawai at apache dot org There is no statement that we can use DateTime object for passing to an xmlrpc function, and actually, we can't use it. It is a limitation of current implementation of xmlrpc extension. However, I think we MAY support DateTime object in xmlrpc extension. Current xmlrpc extension allows you to create xmlrpc datetime value from an ISO-8601 format string. So you can code like this: <?php $obj=new DateTime(); $datetime=$obj->format(DATE_ISO8601); xmlrpc_set_type($datetime,'datetime'); var_dump(xmlrpc_encode_request('x',$datetime)); ?> ------------------------------------------------------------------------ [2008-06-12 17:50:28] pickscrape at gmail dot com This script reproduces it. Interestingly, this script also causes a stack smash to happen for me on Ubuntu, for which I have raised a separate bug (launchpad 239513). It runs fine under gentoo though and reproduces this bug properly. <?php $params = array(new DateTime()); print_r($params); echo "This is useless:\n"; print_r(xmlrpc_encode_request('x', $params)); echo "\nThis is what I would expect to happen automatically:\n"; $params2 = array(new DateTime()); $params2[0] = $params2[0]->format(DATE_ISO8601); xmlrpc_set_type($params2[0], 'datetime'); print_r(xmlrpc_encode_request('x', $params2)); ?> ------------------------------------------------------------------------ [2008-06-11 22:02:11] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2008-06-09 06:06:44] kawai at apache dot org Please show a code that reproduces the problem. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/45187 -- Edit this bug report at http://bugs.php.net/?id=45187&edit=1