Are nested terminating
callbacks a "supported" use case?
#50713
-
In other words, is registering terminating callaback inside terminating callback supposed to work, or just works accidentaly? \App::terminating(function () {
\Log::info('Terminating');
\App::terminating(function() {
\Log::info('Post Terminating');
});
}) output:
This looks like a bit risky thing to do and seems to rely just on the fact that while ($index < count($this->terminatingCallbacks)) {
$this->call($this->terminatingCallbacks[$index]);
$index++;
} Since just extracting The use case is that I want to log some stats about each request, but the request can add some post processing with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Interesting. If no one uses it like this, I would vote to avoid this case or maybe find a way to restrict it to a maximum of 10 loops or something. |
Beta Was this translation helpful? Give feedback.
-
Yes, this was added intentionally. |
Beta Was this translation helpful? Give feedback.
Yes, this was added intentionally.
See: #39175