Generated with the help of an LLM.
Problem/Motivation
DatabaseUpdate::doOne() and update_invoke_post_update() catch \Exception only. When a hook_update_N() or hook_post_update_NAME() implementation throws a PHP \Error (a TypeError, a call to an undefined function, etc.), it is not logged or recorded in the batch results as an aborted update. It propagates out of the batch, so update.php and CLI runners get a fatal error instead of the usual "Failed: ..." report, and dependent updates are not marked as aborted.
Steps to reproduce
Add an update hook containing throw new \TypeError('x'); and run database updates.
Proposed resolution
Catch \Throwable in both runners. Error::decodeException() already accepts \Throwable, so the logging and #abort handling work unchanged.
API changes
None. Errors thrown by update functions are now reported the same way as exceptions.
Data model changes
None.
User interface changes
None.
Issue fork drupal-3638109
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
moshe weitzman commented