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:
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)); ?> Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2008-06-05 14:14:42] pickscrape at gmail dot com Description: ------------ When encoding parameters to XML-RPC object of type DateTime should be converted into the standard XMLRPC date format instead of the empty array that they are currently converted as. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45187&edit=1