[wp-trac] [WordPress Trac] #56431: Fatal Error on Update Page When a Plugin's Icon is Not Set

WordPress Trac noreply at wordpress.org
Thu Aug 25 04:41:13 UTC 2022


#56431: Fatal Error on Update Page When a Plugin's Icon is Not Set
-------------------------------------------------+-------------------------
 Reporter:  scott.deluzio                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Upgrade/Install                      |     Version:  6.0.1
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-testing php8 dev-  |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  needs-patch needs-testing php8 => needs-patch needs-testing
     php8 dev-feedback


Comment:

 In testing going as far back as WordPress 5.0, I can reproduce the Fatal
 Error on both PHP 7.4 and PHP 8.0 if I add this to `wp-admin/update.php`
 before the end of the `foreach` loop in `get_plugin_updates()`:

 {{{#!php
 $upgrade_plugins[ $plugin_file ]->update->icons = new stdClass();
 }}}

 Core expects an associative array, and the plugin mentioned in this ticket
 does actually seem to have code to enforce this. I guess something slipped
 through.

 There are two potential points of failure that I can see:
 1. There are no icons set.
 2. The icons are not set to an associative array (an object, for example).

 Wrapping the `foreach()` loop with this seems to prevent the Fatal Error
 in my testing:

 {{{#!php
 if ( isset( $plugin_data->update->icons ) && is_array(
 $plugin_data->update->icons ) ) {}
 }}}

 However, whether this is an appropriate solution (or even something Core
 should mitigate) needs more feedback. Adding `dev-feedback` to get
 additional thoughts on this.

 Removing the `Version` as this is at least back to WordPress 5.0 and the
 exact version is still to be confirmed.

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


More information about the wp-trac mailing list