[wp-trac] [WordPress Trac] #57213: Coding standards : Use Strict Comparison except Loose Comparison wp-includes/class-wp-hook.php

WordPress Trac noreply at wordpress.org
Mon Dec 29 22:19:46 UTC 2025


#57213: Coding standards : Use Strict Comparison except Loose Comparison wp-
includes/class-wp-hook.php
--------------------------+-------------------------------
 Reporter:  rockonshajib  |       Owner:  (none)
     Type:  enhancement   |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.7
 Severity:  normal        |  Resolution:  duplicate
 Keywords:  has-patch     |     Focuses:  coding-standards
--------------------------+-------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:11 SirLouen]:
 > Anyway, time to close this as it has been already fixed, and I wonder if
 there is a risk that `$the_['accepted_args']` could be a noninteger (which
 shouldn't).
 >
 > For more info I've tried this simple code
 >
 > {{{
 > function hide_admin_bar() {
 >     return false;
 > }
 >
 > add_filter('show_admin_bar', 'hide_admin_bar', 10, '0');
 > }}}
 >
 > Just to showcase a string `accepted_args`, which theoretically should
 fail on the `0 ===` comparison, and it works! At some point, it appears
 that it's converted to 0 int…

 Thanks! Somehow I missed this ticket while working on [56511] / #58831.

 For reference, it works because the same commit contains an early `(int)`
 casting in `::add_filter()`, see [source:trunk/src/wp-includes/class-wp-
 hook.php?rev=56511&marks=81#L74 line 81].

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


More information about the wp-trac mailing list