Skip to content

Fix #44383: PHP DateTime not converted to xsd:datetime - #12437

Closed
ndossche wants to merge 4 commits into
php:masterfrom
ndossche:fix-44383
Closed

ndossche wants to merge 4 commits into
php:masterfrom
ndossche:fix-44383

Conversation

@ndossche

Copy link
Copy Markdown
Member

Fixes https://bugs.php.net/bug.php?id=44383
Marking as draft as I've asked Derick for input on the date API.

Comment thread ext/date/php_date.c Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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.

@ndossche
ndossche marked this pull request as ready for review November 22, 2023 18:37
Comment thread 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);

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

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
};

@ndossche

Copy link
Copy Markdown
Member Author

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.
But I'll add it anyway for completeness.

@derickr

derickr commented Dec 8, 2023

Copy link
Copy Markdown
Member

FWIW, I don't think it would fail at dlopen(), unless we've changed away from RTLD_LAZY.

@derickr derickr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndossche ndossche closed this in b34b4d5 Dec 8, 2023
@ndossche

ndossche commented Dec 8, 2023

Copy link
Copy Markdown
Member Author

FWIW, I don't think it would fail at dlopen(), unless we've changed away from RTLD_LAZY.

Ah right, I somehow forgot this was the default instead of RTLD_NOW.

Thanks for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants