wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
73 stars 27 forks source link

PHP Fatal error: Uncaught Error: Class "WP_List_Table" not found #869

Closed ionikol closed 7 months ago

ionikol commented 8 months ago

Before submitting an issue please check that you’ve completed the following steps:

Describe the bug Some of our users reported the following error An error of type E_ERROR was caused in line 9 of the file /nas/content/live/sitetemplate3/wp-content/plugins/imagify/inc/classes/class-imagify-files-list-table.php. Error message: Uncaught Error: Class "WP_List_Table" not found in /nas/content/live/sitetemplate3/wp-content/plugins/imagify/inc/classes/class-imagify-files-list-table.php:9 Stack trace: #0 /nas/content/live/sitetemplate3/wp-content/plugins/imagify/vendor/composer/ClassLoader.php(576): include() #1 /nas/content/live/sitetemplate3/wp-content/plugins/imagify/vendor/composer/ClassLoader.php(427): Composer\AutoloadWPMediaImagifyWordPressPlugin\{closure}('/nas/content/li...') #2 /nas/content/live/sitetemplate3/wp-includes/plugin.php(122): Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader->loadClass('Imagify_Files_L...') #3 /nas/content/live/sitetemplate3/wp-content/plugins/imagify/inc/classes/class-imagify-views.php(129): add_filter('set-screen-opti...', Array, 10, 3) #4 /nas/content/live/sitetemplate3/wp-content/plugins/imagify/classes/Plugin.php(124): Imagify_Views->init() #5 /nas/content/live/sitetemplate3/wp-content/plugins/imagify/inc/main.php(33): Imagify\Plugin->init(Array) #6 /nas/content/live/sitetemplate3/wp-includes/class-wp-hook.php(324): imagify_init('') #7 /nas/content/live/sitetemplate3/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #8 /nas/content/live/sitetemplate3/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /nas/content/live/sitetemplate3/wp-settings.php(506): do_action('plugins_loaded') #10 /nas/content/live/sitetemplate3/wp-config.php(119): require_once('/nas/content/li...') #11 /nas/content/live/sitetemplate3/wp-load.php(50): require_once('/nas/content/li...') #12 /nas/content/live/sitetemplate3/wp-admin/admin.php(34): require_once('/nas/content/li...') #13 /nas/content/live/sitetemplate3/wp-admin/update-core.php(10): require_once('/nas/content/li...') #14 {main} thrown"

To Reproduce Steps to reproduce the behavior: A user mentioned that when the plugin is active they are unable to access "wp-admin" and the site enters "Recovery Mode."

Additional context https://secure.helpscout.net/conversation/2550164885/482947/ https://secure.helpscout.net/conversation/2550150055/482945?folderId=676702 https://secure.helpscout.net/conversation/2550069130/482925?folderId=676702

https://wp-media.slack.com/archives/C5S1X8WBY/p1711527631291849 https://wp-media.slack.com/archives/C056ZJMHG0P/p1706521189097179

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

nicomollet commented 8 months ago

Is this related to WP Engine? https://forum.bricksbuilder.io/t/wait-wp-list-table-error-on-wpengine/21201

wordpressfan commented 7 months ago

Is this related to WP Engine? https://forum.bricksbuilder.io/t/wait-wp-list-table-error-on-wpengine/21201

Thanks @nicomollet , I check two sites of those affected sites and both are not in WP Engine.

Anyway, the fix is easy, we just need to check if this WP_List_Table class exists or not here: https://github.com/wp-media/imagify-plugin/blob/5684433e2a7d126b312de47ed05d21022483374c/inc/classes/class-imagify-files-list-table.php#L3

if it doesn't exist, load the file:

require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );

it's XS issue, so I'll go and create the PR quickly for it.