[wp-trac] [WordPress Trac] #62490: doing_action wrong in shutdown

WordPress Trac noreply at wordpress.org
Wed Nov 20 20:28:28 UTC 2024


#62490: doing_action wrong in shutdown
-------------------------------------------------+-------------------------
 Reporter:  kkmuffme                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  General                              |     Version:
 Severity:  minor                                |  Resolution:
 Keywords:  has-patch has-unit-tests reporter-   |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by kkmuffme):

 >wp_die() has called exit on an earlier priority, therefore preventing
 further callbacks from firing.

 Exactly, but there is no way of me knowing that something has called
 wp_die()/exit in real-world code - I would have to always check
 "did_action( 'shutdown' )" to check that - the example is simplified,
 since I directly hooked it on "shutdown".
 Also it might be a PHP error that caused the shutdown.

 >These examples are a bit contrived though - what was it you were trying
 to do?

 They're the minimal reproducable.

 The essence is: if doing_action returns true, we can assume that we can
 hook onto it and our code will get executed. However this is not the case.
 Technically (as seen in the example) this can mean that some code is never
 executed on a hook, if another hook callback always exits before it (e.g.
 serve a file)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62490#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list