[wp-trac] [WordPress Trac] #54998: Fatal error using admin_email_check_interval filter on PHP 8.0

WordPress Trac noreply at wordpress.org
Sun Jan 30 14:02:55 UTC 2022


#54998: Fatal error using admin_email_check_interval filter on PHP 8.0
------------------------------------+------------------------------
 Reporter:  josklever               |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Login and Registration  |     Version:  5.9
 Severity:  minor                   |  Resolution:
 Keywords:                          |     Focuses:
------------------------------------+------------------------------

Comment (by costdev):

 {{{#!php
 add_filter( 'admin_email_check_interval', 0 );
 }}}

 The above is indeed incorrect usage.

 The documentation for `admin_email_check_interval` shows that:

 {{{#!php
 apply_filters( 'admin_email_check_interval', int $interval )
 }}}

 Meaning that `int $interval` is passed to your filter, not that
 `add_filter()` accepts an `int`.

 The correct usage to return `0` is:

 {{{#!php
 add_filter(
     'admin_email_check_interval',
     static function() {
         // Some logic that results in 0.
         return 0;
     }
 );
 }}}

 or, to just explicitly return 0:

 {{{#!php
 add_filter( 'admin_email_check_interval', '__return_zero' );
 }}}

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


More information about the wp-trac mailing list