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

Activation fails in 1.8.9 due to a code error #300

Closed
yetanotherse opened this issue Sep 12, 2019 · 3 comments · Fixed by #301
Closed

Activation fails in 1.8.9 due to a code error #300

yetanotherse opened this issue Sep 12, 2019 · 3 comments · Fixed by #301
Labels
bug Something isn't working
Milestone

Comments

@yetanotherse
Copy link

Describe the bug
On trying to activate the plugin, you get the following error.

Plugin could not be activated because it triggered a fatal error.

Fatal error: Uncaught Error: Call to a member function query() on null in /nas/content/staging/xxx/wp-content/plugins/object-sync-for-salesforce/classes/activate.php:143 Stack trace: #0 [internal function]: Object_Sync_Sf_Activate->wordpress_salesforce_tables('') #1 /nas/content/staging/xxx/wp-includes/class-wp-hook.php(286): call_user_func_array(Array, Array) #2 /nas/content/staging/xxx/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /nas/content/staging/xxx/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #4 /nas/content/staging/xxx/wp-admin/plugins.php(180): do_action('activate_object...') #5 {main} thrown in /nas/content/staging/xxx/wp-content/plugins/object-sync-for-salesforce/classes/activate.php on line 143

To Reproduce
Steps to reproduce the behavior:

  1. Install 1.8.9 version of Object Sync in WP
  2. Click on activate plugin

Expected behavior
Plugin should get activated

Environment (please complete the following information):

  • WordPress Version: 4.9.8
  • PHP Version: 7.2.20

Solution
Found that the reference to wpdb is being used without this in activate.php on like 143 and 144 which was causing the issue. Replacing $wpdb with $this->wpdb fixes the issue.

Will create a pull request for the same.

yetanotherse pushed a commit to yetanotherse/object-sync-for-salesforce that referenced this issue Sep 12, 2019
@jonathanstegall
Copy link
Member

@yetanotherse I'll do some testing on this today. I've seen some folks report this issue but I haven't been able to reproduce it, so I can't tell what environment is causing/preventing it.

If I can't reproduce it, i'll test your PR and make sure it doesn't cause any issues, and I'll approve it if it doesn't.

@yetanotherse
Copy link
Author

yetanotherse commented Sep 12, 2019

@jonathanstegall Sounds good, thanks. Here is my environment.

WordPress 4.9.8
PHP 7.2.20-2+ubuntu18.04.1+deb.sury.org+1
Apache
MySQL 5.7.26

Having said that, I guess the issue should be reproducible on any system when trying to activate the plugin since the execution context for $wpdb is incorrect.

@jonathanstegall
Copy link
Member

@yetanotherse you're right that it's incorrect. I'm not sure why it doesn't always have an error for that. Maybe many configs are more forgiving. In any case I'll accept the fix.

jonathanstegall added a commit that referenced this issue Sep 12, 2019
jonathanstegall added a commit that referenced this issue Sep 12, 2019
…led version, as that is the only way a user would have those indexes to drop.
@jonathanstegall jonathanstegall added this to the v1.8.x milestone Sep 12, 2019
@jonathanstegall jonathanstegall added the bug Something isn't working label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants