-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #44383: PHP DateTime not converted to xsd:datetime #12437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ext/date/php_date.c
Outdated
@@ -841,6 +841,11 @@ static zend_string *date_format(const char *format, size_t format_len, timelib_t | |||
return string.s; | |||
} | |||
|
|||
PHPAPI zend_string *php_format_date_ex(const char *format, size_t format_len, timelib_time *t, bool localtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would prefer it if timelib_time
does not get (more) exposed to the external API. Would it perhaps make more sense to have this function accept a php_date_obj
instead of a timelib_time
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I vaguely recall having talked about exactly that in room 11 actually.
I changed the signature and function name.
ext/soap/php_encoding.c
Outdated
if (instanceof_function_slow(Z_OBJCE_P(data), php_date_get_interface_ce())) { | ||
php_date_obj *dateobj = Z_PHPDATE_P(data); | ||
if (dateobj->time) { | ||
zend_string *formatted = php_format_date_obj(ext_date_format, ext_date_format_len, dateobj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're testing for time
here, but IMO that should be done in the new php_format_date_obj
function, which, if it returns NULL, can then else into your error message branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right of course, that makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this should add a zend_module_dependency
struct into the module entry, a bit like XMLReader:
static const zend_module_dep soap_deps[] = {
ZEND_MOD_REQUIRED("date")
ZEND_MOD_END
};
I guess so? Although date is always available. And if it were not then the module won't even load: it would fail at dlopen even before the dependencies are checked so it is a bit pointless anyway to add the dependency requirement. |
FWIW, I don't think it would fail at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ah right, I somehow forgot this was the default instead of RTLD_NOW. Thanks for reviewing. |
Fixes https://bugs.php.net/bug.php?id=44383
Marking as draft as I've asked Derick for input on the date API.