#44383 [NEW]: PHP DateTime not converted to xsd:datetime
From: kevin dot craft at gmail dot com
Operating system: Windows XP
PHP version: 5.2.5
PHP Bug Type: SOAP related
Bug description: PHP DateTime not converted to xsd:datetime
Description:
------------
When using a SoapServer object in WSDL mode, PHP DateTime objects are
converted to an empty xsd:datetime element. To produce the correct results,
DateTime objects have to be formatted as strings, which defeats the purpose
of using the SoapServer to map data types.
Environment:
------------
O/S: Windows XP
Web Server: Apache 2.2
PHP: 5.2.5 w/ GD, MySQL, and SOAP
Reproduce code:
---------------
bug.wsdl:
<?xml version ="1.0" encoding ="UTF-8" ?>
<wsdl:definitions name="GetCurrentDate"
targetNamespace="http://localhost"
xmlns:tns="http://localhost"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:message name="GetCurrentDateRequest" />
<wsdl:message name="GetCurrentDateResponse">
<wsdl:part name="currentDate" type="xsd:datetime" />
</wsdl:message>
<wsdl:portType name="GetCurrentDatePortType">
<wsdl:operation name="getCurrentDate">
<wsdl:input message="tns:GetCurrentDateRequest" />
<wsdl:output message="tns:GetCurrentDateResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GetCurrentDateBinding"
type="tns:GetCurrentDatePortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"
/>
<wsdl:operation name="getCurrentDate">
<soap:operation soapAction="http://localhost#getCurrentDate" />
<wsdl:input>
<soap:body use="encoded"
namespace="urn:xmethods-delayed-quotes"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded"
namespace="urn:xmethods-delayed-quotes"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GetCurrentDateService">
<wsdl:port name="GetCurrentDatePortType"
binding="GetCurrentDateBinding">
<soap:address location="http://localhost" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
server.php:
<?php
function getCurrentDate() {
return new DateTime();
}
$server = new SoapServer('bug.wsdl');
$server->addFunction('getCurrentDate');
$server->handle();
?>
client.php
<?php
$client = new SoapClient('bug.wsdl', array('trace' => 1));
echo 'current date: '.$client->getCurrentDate().'<br /><br
/>';
echo 'last response: '.htmlentities($client->__getLastResponse());
?>
Expected result:
----------------
Assuming the current date is 2008-03-08 23:00:00:
current date: 2008-03-06 00:00:00 (or any other format accepted by
xsd:datetime)
last response: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:xmethods-delayed-quotes"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getCurrentDateResponse><currentDate
xsi:type="xsd:datetime">2008-03-06
00:00:00</currentDate></ns1:getCurrentDateResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Actual result:
--------------
current date:
last response: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:xmethods-delayed-quotes"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getCurrentDateResponse><currentDate
xsi:type="xsd:datetime"
/></ns1:getCurrentDateResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
--
Edit bug report at http://bugs.php.net/?id=44383&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44383&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44383&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44383&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44383&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44383&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44383&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44383&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44383&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44383&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44383&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44383&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44383&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44383&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44383&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44383&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44383&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44383&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44383&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44383&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44383&r=mysqlcfg
Thread (29 messages)
- kevin dot craft at gmail dot com
- kevin dot craft at gmail dot com#44383 [Opn]: PHP DateTime not converted to xsd:datetime
- felipe@php.net#44383 [Opn]: PHP DateTime not converted to xsd:datetime
- derick@php.net#44383 [Opn]: PHP DateTime not converted to xsd:datetime
- kevin dot craft at gmail dot com#44383 [Opn]: PHP DateTime not converted to xsd:datetime
- barth at pbx-network dot de#44383 [Com]: PHP DateTime not converted to xsd:datetime
- r dot janssen at keensystems dot eu#44383 [Com]: PHP DateTime not converted to xsd:datetime
- martijn dot zijlstra at gmail dot com#44383 [Com]: PHP DateTime not converted to xsd:datetime
- jani@php.net#44383 [Opn->Fbk]: PHP DateTime not converted to xsd:datetime
- bme at hst dot aau dot dk#44383 [Com]: PHP DateTime not converted to xsd:datetime
- david dot zuelke at bitextender dot com#44383 [Com]: PHP DateTime not converted to xsd:datetime
- lsmith@php.net#44383 [NoF->Opn]: PHP DateTime not converted to xsd:datetime
- david dot zuelke at bitextender dot com#44383 [Com]: PHP DateTime not converted to xsd:datetime
- aldekein at myevil dot infoBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- frozenfire@php.netBug #44383 [Opn]: PHP DateTime not converted to xsd:datetime
- andyidol at gmail dot comBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- mj@php.netBug #44383 [Opn->Fbk]: PHP DateTime not converted to xsd:datetime
- thomas dot lallement at 9online dot frBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- php-bugs at lists dot php dot netBug #44383 [Fbk->NoF]: PHP DateTime not converted to xsd:datetime
- stefan dot giesecke at avl-investmentfonds dot deBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- eric dot dorr at de-cix dot netBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- contact at shaunoneil dot euBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- f dot rauch at outlook dot comBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- requinix@php.netBug #44383 [NoF->ReO]: PHP DateTime not converted to xsd:datetime
- hanmac at gmx dot deBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- hanmac at gmx dot deBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- nielsdos@php.netBug #44383 [ReO]: PHP DateTime not converted to xsd:datetime
- nielsdos@php.netBug #44383 [Com]: PHP DateTime not converted to xsd:datetime
- git@php.netBug #44383 [ReO->Csd]: PHP DateTime not converted to xsd:datetime