[wp-trac] [WordPress Trac] #62542: TypeError in class-wp-plugins-list-table.php due to invalid $time value.

WordPress Trac noreply at wordpress.org
Sat Nov 23 00:19:06 UTC 2024


#62542: TypeError in class-wp-plugins-list-table.php due to invalid $time value.
--------------------------+------------------------------
 Reporter:  azora         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Plugins       |     Version:  6.7.1
 Severity:  critical      |  Resolution:
 Keywords:  needs-patch   |     Focuses:  administration
--------------------------+------------------------------
Changes (by sabernhardt):

 * focuses:   => administration
 * component:  General => Plugins


Old description:

> A fatal error occurred due to the latest update and is causing problems
> in the database. Even after I disabled all plugins and installed older
> wordpress versions, the problem remains due to the cron.
>

> [22-Nov-2024 22:43:55 UTC] PHP Notice:  Function
> _load_textdomain_just_in_time was called <strong>incorrectly</strong>.
> Translation loading for the <code>astra</code> domain was triggered too
> early. This is usually an indicator for some code in the plugin or theme
> running too early. Translations should be loaded at the <code>init</code>
> action or later. Please see <a href="https://developer.wordpress.org
> /advanced-administration/debug/debug-wordpress/">Debugging in
> WordPress</a> for more information. (This message was added in version
> 6.7.0.) in /var/www/vhosts/civitaic.com/httpdocs/wp-
> includes/functions.php on line 6114
> [22-Nov-2024 22:43:55 UTC] PHP Notice:  Function
> _load_textdomain_just_in_time was called <strong>incorrectly</strong>.
> Translation loading for the <code>astra</code> domain was triggered too
> early. This is usually an indicator for some code in the plugin or theme
> running too early. Translations should be loaded at the <code>init</code>
> action or later. Please see <a href="https://developer.wordpress.org
> /advanced-administration/debug/debug-wordpress/">Debugging in
> WordPress</a> for more information. (This message was added in version
> 6.7.0.) in /var/www/vhosts/civitaic.com/httpdocs/wp-
> includes/functions.php on line 6114
> [22-Nov-2024 22:43:55 UTC] PHP Fatal error:  Uncaught TypeError:
> Unsupported operand types: string + int in
> /var/www/vhosts/civitaic.com/httpdocs/wp-admin/includes/class-wp-plugins-
> list-table.php:189
> Stack trace:
> #0 /var/www/vhosts/civitaic.com/httpdocs/wp-admin/plugins.php(553):
> WP_Plugins_List_Table->prepare_items()
> #1 {main}
>   thrown in /var/www/vhosts/civitaic.com/httpdocs/wp-admin/includes
> /class-wp-plugins-list-table.php on line 189
>

> The error comes from this function:
>
> foreach ( $recently_activated as $key => $time ) {
>                         if ( $time + WEEK_IN_SECONDS < time() ) {
>                                 unset( $recently_activated[ $key ] );
>                         }
>                 }
>
> My correction:
> foreach ( $recently_activated as $key => $time ) {
>     if ( (int) $time + WEEK_IN_SECONDS < time() ) {
>         unset( $recently_activated[ $key ] );
>     }
> }
>
> The problem has been fixed for me.

New description:

 A fatal error occurred due to the latest update and is causing problems in
 the database. Even after I disabled all plugins and installed older
 wordpress versions, the problem remains due to the cron.

 {{{
 [22-Nov-2024 22:43:55 UTC] PHP Notice:  Function
 _load_textdomain_just_in_time was called <strong>incorrectly</strong>.
 Translation loading for the <code>astra</code> domain was triggered too
 early. This is usually an indicator for some code in the plugin or theme
 running too early. Translations should be loaded at the <code>init</code>
 action or later. Please see <a href="https://developer.wordpress.org
 /advanced-administration/debug/debug-wordpress/">Debugging in
 WordPress</a> for more information. (This message was added in version
 6.7.0.) in /.../wp-includes/functions.php on line 6114
 [22-Nov-2024 22:43:55 UTC] PHP Notice:  Function
 _load_textdomain_just_in_time was called <strong>incorrectly</strong>.
 Translation loading for the <code>astra</code> domain was triggered too
 early. This is usually an indicator for some code in the plugin or theme
 running too early. Translations should be loaded at the <code>init</code>
 action or later. Please see <a href="https://developer.wordpress.org
 /advanced-administration/debug/debug-wordpress/">Debugging in
 WordPress</a> for more information. (This message was added in version
 6.7.0.) in /.../wp-includes/functions.php on line 6114

 [22-Nov-2024 22:43:55 UTC] PHP Fatal error:  Uncaught TypeError:
 Unsupported operand types: string + int in /.../wp-admin/includes/class-
 wp-plugins-list-table.php:189
 Stack trace:
 #0 /.../wp-admin/plugins.php(553): WP_Plugins_List_Table->prepare_items()
 #1 {main}
   thrown in /.../wp-admin/includes/class-wp-plugins-list-table.php on line
 189
 }}}

 The error comes from this function:
 {{{
 foreach ( $recently_activated as $key => $time ) {
     if ( $time + WEEK_IN_SECONDS < time() ) {
         unset( $recently_activated[ $key ] );
     }
 }
 }}}
 My correction:
 {{{
 foreach ( $recently_activated as $key => $time ) {
     if ( (int) $time + WEEK_IN_SECONDS < time() ) {
         unset( $recently_activated[ $key ] );
     }
 }
 }}}
 The problem has been fixed for me.

--

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


More information about the wp-trac mailing list