phpxmlrpc icon indicating copy to clipboard operation
phpxmlrpc copied to clipboard

XML Parser validation of ISO8601 DateTime is stricter than the spec

Open Shags opened this issue 8 years ago • 2 comments
trafficstars

The validation requires that the DATATIME.ISO8601 data be in the YYYYMMDDTHH:MM:SS format. This is a valid ISO8601 format, but the spec allows for other formats as well. This check should be expanded to included the entire spec. See: http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/ for a possible regex that would work.

Shags avatar Feb 23 '17 18:02 Shags

Hello.

It seems that I can not find the relevant source any more, but I am pretty sure that when the discussion came up (probably on the xmlrpc mailing list) about what exactly were the date formats supported by the spec, there was clear consensus that the only valid format was the one as per the example given at http://xmlrpc.scripting.com/spec.html, and that the name 'DATATIME.ISO8601' was a bit of a misnomer.

In other words: conforming implementations are not required to support the full gamut of iso date formats.

If you are talking to a non-phpxmlrpc endpoint for the other end of your communication, and it is is sending dates in different formats, I suggest that you take it up with them...

gggeek avatar Feb 24 '17 10:02 gggeek

ps: found at least a link backing up the above: https://groups.yahoo.com/neo/groups/xml-rpc/conversations/topics/6752

gggeek avatar Feb 24 '17 10:02 gggeek

pps: I made a change, which will be in the next version (normally it should be 4.10.0), which, while not satisfying completely your request, will at least allow users, with a bit of effort, to let through dateTime values using non-conformant values: the same regular expression used to validate incoming datetimes is now used everywhere. It can be reset by the developer via changing the value of PhpXmlRpc\PhpXmlRpc::$xmlrpc_datetime_format

Feel free to reopen if this does not work / is not sufficient

gggeek avatar Jan 21 '23 17:01 gggeek