Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error when Imagify, Gravity Forms, and the Gravity forms Mailchimp add-on plugins are all enabled and new Mailchimp feed is created #567

Closed
joejoe04 opened this issue Jun 1, 2021 · 4 comments · Fixed by #582
Assignees
Milestone

Comments

@joejoe04
Copy link
Contributor

joejoe04 commented Jun 1, 2021

Describe the bug

User is getting a fatal error when Imagify, Gravity Forms, and the Gravity forms Mailchimp add-on plugins are all enabled and they try to create a new Mailchimp feed.

Here is a link to the error:
https://wp-media.slack.com/archives/C5S1X8WBY/p1622557317001100?thread_ts=1622556682.000600&cid=C5S1X8WBY

Here is the ticket (Error is saved as a note attachment here too):
https://secure.helpscout.net/conversation/1529144472/268038/

To Reproduce

  1. Enable Imagify, Gravity Forms, and Gravity Forms Mailchimp add-on plugins
  2. Attempt to create new Mailchimp feed

Expected behavior
The Mailchimp feed should be created without error

@joejoe04
Copy link
Contributor Author

joejoe04 commented Jul 6, 2021

Seems it may not only be related to Gravity Forms and Gravity Forms MailChimp add-on. We have a new user not using those with same error message:

https://secure.helpscout.net/conversation/1561895538/276597/

E_ERROR בשורה 13 בקובץ /wp-content/plugins/imagify/inc/3rd-party/yoast-seo.php. הודעת שגיאה: Uncaught Error: Call to undefined function get_current_screen() in /wp-content/plugins/imagify/inc/3rd-party/yoast-seo.php:13
Stack trace:
#0 /wp-includes/class-wp-hook.php(292): _imagify_dequeue_yoastseo_script()
#1 /public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
#2 /wp-includes/plugin.php(484): WP_Hook->do_action()
#3/wp-includes/script-loader.php(1978): do_action()
#4 /public_html/wp-includes/class-wp-hook.php(292): wp_print_head_scripts()
#5 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
#6 /wp-includes/plugin.php(484): WP_Hook->do_action()
#7 /wp-includes/general-template.php(3009): do_action()
#8 /wp-content/plugins/gutenberg/build/widgets/blocks/legacy-widget.php(89): wp_head()
#9 /wp-includes/class-wp-hook.php(292): gutenberg_handle_legacy_widget_preview_iframe()
#10 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()

And here is a list of all plugins used:

Imagify
Jetpack
Really Simple CAPTCHA
Really Simple SSL
Redirection
Wordfence Security
WP Mail SMTP
WP Rocket
Yoast SEO premium
Contact form 7
Akismet
Gutenberg

@iCaspar
Copy link
Contributor

iCaspar commented Jul 6, 2021

Grooming Notes:

Reproduced: ❌

Cannot reproduce locally with yoast (free version) + gravity forms + gravity forms mailchimp + imagify.
However, seems possible that there are other plugins involved, given the second reported occurance above.

Root Cause:

The error happens when get_current_screen() is not defined -- which may happen if certain plugins, under some conditions, short-circuit the usual wp_admin load cycle.

Scope for Solution:

We can avoid the fatal error by checking that get_current_screen() is defined.
Adding

if ( ! function_exists( 'get_current_screen') ) {
	return;
}

at the top of the _imagify_dequeue_yoastseo_script() function in inc/3rd-party/yoast-seo.php should avoid the fatal error in any case.

Estimate Effort

[XS]

@piotrbak
Copy link

piotrbak commented Jul 12, 2021

@iCaspar @Tabrisrp This error could be related to Gutenberg and the Block Widgets feature we were talking about today. The error seems to be the same:
#571

And it's already fixed on Gutenberg side. Should we reach the customers to confirm?

edit
The first error is pointing to the Gravity Forms directly, the second is related to Gutenberg... Will try to reproduce it...

@piotrbak
Copy link

I'm not able to reproduce it, but it doesn't affect the Imagify pages and optimization process

iCaspar added a commit that referenced this issue Jul 15, 2021
* check if get_current_screen exists

* Fix phpcs parens spacing

Co-authored-by: Caspar Green <[email protected]>
@iCaspar iCaspar mentioned this issue Jul 15, 2021
iCaspar added a commit that referenced this issue Jul 15, 2021
* check if get_current_screen exists

* Fix phpcs parens spacing

Co-authored-by: Caspar Green <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants