Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Cannot use object of type stdClass as array in /wp-content/plugins/btcpay-for-woocommerce/class-wc-gateway-bitpay.php:1235 #6

Closed
willezgo opened this issue May 14, 2018 · 7 comments

Comments

@willezgo
Copy link

willezgo commented May 14, 2018

Version: 2.2.22 (02bbdb5)

Error log:

Stack trace:
#0 /wp-includes/class-wp-hook.php(288): display_transient_update_plugins(Object(stdClass))
#1 /wp-includes/plugin.php(203): WP_Hook->apply_filters(Object(stdClass), Array)
#2 /wp-includes/option.php(1750): apply_filters('pre_set_site_tr...', Object(stdClass), 'update_plugins')
#3 /wp-includes/update.php(296): set_site_transient('update_plugins', Object(stdClass))
#4 /wp-includes/update.php(689): wp_update_plugins()
#5 /wp-includes/class-wp-hook.php(286): _maybe_update_plugins('')
#6 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#7 /wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#8 /wp-admin

I don't know much about how the update detection works, but at first glance it seems that this block of code in function display_transient_update_plugins():

if(isset($transient->response))
{
    $transient->response['btcpay-for-woocommerce/class-wc-gateway-bitpay.php'] = $obj;
}
else
{
    $transient['btcpay-for-woocommerce/class-wc-gateway-bitpay.php'] = $obj;  
}

could simply be rewritten by:

$transient->response['btcpay-for-woocommerce/class-wc-gateway-bitpay.php'] = $obj;

@NicolasDorier
Copy link
Member

NicolasDorier commented May 14, 2018

no, I think some version are not properly setting $transient->response :/

@NicolasDorier
Copy link
Member

No more info about this error? because I can't know the line failing here

@NicolasDorier
Copy link
Member

What version of woocommerce/wordpress are you using?

@willezgo
Copy link
Author

willezgo commented May 14, 2018

Thanks for your answer Nicolas :)

no, I think some version are not properly setting $transient->response :/

Oh, that's good to know.

What version of woocommerce/wordpress are you using?

I'm running WordPress 4.9.5, and WooCommerce 3.3.5 (through wordpress.com managed hosting service).

No more info about this error? because I can't know the line failing here

I started noticing the problem when the Wordpress admin panel suddenly started returning 500 Internal Server Error.

After asking wordpress.com support they came up with the stack trace that I posted above. The exact location of the error is class-wc-gateway-bitpay.php:1235, which for the 2.2.22 release points to the line with $transient['btcpay-for-woocommerce/class-wc-gateway-bitpay.php'] = $obj;

(this line appears to be here in the most recent commit:

$transient['btcpay-for-woocommerce/class-wc-gateway-bitpay.php'] = $obj;
)

@NicolasDorier
Copy link
Member

@willezgo
Copy link
Author

I installed the new release. The dashboard is working fine now, of course we'll see more when a new version is published to trigger the new version code path :)

I'll keep you in touch in any case.

@NicolasDorier
Copy link
Member

thanks, I am closing this now. Reopen if it happens again. I think this should be fine now. At worse you won't see the new update, but it will not crash!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants