Skip to content

Remove unnecessary error handler replacement in SPL #6955

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 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented May 6, 2021

Document why it is needed in the remaining cases
Drive-by refactoring

I think my changes are correct, but it is a bit of a call stack hell so i might have missed a reason why it is needed.

Document why it is needed in the remaining cases
Drive-by refactoring
@@ -500,7 +499,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
RETURN_THROWS();
}

zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
Copy link
Member

Choose a reason for hiding this comment

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

getIterator() could warn -- but I agree that we shouldn't be promoting arbitrary warnings inside getIterator().

Comment on lines +2061 to +2065
if (spl_filesystem_file_open(intern, use_include_path) == FAILURE) {
zend_restore_error_handling(&error_handling);
RETURN_THROWS();
}
zend_restore_error_handling(&error_handling);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (spl_filesystem_file_open(intern, use_include_path) == FAILURE) {
zend_restore_error_handling(&error_handling);
RETURN_THROWS();
}
zend_restore_error_handling(&error_handling);
zend_result retval = spl_filesystem_file_open(intern, use_include_path);
zend_restore_error_handling(&error_handling);
if (retval == FAILURE) {
RETURN_THROWS();
}

How I'd personally write this.

@Girgias Girgias closed this in c757c61 May 7, 2021
@Girgias Girgias deleted the spl-do-not-replace-error-handler branch May 7, 2021 10:18
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