|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-05 14:14 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 19:00:02 2025 UTC |
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)); ?>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)); ?>