ZF-8074: Problem when calling a webservice method with a Zend_XmlRpc_Value_DateTime object as parameter
Description
I have an object esposed as web service using Zend_XmlRpc_Server whose signature is:
/**
* Return the spots for the date and edition provided
*
* @param dateTime.iso8601 $day
* @param string $edition two letter iso code for edition
* @param string $type type of ads to be retrieved
* @return boolean|array spots array or false if there is any error
*/
public function dailyAds($day, $edition, $type);}}
When using this webservice I can call it in the following way:
{{$client = new Zend_XmlRpc_Client($endpoint);
$date = new Zend_XmlRpc_Value_DateTime(time());
$edition = 'foo';
$type = 'bar';
$client->getProxy('ads')->dailyAds($date, $edition, $type);}}
as stated here: http://framework.zend.com/manual/en/…
However when I execute the client code I obtain:
Warning: strtotime() expects parameter 1 to be string, object given in /var/ZendFramework-1.9.3/library/Zend/XmlRpc/Value/DateTime.php on line 55
Catchable fatal error: Object of class Zend_XmlRpc_Value_DateTime could not be converted to string in /var/ZendFramework-1.9.3/library/Zend/XmlRpc/Value/DateTime.php on line 57
If I call the webservice with Zend_Date::now()->get(Zend_Date::DATE_ISO8601) or directly with the timestamp the webservice works fine.
The error is triggered by Zend/XmlRpc/Value.php by the method getXmlRpcValue at line 151, which is called by Zend/XmlRpc/Client.php at line 344.
In previous versions of Zend Framework this code works fine (the old version of my app runs on 1.5.2)
Comments
Posted by Fabio Napoleoni (fabio) on 2009-10-16T20:06:28.000+0000
Edit: this behaviour doesn't happen on my development platform with this specs: OS: Mac OSX 10.6 Webserver: MAMP 1.7.2 php: PHP 5.2.6 (cli) (built: Jul 24 2008 08:32:16) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies with Zend Debugger v5.2.15, Copyright (c) 1999-2008, by Zend Technologies ZF 1.9.3PL1
However it does happen on production host with following specs: OS: Debian Stable Webserver: apache 2.2.9-10+lenny4 PHP: PHP 5.2.6-1+lenny3 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 26 2009 22:16:23) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies ZF: 1.9.3PL1
Posted by Fabio Napoleoni (fabio) on 2009-10-16T20:28:22.000+0000
Please ignore my previous comment, it doesn't depend on platform, it depends if system lookup is activated, if I add this line:
to my code it works on both platforms. Is it normal?
Posted by Lars Strojny (lars) on 2009-12-09T19:58:09.000+0000
Thanks for your bug report. The issue has been fixed in trunk (r19564) and standard-release-1.9 (r19565).