[wp-trac] [WordPress Trac] #44582: Notice: Undefined property:stdClass::$plugin - wordpress

WordPress Trac noreply at wordpress.org
Tue Dec 4 22:11:01 UTC 2018


#44582: Notice: Undefined property:stdClass::$plugin - wordpress
-------------------------------+------------------------------
 Reporter:  sangwan4pankaj     |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Plugins            |     Version:  4.9.7
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by rogerlos):

 * component:  General => Plugins


Comment:

 I have just had this pop-up in my local wordpress install, when visiting
 the "wp-admin/plugin-install.php".

 I believe this is caused by a "rogue" plugin which has a very different
 object registered with `$installed_plugins`. In this case the "rogue"
 plugin is SearchWP--actually quite good bit of kit, aside from the fact
 that my windows dev box still cannot install upgrades of it because of the
 deeply nested structure and super-long filenames, but that is another
 ticket (#40795)...

 If I `var_dump` `installed_plugins` at line 252, I get a fairly neat (as
 in tidy) array where every plugin's object follows this pattern (using
 CMB2 as an example):
 {{{
 'cmb2' =>
     object(stdClass)[1931]
       public 'id' => string 'w.org/plugins/cmb2' (length=18)
       public 'slug' => string 'cmb2' (length=4)
       public 'plugin' => string 'cmb2/init.php' (length=13)
       public 'new_version' => string '2.4.2' (length=5)
       public 'url' => string 'https://wordpress.org/plugins/cmb2/'
 (length=35)
       public 'package' => string
 'https://downloads.wordpress.org/plugin/cmb2.zip' (length=47)
       public 'icons' =>
         array (size=2)
           '2x' => string 'https://ps.w.org/cmb2/assets/icon-
 256x256.png?rev=1081087' (length=57)
           '1x' => string 'https://ps.w.org/cmb2/assets/icon-
 128x128.png?rev=1081087' (length=57)
       public 'banners' =>
         array (size=2)
           '2x' => string 'https://ps.w.org/cmb2/assets/banner-
 1544x500.png?rev=1081087' (length=60)
           '1x' => string 'https://ps.w.org/cmb2/assets/banner-
 772x250.png?rev=1081087' (length=59)
       public 'banners_rtl' =>
         array (size=0)
           empty
       public 'upgrade' => boolean false
 }}}

 Until we get to SearchWP, in this case version 2.9.13, where the object
 for it looks like this:

 {{{
 'searchwp' =>
     object(stdClass)[1924]
       public 'new_version' => string '2.9.17' (length=6)
       public 'stable_version' => string '2.9.17' (length=6)
       public 'name' => string 'SearchWP' (length=8)
       public 'slug' => string 'searchwp' (length=8)
       public 'url' => string
 'https://searchwp.com/downloads/searchwp/?changelog=1' (length=52)
       public 'last_updated' => string '2018-11-27 08:30:24' (length=19)
       public 'homepage' => string
 'https://searchwp.com/downloads/searchwp/' (length=40)
       public 'package' => string 'https://searchwp.com/edd-
 sl/package_download/MTU0NDA3MDIwMjozMWViMDdmNDAzNzVhY2E3ZDE3Zjc2MWFlNjBkN2NkNzo4OjVmODVkNTAxZmQzMTI1NWUzYzc4Njc2ODdkNDU4NmJlOmh0dHBALy9wcGEubG9jYWw6MA=='
 (length=177)
       public 'download_link' => string 'https://searchwp.com/edd-
 sl/package_download/MTU0NDA3MDIwMjozMWViMDdmNDAzNzVhY2E3ZDE3Zjc2MWFlNjBkN2NkNzo4OjVmODVkNTAxZmQzMTI1NWUzYzc4Njc2ODdkNDU4NmJlOmh0dHBALy9wcGEubG9jYWw6MA=='
 (length=177)
       public 'sections' =>
         object(stdClass)[1925]
           public 'description' => string '' (length=0)
           public 'changelog' => string '<p>2.9.17</p>'... (length=83111)
       public 'banners' =>
         object(stdClass)[1926]
           public 'high' => string '' (length=0)
           public 'low' => string '' (length=0)
       public 'icons' => string 'a:0:{}' (length=6)
       public 'description' =>
         array (size=1)
           0 => string '' (length=0)
       public 'changelog' =>
         array (size=1)
           0 => string '<p>2.9.17</p>'... (length=83111)
       public 'upgrade' => boolean true
 }}}

 There is no `plugin` property in this array, which is triggering the
 exception.

 Here are the notices themselves:
 {{{
 ( ! ) Notice: Undefined property: stdClass::$plugin in
 C:\wamp\www\wordpress\wp\wp-includes\class-wp-list-util.php on line 150
 Call Stack
 #       Time    Memory  Function        Location
 1       0.0008  396152  {main}( )       ...\plugin-install.php:0
 2       1.8819  55825728
 WP_Plugin_Install_List_Table->prepare_items( )  ...\plugin-install.php:39
 3       2.3318  56485400        wp_list_pluck( )        ...\class-wp-
 plugin-install-list-table.php:253
 4       2.3318  56485552        WP_List_Util->pluck( )
 ...\functions.php:3662

 ( ! ) Notice: Undefined property: stdClass::$plugin in
 C:\wamp\www\wordpress\wp\wp-includes\class-wp-list-util.php on line 150
 Call Stack
 #       Time    Memory  Function        Location
 1       0.0008  396152  {main}( )       ...\plugin-install.php:0
 2       1.8819  55825728
 WP_Plugin_Install_List_Table->prepare_items( )  ...\plugin-install.php:39
 3       2.3401  56486504        wp_filter_object_list( )        ...\class-
 wp-plugin-install-list-table.php:254
 4       2.3401  56487032        WP_List_Util->pluck( )
 ...\functions.php:3612
 }}}
 I guess while this seems like a plugin-specific issue (I have no idea if
 the original poster was also working with SearchWP), either a plugin
 should not be included in this array without at least doing a check of the
 object properties, or perhaps the list pluck utility needs to do a check
 to see if the property exists before trying to grab it. SearchWP was
 otherwise able to be activated, and if that's the case I would not expect
 a plugin which passes that "test" to cause an error on the "install
 plugins" page.

 Note that disabling the plugin does not make this go away (I assume that
 the purpose on this install screen is to hide or otherwise indicate to
 users plugins that may already be installed, so it makes sense that
 disabling this without uninstalling it would still cause the error.)

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


More information about the wp-trac mailing list