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

WordPress Trac noreply at wordpress.org
Thu Apr 4 00:00:17 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):

 Replying to [comment:19 giuseppe.mazzapica]:

 > Your class solve the issue for closures, but not for objects

 > if WordPress would generate a string representation by itself [...] that
 would require basically no change in existing users code

 I disagree. Both closures and objects already work perfectly fine. The API
 has provided a contract and expectations, and plugins/themes have built
 their code around that. They are not easily removable, and developers know
 that, and probably use it just because of it.

 All of a sudden turning non-removable code into removable code is the BC
 break that causes the users to need to change their existing plugin/theme
 code. You're all of sudden breaking the expectations, and the API behaves
 differently for a same set of input.

 What I have provided is a way to explicitly **add** a removable form of
 closures, and it is a mechanism that does not break BC or produce
 unexpected changes. The exact notation can be modeled after whatever you
 want, and you can add smart prefixing if you think that is needed. But
 most of all, it does not change the existing behavior.

 Developers have been able to write working plugins for 9 years now despite
 the fact that this was already in the "broken" state it is. Trying to fix
 that now by flipping the behavior of the existing API is what will break

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

More information about the wp-trac mailing list