[wp-trac] [WordPress Trac] #46635: Improve identifying of non–trivial callbacks in hooks

WordPress Trac noreply at wordpress.org
Wed Apr 3 19:50:10 UTC 2019


#46635: Improve identifying of non–trivial callbacks in hooks
-------------------------+-------------------------------
 Reporter:  Rarst        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  coding-standards
-------------------------+-------------------------------

Comment (by schlessera):

 > As there doesn't seem to be a good way to remove filters and actions
 where the callback is a closure for now, I think we should add a "Doing it
 wrong" warnings so all new plugin/theme developers are aware they are
 breaking the hooks API.

 I really hope this is not what we will end up doing. This would basically
 mean that, now that we're moving Core away from PHP 5.2, we're forcing
 plugins & themes that have been doing sensible development for years back
 into PHP 5.2, for the simple reason that the hooks system is missing the
 concept of an identifier...

 Why not think about something like a `RemovableClosure( $id, $callable )`
 object instead or something along these lines. Let people decide whether
 they want to have them be removable or not. They are probably using a
 closure for a very good reason in the first place...

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


More information about the wp-trac mailing list