Hi folks,
attached is a patch (with the respective test cases) that implements
DateTime marshalling from and to xsd:dateTime in ext/soap as requested
in http://bugs.php.net/44383
Right now, it is implemented for xsd:date, xsd:time and xsd:dateTime,
but not for other types defined in W3C XML Schema such as gDayMonth; I
don't really think it makes sense mapping from and to DateTimes in
this case (from DateTime to gDayMonth would work, but the other way
round would prove rather difficult).
Some notes about this patch:
- it conforms strictly to the XML Schema specification by only
producing canonical representations of values when generating
xsd:dateTime and xsd:time values. Specifically:- it will not generate trailing zeroes on microseconds (in other
words, it simply generates a fractional second part as mandated by the
specification), but it will accept such values - UTC is always used as the timezone (one of the tests in ext/date/
tests that mirrors SBR1-echoDate from http://www.w3.org/TR/2007/REC-soap12-testcollection-20070427/#SBR1-echoDate
currently does this wrong), but it will accept any timezone
- it will not generate trailing zeroes on microseconds (in other
- xsd:time produces current date when generating a DateTime object
- xsd:date is relatively straightfoward as well:
- produces "00:00:00" as the time when creating a DateTime object
- accepts any time when parsing
- also supports timezones
- as a side effect of the patch, microseconds are now supported in
time values (for xsd:time and xsd:dateTime), hence the removed comment
in to_xml_time
The tests have several permutations, but all but one is commented out
each. The test_schema() function does some odd (but understandable)
stunts with output buffering and global variables that make it
impossible to test more than one case at a time. We didn't want to
produce a million test files for the several variants; is there a
nicer way to test this properly?
This feature is enabled by a SoapClient "feature" called
SOAP_MARSHAL_DATETIME. I think this is a reasonable choice.
Greetings,
David
bump
Dmitry, did you have a chance to review this patch yet?
- David
Hi folks,
attached is a patch (with the respective test cases) that implements
DateTime marshalling from and to xsd:dateTime in ext/soap as
requested in http://bugs.php.net/44383Right now, it is implemented for xsd:date, xsd:time and
xsd:dateTime, but not for other types defined in W3C XML Schema such
as gDayMonth; I don't really think it makes sense mapping from and
to DateTimes in this case (from DateTime to gDayMonth would work,
but the other way round would prove rather difficult).Some notes about this patch:
- it conforms strictly to the XML Schema specification by only
producing canonical representations of values when generating
xsd:dateTime and xsd:time values. Specifically:- it will not generate trailing zeroes on microseconds (in other
words, it simply generates a fractional second part as mandated by
the specification), but it will accept such values- UTC is always used as the timezone (one of the tests in ext/date/
tests that mirrors SBR1-echoDate from http://www.w3.org/TR/2007/REC-soap12-testcollection-20070427/#SBR1-echoDate
currently does this wrong), but it will accept any timezone- xsd:time produces current date when generating a DateTime object
- xsd:date is relatively straightfoward as well:
- produces "00:00:00" as the time when creating a DateTime object
- accepts any time when parsing
- also supports timezones
- as a side effect of the patch, microseconds are now supported in
time values (for xsd:time and xsd:dateTime), hence the removed
comment in to_xml_timeThe tests have several permutations, but all but one is commented
out each. The test_schema() function does some odd (but
understandable) stunts with output buffering and global variables
that make it impossible to test more than one case at a time. We
didn't want to produce a million test files for the several
variants; is there a nicer way to test this properly?This feature is enabled by a SoapClient "feature" called
SOAP_MARSHAL_DATETIME. I think this is a reasonable choice.Greetings,
David
<
schema089
.phpt<
soap_marshal_datatype
.diff
.txt<
schema087
.phpt><schema088.phpt><schema086.phpt><schema090.phpt><schema091.phpt
Hi David,
I took only a quick look, but I like the patch.
In case it doesn't break any tests, it should be committed at least into
HEAD. I agree to commit it into 5.3 too, but RMs take the final decision.
The only thing I didn't understood - why win32/php_stdint.h is needed.
Thanks. Dmitry.
David Zülke wrote:
bump
Dmitry, did you have a chance to review this patch yet?
- David
Hi folks,
attached is a patch (with the respective test cases) that implements
DateTime marshalling from and to xsd:dateTime in ext/soap as requested
in http://bugs.php.net/44383Right now, it is implemented for xsd:date, xsd:time and xsd:dateTime,
but not for other types defined in W3C XML Schema such as gDayMonth; I
don't really think it makes sense mapping from and to DateTimes in
this case (from DateTime to gDayMonth would work, but the other way
round would prove rather difficult).Some notes about this patch:
- it conforms strictly to the XML Schema specification by only
producing canonical representations of values when generating
xsd:dateTime and xsd:time values. Specifically:- it will not generate trailing zeroes on microseconds (in other
words, it simply generates a fractional second part as mandated by the
specification), but it will accept such values- UTC is always used as the timezone (one of the tests in
ext/date/tests that mirrors SBR1-echoDate from
http://www.w3.org/TR/2007/REC-soap12-testcollection-20070427/#SBR1-echoDate currently
does this wrong), but it will accept any timezone- xsd:time produces current date when generating a DateTime object
- xsd:date is relatively straightfoward as well:
- produces "00:00:00" as the time when creating a DateTime object
- accepts any time when parsing
- also supports timezones
- as a side effect of the patch, microseconds are now supported in
time values (for xsd:time and xsd:dateTime), hence the removed comment
in to_xml_timeThe tests have several permutations, but all but one is commented out
each. The test_schema() function does some odd (but understandable)
stunts with output buffering and global variables that make it
impossible to test more than one case at a time. We didn't want to
produce a million test files for the several variants; is there a
nicer way to test this properly?This feature is enabled by a SoapClient "feature" called
SOAP_MARSHAL_DATETIME. I think this is a reasonable choice.Greetings,
David
<schema089.phpt><soap_marshal_datatype.diff.txt><schema087.phpt><schema088.phpt><schema086.phpt><schema090.phpt><schema091.phpt
Hi David,
I took only a quick look, but I like the patch.
In case it doesn't break any tests, it should be committed at least
into
HEAD. I agree to commit it into 5.3 too, but RMs take the final
decision.The only thing I didn't understood - why win32/php_stdint.h is needed.
Ah, yes, that's probably an oversight. Good catch. The headers were
copy-pasted from some ext/date file :)
Another thing that just occured to me is that we now have a dependency
on ext/date; I think I had trouble compiling ext/soap as a standalone
extension like this. Must check again. Any hints?
- David
David Zülke wrote:
Hi David,
I took only a quick look, but I like the patch.
In case it doesn't break any tests, it should be committed at least into
HEAD. I agree to commit it into 5.3 too, but RMs take the final decision.The only thing I didn't understood - why win32/php_stdint.h is needed.
Ah, yes, that's probably an oversight. Good catch. The headers were
copy-pasted from some ext/date file :)Another thing that just occured to me is that we now have a dependency
on ext/date; I think I had trouble compiling ext/soap as a standalone
extension like this. Must check again. Any hints?
I think ext/date can't be removed or compiled as shared extension.
If it's the case, the only problem may be with unexported symbols.
Just try to compile/test it as shared extension on Linux and Windows.
Thanks. Dmitry.
- David