cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

Satispress breaks when updating plugins with incorrect version number format #115

Closed koengabriels closed 4 years ago

koengabriels commented 4 years ago

When trying to update the plugins made available through Satispress we encountered the following error messsage:

#0 /sites/plugins.appsaloon.be/files/wp-includes/class-wp-hook.php(286): SatisPress\Provider\Capabilities->map_meta_cap(Array, NULL, 0, Array)
#1 /sites/plugins.appsaloon.be/files/wp-includes/plugin.php(208): WP_Hook->apply_filters(Array, Array)
#2 /sites/plugins.appsaloon.be/files/wp-includes/capabilities.php(614): apply_filters('map_meta_cap', Array, NULL, 0, Array)
#3 /sites/plugins.appsaloon.be/files/wp-includes/class-wp-user.php(740): map_meta_cap(NULL, 0)
#4 /sites/plugins.appsaloon.be/files/wp-includes/capabilities.php(649): WP_User->has_cap(NULL)
#5 /sites/plugins.appsaloon.be/files/wp-includes/post.php(3509): current_user_can(NULL)
#6 /sites/plugins.appsaloon. in /sites/plugins.appsaloon.be/files/wp-content/plugins/satispress-0.5.0/src/Provider/Capabilities.php on line 41
[13-Nov-2019 16:06:07 UTC] PHP Notice:  Trying to get property 'cap' of non-object in /sites/plugins.appsaloon.be/files/wp-includes/post.php on line 3509
[13-Nov-2019 16:06:07 UTC] PHP Notice:  Trying to get property 'publish_posts' of non-object in /sites/plugins.appsaloon.be/files/wp-includes/post.php on line 3509
[13-Nov-2019 16:06:07 UTC] PHP Fatal error:  Uncaught TypeError: Argument 2 passed to SatisPress\Provider\Capabilities::map_meta_cap() must be of the type string, null given, called in /sites/plugins.appsaloon.be/files/wp-includes/class-wp-hook.php on line 286 and defined in /sites/plugins.appsaloon.be/files/wp-content/plugins/satispress-0.5.0/src/Provider/Capabilities.php:41

As it turns out some plugins had an incorrect version number format. Would be great if Satispress ignored these plugins instead of breaking, we had to manually figure out which plugins were causing issues and remove them.

bradyvercher commented 4 years ago

I'm not quite sure what's going on here. Based on that error message, current_user_can() is being called with NULL as an argument somewhere. Do you know where that's happening or how an invalid version number is causing that?

koengabriels commented 4 years ago

Tbh I have no idea where that null is coming from. If I am able to free up some time I will try to do some debugging on this issue.

bradyvercher commented 4 years ago

@koengabriels I shared a snippet in this comment that might be useful for accounting for plugins with non-standard version formats.

Feel free to reopen this issue with more information if you ever discover the cause of that error.