-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -486,7 +486,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla | |
zval *iterator; | ||
zend_class_entry *ce_iterator; | ||
zend_long mode, flags; | ||
zend_error_handling error_handling; | ||
zval caching_it, aggregate_retval; | ||
|
||
switch (rit_type) { | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(). |
||
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { | ||
zend_function **getiterator_cache = Z_OBJCE_P(iterator)->iterator_funcs_ptr | ||
? &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator : NULL; | ||
|
@@ -525,7 +523,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); | ||
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { | ||
zend_function **getiterator_cache = Z_OBJCE_P(iterator)->iterator_funcs_ptr | ||
? &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator : NULL; | ||
|
@@ -542,7 +539,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla | |
zval_ptr_dtor(iterator); | ||
} | ||
zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0); | ||
zend_restore_error_handling(&error_handling); | ||
return; | ||
} | ||
|
||
|
@@ -592,8 +588,6 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla | |
intern->iterators[0].haschildren = NULL; | ||
intern->iterators[0].getchildren = NULL; | ||
|
||
zend_restore_error_handling(&error_handling); | ||
|
||
if (EG(exception)) { | ||
zend_object_iterator *sub_iter; | ||
|
||
|
@@ -1382,11 +1376,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z | |
return NULL; | ||
} | ||
intern->dit_type = DIT_AppendIterator; | ||
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); | ||
object_init_ex(&intern->u.append.zarrayit, spl_ce_ArrayIterator); | ||
zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); | ||
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0); | ||
zend_restore_error_handling(&error_handling); | ||
return intern; | ||
case DIT_RegexIterator: | ||
case DIT_RecursiveRegexIterator: { | ||
|
@@ -1405,6 +1397,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z | |
return NULL; | ||
} | ||
|
||
/* pcre_get_compiled_regex_cache() might emit E_WARNINGs that we want to promote to exception */ | ||
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); | ||
intern->u.regex.pce = pcre_get_compiled_regex_cache(regex); | ||
zend_restore_error_handling(&error_handling); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How I'd personally write this.