WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
269 stars 3 forks source link

WordPress showing error while Theme Sniffer is activate. #165

Closed NaveenKharwar closed 5 years ago

NaveenKharwar commented 5 years ago

I am getting an error when I open my local WordPress website while Theme Sniffer is activated!

WordPress Version: WordPress 5.2 “Jaco” Theme Sniffer: 1.0.0

The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.

Fatal error: Uncaught Error: Class 'Theme_Sniffer\Api\Api_Response_Error' not found in /var/www/html/wp-content/plugins/theme-sniffer/src/api/class-template-tags-request.php:56 Stack trace: #0 /var/www/html/wp-content/plugins/theme-sniffer/src/api/class-template-tags-request.php(37): Theme_Sniffer\Api\Template_Tags_Request->get_template_tags() #1 /var/www/html/wp-includes/class-wp-hook.php(286): Theme_Sniffer\Api\Template_Tags_Request->check_template_tags('') #2 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /var/www/html/wp-includes/plugin.php(465): WP_Hook->do_action(Array) #4 /var/www/html/wp-settings.php(525): do_action('init') #5 /var/www/html/wp-config.php(107): require_once('/var/www/html/w...') #6 /var/www/html/wp-load.php(37): require_once('/var/www/html/w...') #7 /var/www/html/wp-admin/admin.php(34): require_once('/var/www/html/w...') #8 /var/www/html/wp-admin/index.php(10): require_once('/var/www/html/w...') #9 {main} thrown in /var/www/html/wp-content/plugins/theme-sniffer/src/api/class-template-tags-request.php on line 56

Screenshot => https://ibb.co/3fqY3fC

Thank You

dingo-d commented 5 years ago

Did you pull the plugin from the .org repo or from the GitHub?

Please check the installation instructions: https://github.com/WPTRT/theme-sniffer#installation---development

NaveenKharwar commented 5 years ago

I installed the plugin from WordPress repo.

timelsass commented 5 years ago

Thanks for reporting @naveenkharwar - at first look the namespace wasn't right for the error, but you're still arriving to this situation because of an error, something isn't configured correctly in your localhost, or something is conflicting with remote calls made via wp_remote_get(). This will hopefully let you see what the errors are in the admin notice, so you can address them in your environment. Part of the change too was not to run all the transient checks for the tags until the user goes to the admin.php?page=theme-sniffer page so we don't make that call till we need the data.

The PR above fixes the errors for the fatal you're getting, but there are some additional uses of wp_remote_* functions that might need to also be tweaked too.

Can you let me know if this patch prevents fatal errors for you now? I went ahead and built a .zip off of the patch + development (ie it does have other changes that the .org version does not currently as a heads up!) branch and attached it here, if you could give it a try in your environment, that'd be much appreciated: theme-sniffer.zip

dingo-d commented 5 years ago

I installed the plugin from WordPress repo.

Did you built the plugin as instructed? Using npm run build and composer install?

What the error suggest to me is that the autoloader isn't created and this causes issue with loading the classes 🙂

You're safer using the .org release (unless you want to work in development ofc).

jhfmiguel commented 4 years ago

I had the same error, and the problem is in the file in a Wordpress link that redirects to the developer file for this plugin here on Github. The file provided by @timelsass works perfectly.