Repository navigation
Conversation
Girgias
left a comment
There was a problem hiding this comment.
I do not think we should even be using zend_clear_exception.
|
What would you use instead? |
|
The C code is supposed to do the equivalent of a PHP try-catch that throws away the exception. That matches the semantics description of CATCH_GET_CHILD. |
|
I added getChildren() tests for RecursiveIteratorIterator and RecursiveCachingIterator in cc75dea. I also added one where a fiber is destroyed while it is suspended in getChildren(), so the graceful exit path has a test too. |
|
Can you please drop the NEWS change? This is something we always do ourselves when upmerging anyway, and it is blocking CI runs on this PR due to the merge conflict |
|
Done, I removed the NEWS entry in a2e52dd. |
Girgias
left a comment
There was a problem hiding this comment.
SPL is truly the gift that keeps on giving.
| } | ||
| } | ||
|
|
||
| static bool spl_can_catch_exception(void) |
There was a problem hiding this comment.
Can you pass the flags as a parameter so the !(object->flags & RIT_CATCH_GET_CHILD) logic can be moved into this function.
There was a problem hiding this comment.
Done in ed3c6f0. The function now takes the flags and checks CATCH_GET_CHILD itself, so both iterators use it the same way.
ndossche
left a comment
There was a problem hiding this comment.
I think this version is slightly worse than the version with flags separate because now it depends on this implementation detail:
php-src/ext/spl/spl_iterators.h
Line 50 in 17c806d
However, this will work, and I can't be bothered to fight over this. Probably other code already depends on this anyway
|
Merged, thanks |
With
CATCH_GET_CHILD,RecursiveIteratorIteratorandRecursiveCachingIteratorcallzend_clear_exception()on any exception thrown byhasChildren(),getChildren(),beginChildren()and friends. That also swallows the unwind exit fromexit()and the graceful exit used when destroying fibers, so the script keeps running. These exceptions are now passed through as ifCATCH_GET_CHILDwas not set.Fixes #24264