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

WordPress Trac noreply at wordpress.org
Wed Apr 3 07:14:19 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 Rarst):

 >  On the other hand, not storing upfront means that removing will be
 quite expensive having to loop the potential dozen of callbacks added to a
 given hook, and using Reflection anytime a closure is encountered.

 I am fine with removal being more expensive operation. And to be clear I
 am suggesting we explore path as ''one'' of the ways of identifying, not
 the ''only'' way. So if broad `function()` match is good enough then it
 can be just used without doing paths lookup.

 > For me, the best scenario is when the developer can pass an unique
 identifier for the closure

 While this would have made sense if it was baked into API ''from the
 start'', I feel it is a weak as an optional addition to a very established
 one. It simply doesn't help the case when developer doesn't add an
 identifier and we are back to square one. We do ''need'' to improve
 removal for current state of API.

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


More information about the wp-trac mailing list