[wp-trac] [WordPress Trac] #57273: Fatal error not trapped in do_action()

WordPress Trac noreply at wordpress.org
Sun Dec 4 14:34:50 UTC 2022


#57273: Fatal error not trapped in do_action()
---------------------------+-----------------------------
 Reporter:  charlesgodwin  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:  6.1.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 I encountered a problem this week during a do_action. It was while
 processing a order complete action in WooCommerce. One of the add_action
 modules failed trying to instantiate a class. The cause has been fixed but
 the bug is:
 There was nothing in the error log and the rest of the registered actions
 did not complete, leaving a partially complete "action".

 I think the proper behaviour should be for the do_action function to wrap
 each "registered" processing a try / catch block. If it catches an error
 it logs it to the error log. After that....? is open to debate. I think
 the rest of the actions should be invoked but others might argue that the
 exception should be rethrown and nothing more takes place. I'll leave it
 to your experience to decide.

 I suspect the same behaviour in do_filter, but I have not investigated.
 we are using PHP 8.0.25

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57273>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list