|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-27 18:54 UTC] stuart at myrddraal dot demon dot co dot uk
The XML-RPC Extension does not correctly cope with dates before the Epoch (ie, anything which won't go into time_t). This bug prevents the XML-RPC Extension passing the XML-RPC verification suite, which can be found at http://validator.xmlrpc.com/ The following example code demonstrates the fault. <?php $l_szDate = "19040401T19:01:02"; xmlrpc_set_type ($l_szDate, "datetime"); echo xmlrpc_encode_request(null, $l_szDate); ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
What are you talking about? PHP handles negative time_t's perfectly. Try this: $t = -987654321; echo date("M d Y H:i:s",$t); You will see it outputs: Sep 14 1938 11:34:39Hi Rasmus, Sorry, my mistake. But what about converting back the otherway? echo mktime("11", "34", "39", "14", "09", "1938"); produces -1, not -987654321. strtodate() does no better. PHP's handling of time_t is not the issue. time_t itself is the issue. Negative time_t's won't be generated by the underlying libc. If you try, you get an error back. The XML-RPC Extension does not trap this error. It replaces the valid dateTime valid with the error code. The Extension can *corrupt* data sent over XML-RPC. That's why it currently does not pass the XML-RPC Validator tests. And there isn't an alternative to time_t for the Extension to use. (From the strtodate() PHP manual page:) Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. UNIX timestamps start at 0 for the Epoc (0:00:00 1st Jan 1970). The manual page is wrong. Best regards, Stu