From 19c0fcb9e648fc76c4ceb65cdd121e0e264a3603 Mon Sep 17 00:00:00 2001 From: Paul Clark Date: Tue, 14 Sep 2021 15:26:34 -0700 Subject: [PATCH] Freemius: Check _parent object for using method A proposed solution for an error reported in this [Slack thread](https://podswp.slack.com/archives/C02SVLHQF/p1631628235171000). It appears that `$this->_parent` can contain either an object or a boolean. This should resolve the error by checking that it's an object before attempting to use the method `->is_anonymous()`. It looks like `$this->_parent` is used in other places in this class. Unknown if the `boolean` vs. `object` detail effects any other functionality. Error: ``` Error Details ============= An error of type E_ERROR was caused in line 23432 of the file /home/ekhulnac/public_html/destra/plugins/pods/vendor/freemius/wordpress-sdk/includes/class-freemius.php. Error message: Uncaught Error: Call to a member function is_anonymous() on bool in /home/ekhulnac/public_html/destra/plugins/pods/vendor/freemius/wordpress-sdk/includes/class-freemius.php:23432 Stack trace: #0 /home/ekhulnac/public_html/destra/plugins/pods/vendor/freemius/wordpress-sdk/includes/class-freemius.php(2051): Freemius->_add_tracking_links() #1 /home/ekhulnac/public_html/wp-includes/class-wp-hook.php(303): Freemius->_hook_action_links_and_register_account_hooks('') #2 /home/ekhulnac/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array) #3 /home/ekhulnac/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array) #4 /home/ekhulnac/public_html/wp-admin/admin.php(175): do_action('admin_init') #5 /home/ekhulnac/public_html/wp-admin/plugins.php(10): require_once('/home/ekhulnac/...') #6 {main} ``` --- vendor/freemius/wordpress-sdk/includes/class-freemius.php | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/freemius/wordpress-sdk/includes/class-freemius.php b/vendor/freemius/wordpress-sdk/includes/class-freemius.php index f3b3428f72..eac7b796ae 100755 --- a/vendor/freemius/wordpress-sdk/includes/class-freemius.php +++ b/vendor/freemius/wordpress-sdk/includes/class-freemius.php @@ -23429,6 +23429,7 @@ function _add_tracking_links() { if ( $this->is_addon() && ! $this->is_only_premium() && + is_object( $this->_parent ) && $this->_parent->is_anonymous() ) { return;