mirror of
https://github.com/php/php-src.git
synced 2024-09-27 21:07:25 +00:00
02dca18b90
I'm not exactly sure whether this is the right way to fix it. The question is whether Generator::throw() on a newborn generator (i.e. a generator that is not yet at yield expression) should first advance to the first yield and throw the exception there or whether it should instead throw the exception in the caller's context. The old behavior was to throw it at the start of the function (i.e. the very first opcode), which causes issues like the one in #65764. Effectively it's impossible to properly handle the exceptions in this case. For now I choose the variant where the generator advances to the first yield before throwing, as that's consistent with how all other methods on the Generator object currently behave. This does not necessarily match the behavior in other languages, e.g. Python would throw the exception in the caller's context. But then our send() method already has this kind of deviation, so it stays internally consistent at least. |
||
---|---|---|
.. | ||
errors | ||
finally | ||
auto_incrementing_keys.phpt | ||
backtrace.phpt | ||
bug63066.phpt | ||
bug65035.phpt | ||
bug65161.phpt | ||
bug66041.phpt | ||
clone.phpt | ||
dynamic_call.phpt | ||
fibonacci.phpt | ||
func_get_args.phpt | ||
generator_closure_with_this.phpt | ||
generator_closure.phpt | ||
generator_in_multipleiterator.phpt | ||
generator_method_by_ref.phpt | ||
generator_method.phpt | ||
generator_returns_generator.phpt | ||
generator_rewind.phpt | ||
generator_send.phpt | ||
generator_static_method.phpt | ||
generator_throwing_during_function_call.phpt | ||
generator_throwing_exception.phpt | ||
generator_throwing_in_foreach.phpt | ||
generator_with_keys.phpt | ||
generator_with_nonscalar_keys.phpt | ||
ignored_send_leak.phpt | ||
nested_calls_with_die.phpt | ||
nested_method_calls.phpt | ||
no_foreach_var_leaks.phpt | ||
send_after_close.phpt | ||
send_returns_current.phpt | ||
throw_already_closed.phpt | ||
throw_caught.phpt | ||
throw_not_an_exception.phpt | ||
throw_rethrow.phpt | ||
throw_uncaught.phpt | ||
unused_return_value.phpt | ||
xrange.phpt | ||
yield_array_key.phpt | ||
yield_array_offset_by_ref.phpt | ||
yield_by_reference.phpt | ||
yield_closure.phpt | ||
yield_during_function_call.phpt | ||
yield_during_method_call.phpt | ||
yield_in_finally.phpt | ||
yield_in_parenthesis.phpt | ||
yield_ref_function_call_by_reference.phpt | ||
yield_without_value.phpt |