Title: Plugin conflict
Last modified: November 14, 2017

---

# Plugin conflict

 *  Resolved [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/)
 * Hi,
 * It seems that this plugin registers its libraries long before it needs to use
   them. In particular, the Google SDK. This means that another plugin, which has
   a different version of the Google SDK (e.g. an older one because of a need to
   support older WP/PHP versions), cannot do so, because this plugin got there first
   and inserted something incompatible.
 * In our case (UpdraftPlus, 1 million installs), we have had a report from a user
   who cannot send a backup to Google Drive, getting the error given below.
 * There’s no need for your plugin to load its Google SDK before the point at which
   Google is being contacted. On a backup job – run via WP cron, as a background
   task – there’s surely no need for a Google Analytics plugin to be doing anything?
 * `0021.948 (0) PHP event: code E_RECOVERABLE_ERROR: Argument 1 passed to Google_Client::
   __construct() must be of the type array, object given, called in wp-content/plugins/
   updraftplus/methods/googledrive.php on line 654 and defined (line 93, wp-content/
   plugins/wd-google-analytics/google/src/Google/Client.php)`
 * David

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/)
 * (@progmastery)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9684745)
 * hi [@davidanderson](https://wordpress.org/support/users/davidanderson/),
 * Thanks for noting this issue. We are aware of it.
 * Currently there are many plugins using Google SDK, its different versions and
   its different services and other third-party dependencies. There are new and 
   old versions of Google SDK as well as its versions for PHP 5.4+ and PHP 5.5+.
 * Google SDK has quite a large size. Some plugins remove its services and do not
   load whole SDK. Google Analytics checks whether any plugin loaded SDK before,
   and if it is so, our plugin does not load SDK and uses other plugin’s instance.
   We hope that any plugin which uses Google SDK, includes its full version. And
   we also do not strip any service needed for other plugins from our version. Note
   that we can’t prefix Google SDK. Therefore there is only one instance of SDK 
   running in WP code, and it needs to be whole.
 * We need to find optimal solution which causes minimal compatibility issues.
    
   Note, that Web-Dorado also has several other plugins using Google SDK, including
   Backup plugin which is compatible with Google Analytics WD.
 * So we decided to
    1). Use it’s latest version 2). PHP 5.4+ 3.) load SDK fully
   4). load it quite early
 * Even if we include Google SDK later, this will still cause compatibility issue
   with your plugin. We can’t switch back to the older version, because of compatibility
   issues with other plugins. Can’t you move forward and update the Google library
   and include it’s full version ?
    -  This reply was modified 8 years, 6 months ago by [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/).
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9685339)
 * Hi,
 * Thanks for getting back. It’s 4) that’s the problem: loading early. You say…
 * > Even if we include Google SDK later, this will still cause compatibility issue
   > with your plugin.
 * How would it cause a compatibility problem? It shouldn’t, if it is late enough…
   i.e. just before any API calls that you make to Google. Because, I think that
   your plugin will *never* need to make an API call to Google within the same PHP
   invocation as our plugin makes an API call to Google. i.e. There will then never
   be a situation when we both want to load our SDKs.
 * We only load our copy of the Google SDK at the moment of contacting Google to
   send a backup. Since that’s in the background, that can never cause another plugin
   a problem, because no other (sane) plugin can be calling Google for anything 
   at that time. Typically, we’ve been called from wp-cron.php, calling our registered
   action for a scheduled backup. There’s no situation in which the same PHP process
   will want to talk to the Google Analytics API, and also talk to the Google Drive
   API. These will only happen in different PHP processes.
 * So, I think that loading late (only when you know that you’re about to make a
   Google API call) can work.
 * We can’t switch Google SDK version. It would (according to [https://wordpress.org/about/stats/](https://wordpress.org/about/stats/))
   mean breaking around 200,000 sites of our existing users, who are on PHP versions
   older than PHP 5.4.
 * Loading early is the wrong thing to do. If every plugin did that, it would be
   complete chaos. If we loaded ours early, then we’d break every user who uses 
   your plugin. Loading late is the way to co-operate nicely with other plugins.
 * David
 *  [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/)
 * (@progmastery)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9689133)
 * Hi,
 * thanks for your suggestion. We took a look at the issue, but could not reproduce
   the error.
 * Can you please provide typical stack trace for the code throwing error?
    Does
   it include `plugins_loaded` and `init`hooks actions?
 * If backup code runs earlier, we will move loading of Google SDK into these two
   hooks.
    Since GAWD plugin needs Google API data in it’s core functionality, I
   don’t think we can include the library later.
    -  This reply was modified 8 years, 6 months ago by [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/).
    -  This reply was modified 8 years, 6 months ago by [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/).
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9689900)
 * Sorry, I don’t understand. How can anything in a plugin run earlier than `plugins_loaded`?
   That’s the hook that WP’s code for loading plugins uses to indicate that activated
   plugins have now been loaded. That’s early in the WP bootstrap process, so *nothing*
   of any use that’s triggered by WP (e.g. cron events) can even *theoretically*
   run before that.
 * You just need to move the loading of the SDK to the same place where you make
   the API calls. i.e. Wherever in your SDK communicates with Google, put the loading
   of the SDK just there, and no earlier. That’s what we do with UpdraftPlus, which
   is why you’re not getting any reports from UpdraftPlus users that they can’t 
   use your plugin because of a conflict… as long as all plugins co-operate nicely
   like this, then everything can co-exist.
 * David
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9689955)
 * Here’s a strack trace up to the routine in which UpdraftPlus is about to send
   a just-created backup to Google Drive (when created by pressing “Backup Now” 
   in the admin area, so this isn’t the cron case). At this point, it hasn’t yet
   loaded the Google Drive SDK (this happens next)… but has a problem if some other
   plugin already has. (No other plugin has a good reason to… because it’s an AJAX
   request sent to UpdraftPlus. Particularly, there’s no reason why in this PHP 
   process invocation there’d be Analytics activity going on; there’s nothing in
   a back-end admin AJAX request to another plugin that involves a need to talk 
   to Google Analytics).
 *     ```
       Fatal error:  GoogleDrive bootstrap in wp-content/plugins/updraftplus/methods/googledrive.php on line 531
       Stack trace:
         1. {main}() wp-admin/admin-ajax.php:0
         2. do_action() wp-admin/admin-ajax.php:97
         3. WP_Hook->do_action() wp-includes/plugin.php:453
         4. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:310
         5. UpdraftPlus_Admin->updraft_ajax_handler() wp-includes/class-wp-hook.php:286
         6. UpdraftPlus_WPAdmin_Commands->backupnow() wp-content/plugins/updraftplus/admin.php:1395
         7. UpdraftPlus_Admin->request_backupnow() wp-content/plugins/updraftplus/includes/class-commands.php:108
         8. do_action() wp-content/plugins/updraftplus/admin.php:1904
         9. WP_Hook->do_action() wp-includes/plugin.php:453
        10. WP_Hook->apply_filters() wp-includes/class-wp-hook.php:310
        11. UpdraftPlus->backupnow_files() wp-includes/class-wp-hook.php:286
        12. UpdraftPlus->boot_backup() wp-content/plugins/updraftplus/class-updraftplus.php:2505
        13. UpdraftPlus->backup_resume() wp-content/plugins/updraftplus/class-updraftplus.php:2768
        14. UpdraftPlus_Backup->cloud_backup() wp-content/plugins/updraftplus/class-updraftplus.php:2337
        15. UpdraftPlus_Backup->upload_cloud() wp-content/plugins/updraftplus/backup.php:436
        16. UpdraftPlus_BackupModule_googledrive->backup() wp-content/plugins/updraftplus/backup.php:485
        17. UpdraftPlus_BackupModule_googledrive->bootstrap() wp-content/plugins/updraftplus/methods/googledrive.php:456
        18. trigger_error() wp-content/plugins/updraftplus/methods/googledrive.php:531
       ```
   
 *  [Tigran Nazaryan](https://wordpress.org/support/users/progmastery/)
 * (@progmastery)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9693268)
 * Thanks for your comments,
 * We checked the problem again and discovered that there are definitely some things
   to fix in Google Analytics WD plugin. `Plugins_loaded` hook is used where it 
   is not necessary and Google SDK is loaded too early. We will fix this issue ASAP.
   However it will require refactoring of large chunks of code, so it may take some
   time. The fix will be released within several weeks.
 * Thank you again very much! We owe you one 🙂
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-9696423)
 * Hi Tigran,
 * Thank you very much!
 * David
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-10288673)
 * Hi,
 * Did this get fixed? We’ve had another report from a user facing this problem.
 * David
 *  [WD Support](https://wordpress.org/support/users/wdsupport/)
 * (@wdsupport)
 * [8 years ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-10293979)
 * Hi, David!
 * Unfortunately, the version with this fix hasn’t been released yet. Most likely,
   the patch will be available next week.
 * Nevertheless, we can provide you with a beta version that’s still being tested.
 * If you’re interested, please contact Web-Dorado Customer Care at [support@web-dorado.com](https://wordpress.org/support/topic/plugin-conflict-178/support@web-dorado.com?output_format=md)
   and we will send you the beta package of the plugin.
 * Cheers!
    -  This reply was modified 8 years ago by [WD Support](https://wordpress.org/support/users/wdsupport/).

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Plugin conflict’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wd-google-analytics.svg)
 * [10WebAnalytics](https://wordpress.org/plugins/wd-google-analytics/)
 * [Support Threads](https://wordpress.org/support/plugin/wd-google-analytics/)
 * [Active Topics](https://wordpress.org/support/plugin/wd-google-analytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wd-google-analytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wd-google-analytics/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [WD Support](https://wordpress.org/support/users/wdsupport/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/plugin-conflict-178/#post-10293979)
 * Status: resolved