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

Widgets: fixes PHP's fatal class not found error on Simple Payments Widget #9871

Merged
merged 1 commit into from
Jul 20, 2018

Conversation

rodrigoi
Copy link
Contributor

@rodrigoi rodrigoi commented Jul 5, 2018

Fixes #9875

Changes proposed in this Pull Request:

  • adds a existence check for the Jetpack_Simple_Payments class dependency on Jetpack_Simple_Payments_Widget.

Testing instructions:

  • Get this branch on a Multisite Installation
  • Activate the Jetpack Plugin on the main site.
  • Deactivate the Jetpack Plugin on the main site.

Previously, the site failed with a WSOD with this error:

PHP Fatal error:  Uncaught Error: Class 'Jetpack_Simple_Payments' not found in /var/www/html/wp-content/plugins/jetpack/modules/widgets/simple-payments.php:483
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(286): register_widget_jetpack_simple_payments('')
#1 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#2 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /var/www/html/wp-includes/widgets.php(1649): do_action('widgets_init')
#4 /var/www/html/wp-includes/class-wp-hook.php(286): wp_widgets_init('')
#5 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#7 /var/www/html/wp-settings.php(450): do_action('init')
#8 /var/www/html/wp-config.php(83): require_once('/var/www/html/w...')
#9 /var/www/html/wp-load.php(37): require_once('/var/www/html/w...')
#10 /var/www/html/wp-admin/admin.php(31): require_once('/var/www/html/w...')
#11 /var/www/html/wp-admin/cu in /var/www/html/wp-content/plugins/jetpack/modules/widgets/simple-payments.php on line 483

which should no longer happen.

Proposed changelog entry for your changes:

  • fixed Fatal Error when disconnecting the main site on a multisite installation.

… dependency on Jetpack_Simple_Payments_Widget.
@rodrigoi rodrigoi added [Type] Bug When a feature is broken and / or not performing as intended [Feature] Extra Sidebar Widgets [Focus] Multisite [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Pri] High Simple Payments labels Jul 5, 2018
@rodrigoi rodrigoi added this to the 6.4 milestone Jul 5, 2018
@rodrigoi rodrigoi self-assigned this Jul 5, 2018
@rodrigoi rodrigoi requested a review from a team July 5, 2018 19:04
@rodrigoi rodrigoi requested a review from a team as a code owner July 5, 2018 19:04
Copy link
Contributor

@brbrr brbrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on JurassicNinja sites. Works great!

LGTM 🐑 🇮🇹

@brbrr brbrr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jul 13, 2018
@iamgabrielma
Copy link
Contributor

Adding myself here to notify 1275815-zen when this is live :)

@mdggjfgdog
Copy link

i have same issue last 2 weeks, currently Jetpack deactivated. i think it had my site slowing down for 2-3 months. Worpress not responding. Cannot log into AMP. I am amatuer. annoying.

@kraftbj
Copy link
Contributor

kraftbj commented Jul 18, 2018

@mdggjfgdog Can you submit a support request via https://jetpack.com/contact-support/ ? Anything from 2-3 months back would not be related to this as the widget is a new addition as of this month's release of Jetpack.

@Automattic Automattic deleted a comment from mdggjfgdog Jul 19, 2018
@mdggjfgdog
Copy link

mdggjfgdog commented Jul 19, 2018 via email

@dougaitken
Copy link
Member

Adding 1291753-zen for myself to loop back after this is merged

@zinigor zinigor merged commit df50a85 into master Jul 20, 2018
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jul 20, 2018
@zinigor zinigor deleted the fix/simple-payments-class-missing-on-widget branch July 20, 2018 12:31
@taupecat
Copy link
Contributor

❤️🥃

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 20, 2018 via email

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 20, 2018 via email

@iamgabrielma
Copy link
Contributor

@mdggjfgdog Please contact https://jetpack.com/contact-support/ or feel free to open a new GitHub issue with the exact details of the problem you're seeing. As commented before, if this has been happening for 2-3 months it won't be related to this specific addition.

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 21, 2018 via email

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 21, 2018 via email

@Copons
Copy link
Contributor

Copons commented Jul 22, 2018

@mdggjfgdog It looks like you probably forgot to remove the + symbols when you manually pasted this fix.

Try replacing the entire register_widget_jetpack_simple_payments function with this instead:

	function register_widget_jetpack_simple_payments() {
		if ( ! class_exists( 'Jetpack_Simple_Payments' ) ) {
			return;
		}
		$jetpack_simple_payments = Jetpack_Simple_Payments::getInstance();
		if ( ! $jetpack_simple_payments->is_enabled_jetpack_simple_payments() ) {
			return;
		}
		register_widget( 'Jetpack_Simple_Payments_Widget' );
	}

@mdggjfgdog
Copy link

Yes and i knew better..i have tried Copons as above, and got an error on the last line, so i have returned to previous patch and after trying to de-activate, got similar result - Parse error: syntax error, unexpected end of file in /home/*******/public_html/wp-content/plugins/jetpack.deactivate/modules/widgets/simple-payments.php on line 486

@Copons
Copy link
Contributor

Copons commented Jul 22, 2018

@mdggjfgdog I can't seem to reproduce it, and I'm inclined to think there are other typos in the file.

Would you mind replacing the entire content of your modules/widgets/simple-payments.php with the current content of the file in this repo?
(You can find it here: https://raw.githubusercontent.com/Automattic/jetpack/d3a69aac1463184e8353668eb2ccd9675781909e/modules/widgets/simple-payments.php)

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 22, 2018 via email

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 24, 2018 via email

@zinigor
Copy link
Member

zinigor commented Jul 24, 2018

@mdggjfgdog thanks for contacting us! The fact that your site is running OK with the patch is great news! The fact that it's slow for some reason is not.
Have you tried contacting someone from your hosting provider? A slow site is impossible to debug without taking a look at what's "inside". Tech support should be able to get down to the root cause pretty quickly.

@mdggjfgdog
Copy link

mdggjfgdog commented Jul 24, 2018 via email

@StefMattana
Copy link

Confirmed patch worked also for 1310968-zen

oskosk pushed a commit that referenced this pull request Jul 31, 2018
oskosk added a commit that referenced this pull request Jul 31, 2018
@123dev
Copy link

123dev commented Aug 7, 2018

The latest update Jetpack 6.3.3 broke it back :(

@dougaitken
Copy link
Member

Hi @123dev, this is tagged with version 6.4 so the fix in this pull request wasn't included in 6.3.3

@123dev
Copy link

123dev commented Aug 8, 2018

Hi @dougaitken thanks for the clarification.
Seeing how simple code change it is, it's puzzling that it's not already patched in the next minor release, considering that it breaks multisite deployments.
Shouldn't this be considered a hot fix rather than leave it for next major release?
Meanwhile each time there is an update we're caught missing this.

Thanks

@dougaitken
Copy link
Member

@123dev Jetpack version 6.4. was released yesterday. This fix was specific to multisite installations.

https://jetpack.com/2018/08/07/jetpack-6-4-release/

If you are on version 6.4 and seeing this error, please reach out to the team - http://jetpack.com/contact

@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extra Sidebar Widgets [Feature] Pay with PayPal aka Simple Payments [Focus] Multisite [Pri] High [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activating JetPack gave me a fatal error on my multisite