Skip to content

Cleanup return values for Intl when parameter parsing is unsuccessful #4871

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

Closed
wants to merge 2 commits into from

Conversation

kocsismate
Copy link
Member

No description provided.

return;
}

if (convert_cp(&cp, zcp) == FAILURE) {
RETURN_NULL();
Copy link
Member Author

Choose a reason for hiding this comment

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

or should I just stay with return;? 🤔

@@ -87,7 +87,6 @@ static void _php_intlgregcal_constructor_body(
"|z!s!", &tz_object, &locale, &locale_len) == FAILURE) {
if (!is_constructor) {
zval_ptr_dtor(return_value);
RETVAL_NULL();
Copy link
Member

Choose a reason for hiding this comment

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

This needs to stay, otherwise you may get double frees. Same below.

Copy link
Member

Choose a reason for hiding this comment

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

Or alternatively, you can drop the whole if (!is_constructor) { ... } block.

Copy link
Member

Choose a reason for hiding this comment

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

I've done this as part of e0be51d.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! It is much better what I could have done ^^ Now, I am rebasing and fixing the other issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done (although there is a test issue with fileowner on ARM).

}

if (index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
RETURN_NULL();
Copy link
Member

Choose a reason for hiding this comment

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

Should be RETURN_FALSE to preserve previous behavior (for now).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes. It was an oversight.

@php-pulls php-pulls closed this in 969e7a3 Oct 30, 2019
@kocsismate kocsismate deleted the intl-return branch October 30, 2019 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants