[wp-trac] [WordPress Trac] #51525: Add new functions apply_filters_single_type() and apply_filters_ref_array_single_type()

WordPress Trac noreply at wordpress.org
Thu Nov 21 19:39:40 UTC 2024


#51525: Add new functions apply_filters_single_type() and
apply_filters_ref_array_single_type()
-------------------------------------------------+-------------------------
 Reporter:  jrf                                  |       Owner:  (none)
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php8.x early has-patch has-unit-     |     Focuses:
  tests close                                    |
-------------------------------------------------+-------------------------

Comment (by tabrisrp):

 While I understand where you're coming from and your reasons, we made the
 choice to invest time into working on this ticket because it is solving a
 problem that was recurring often enough in our case to we felt it would be
 worth it.

 For context, we have one of our plugins installed on more than 4 million
 websites, which gives us a good sample.

 Errors related to types happened pretty much anytime we tried to be strict
 about it for action/filter callbacks. The most problematic thing is that
 the reported error will point out to our plugin, not the plugin misusing
 the filter values to begin with, so the burden ends up being on our
 support and development team. It's not hard to debug, but with our volume
 it's an unnecessary waste of time.

 If I were to search in our support history about it, I could probably
 bring a good dozen of examples, the latest happening last month.


 Related to your point 3, since any return typehint related to filters
 can't be trusted, we have to add necessary type checking inside the plugin
 methods, so the performance impact ends up being delayed to a difference
 place anyway.

 In any case, we believe the idea of stricter filters is beneficial, and
 using our library in our plugins is already helping us. That's why we
 wanted to share this with core.

 If the final decision ends up to closing it without going further, it will
 be disappointing, but it would be good to have a clear voice on this, as
 the feedback I got yesterday on Slack was to have someone from core
 sponsor this for 6.8?

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


More information about the wp-trac mailing list