Skip to content

Document restore_exception_handler behavior change in PHP 8.3.5 - #5222

Merged
lacatoire merged 1 commit into
php:masterfrom
lacatoire:doc/exception-handler-behavior-php84
Aug 25, 2026
Merged

Document restore_exception_handler behavior change in PHP 8.3.5#5222
lacatoire merged 1 commit into
php:masterfrom
lacatoire:doc/exception-handler-behavior-php84

Conversation

@lacatoire

@lacatoire lacatoire commented Jan 30, 2026

Copy link
Copy Markdown
Member

Document the current exception handler stack behavior, which changed in two steps.

Since PHP 8.3.0 the engine unsets the active handler before invoking it, so no handler is active while one runs. Since PHP 8.3.5 it also pushes the handler it is about to invoke onto the handler stack, and re-installs it once it returns, but only if no handler is active at that point. Consequences documented on both pages:

  • restore_exception_handler() called from within a handler re-installs the handler that is currently running, so restoring the handler that was active before it requires two calls;
  • as soon as the handler calls set_exception_handler() or restore_exception_handler(), the automatic restoration is skipped and the handler is left in charge of the stack.

Verified against the official CLI images: 7.4.33, 8.1.34, 8.2.28 and 8.3.4 show the previous behavior, 8.3.6, 8.4.24 and 8.5.4 the new one. The change is not present in the 8.2 branch.

Also unwraps the <simplelist> of both seealso sections from its <para>.

Sources

Fixes #5102

@lacatoire lacatoire closed this Mar 2, 2026
@lacatoire lacatoire reopened this Aug 21, 2026
@lacatoire
lacatoire force-pushed the doc/exception-handler-behavior-php84 branch 2 times, most recently from b3719be to 8f99e17 Compare August 21, 2026 10:04
@lacatoire lacatoire changed the title Document restore_exception_handler behavior change in PHP 8.4 Document restore_exception_handler behavior change in PHP 8.3.5 Aug 25, 2026
@lacatoire
lacatoire force-pushed the doc/exception-handler-behavior-php84 branch from c08ae5d to 3aed4a2 Compare August 25, 2026 09:22
@lacatoire
lacatoire merged commit 1cc803a into php:master Aug 25, 2026
2 checks passed
@lacatoire
lacatoire deleted the doc/exception-handler-behavior-php84 branch August 25, 2026 09:24
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.

Document new exception handler behavior since 3301d96

1 participant