• Resolved Luis

    (@luiscordeiro)


    Hi, we are getting these critical errors on the logs since we upgraded the plugin.

    2023-03-16T12:31:47+00:00 CRITICAL Uncaught Error: Call to a member function format() on bool in /home/customer/www/xxx.com/public_html/wp-content/plugins/woo-payment-gateway/includes/subscriptions/wcs-braintree-functions.php:1347
    Stack trace:

    0 /home/customer/www/payments.xxx.com/public_html/wp-includes/class-wp-hook.php(310): wcs_braintree_webhook_subscription_charged_successfully(Object(Braintree\WebhookNotification))

    1 /home/customer/www/payments.xxx.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array)

    2 /home/customer/www/payments.xxx.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

    3 /home/customer/www/payments.xxx.com/public_html/wp-content/plugins/woo-payment-gateway/includes/api/class-wc-braintree-controller-webhook.php(144): do_action(‘wc_braintree_we…’, Object(Braintree\WebhookNotification), Object(WP_REST_Request))

    4 /home/customer/www/payments.xxx.com/public_html/wp-includes/rest-api/class-wp-rest-serv

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @luiscordeiro

    Are you using the Braintree plugin’s built in subscription functionality? That code is called when Braintree processes a renewal payment in their system and then communicates that via a webhook notification.

    What version of the Braintree plugin were you using previously before this error started?

    Are you using the WooCommerce HPOS tables?

    Kind Regards,

    Thread Starter Luis

    (@luiscordeiro)

    Hi @mrclayton , thanks for the reply.

    We were using 3.2.41 until the update, and I confirmed in our logs that this error is not shown prior to the update.

    We are not using HPOS.

    Thanks

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @luiscordeiro

    Nothing changed between version 3.2.41 and 3.2.42 related to the subscription functionality. Are you using the Braintree plugin’s built in subscription functionality?

    If you are using the Braintree plugin’s subscription functionality, is this error happening for all webhook notifications related to renewal payments or a specific subscription ID?

    Thanks

    Thread Starter Luis

    (@luiscordeiro)

    Hi?@mrclayton?,

    Yes we’re using the built in Subscriptions, and it’s happening for all subscriptions.

    Thanks

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @luiscordeiro

    One more question. Are these subscriptions that have reached the end of their subscription period or are there further renewal payments expected? Basically trying to find out if these subscriptions have come to their end.

    Thanks

    Thread Starter Luis

    (@luiscordeiro)

    Hi?@mrclayton , no they don’t have expiration dates, they are not expected to end.

    We have this data on wc-braintree logs from older dates (when everything was working correctly). Always mentions Subscription 0 but there was never any issue.

    2023-02-15T00:02:06+00:00 INFO Webhook received. Kind: subscription_went_active.
    2023-02-15T00:02:06+00:00 INFO Subscription 0 not found in your database.
    2023-02-15T00:02:07+00:00 INFO Webhook received. Kind: subscription_charged_successfully.
    2023-02-15T00:02:07+00:00 INFO Subscription 0 not found in your database.

    Plugin Author Payment Plugins

    (@mrclayton)

    Subscription 0 not found in your database.

    That’s a clue to this behavior. The error is being caused because the subscription ID that’s associated with the Braintree subscription isn’t found in your database.

    Do you have multiple websites that use the same Braintree account? The subscription ID should not be zero. That log file is taking the subscription ID that’s provided in the Braintree notification.

    Your certain you aren’t using the new WooCommerce orders table?

    Thanks

    Thread Starter Luis

    (@luiscordeiro)

    Hi?@mrclayton ,?thanks for the reply.

    Yes, we create some subscriptions from another website (directly with BT API). So maybe that’s what those Subscription IDs mean. I know we had these logs entries way before this problem.

    As for the WooCommerce orders, you can see attached our Woo Setup, where that option is disabled.

    Thanks

    Plugin Author Payment Plugins

    (@mrclayton)

    Yes, we create some subscriptions from another website (directly with BT API). So maybe that’s what those Subscription IDs mean. I know we had these logs entries way before this problem.

    That is likely the source of that error. We’ll have to look into what changes would be needed to guard against a subscription notification coming through that’s not relevant to the WooCommerce store.

    Thanks,

    Plugin Author Payment Plugins

    (@mrclayton)

    @luiscordeiro Reviewing the code, the plugin is already designed to ignore subscriptions which do not exist. It looks like your error might be occurring for a subscription where the ID is valid.

    Can you look in the WordPress postmeta table for one of these subscriptions and see what the value for the metakey start_date is?

    Kind Regards,

    Thread Starter Luis

    (@luiscordeiro)

    Hi @mrclayton, sure I’ve checked one of the subscriptions (344682) that was created in Woo, and the _start_date has 2023-02-13 03:22:22.

    That subscription was created by a parent order on the 2023-02-12.

    The subscription was then renewed in Braintree on 2023-03-13 but that order does not show up in the related WooCommerce Subscription page (and also doesn’t show in the Orders page).

    Thanks

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @luiscordeiro

    The subscription was then renewed in Braintree on?2023-03-13?but that order does not show up in the related WooCommerce Subscription page (and also doesn’t show in the Orders page).

    That’s expected since the creation of the renewal order is failing. It seems as if the Braintree plugin is expecting a metakey of start_date not _start_date and that’s the cause of the issue. I am wondering if a recent update of WooCommerce changed such that they no longer add the prefix underscore to the metakey and it has to be done beforehand.

    That’s the only thing I can think of right now that would cause code that was previously working to just stop all of a sudden.

    Kind Regards,

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @luiscordeiro

    Can you use our contact us page? I believe the issue is related to what I outlined in my previous reply. Something has changed related to how meta keys are read.

    Thanks

    Thread Starter Luis

    (@luiscordeiro)

    Hi @mrclayton , thanks.
    I’ve just sent the contact form.

    Hello, I am just adding to this thread that we are also experiencing the same issue but we are not using subscriptions. Are you able to assist? We are on v 3.2.44.

    —–

    2023-04-15T15:13:20+00:00 CRITICAL Uncaught Error: Call to a member function get_currency() on bool in /var/www/html/wp-content/plugins/woo-payment-gateway/includes/wc-braintree-functions.php:1561
    Stack trace:

    0 /var/www/html/wp-content/plugins/woo-payment-gateway/includes/class-wc-braintree-frontend-scripts.php(293): wc_braintree_get_currency()

    1 /var/www/html/wp-content/plugins/woo-payment-gateway/includes/class-wc-braintree-frontend-scripts.php(350): WC_Braintree_Frontend_Scripts->localize_client_manager()

    2 /var/www/html/wp-content/plugins/woo-payment-gateway/includes/class-wc-braintree-frontend-scripts.php(182): WC_Braintree_Frontend_Scripts->localize_frontend()

    3 /var/www/html/wp-includes/class-wp-hook.php(308): WC_Braintree_Frontend_Scripts->print_scripts(”)

    4 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)

    5 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

    6 /var/www/html/wp-includes/script-loader.php(2146): do_action(‘wp_print_script…’)

    7 /var/www/html/wp-includes/cl in /var/www/html/wp-content/plugins/woo-payment-gateway/includes/wc-braintree-functions.php on line 1561

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘CRITICAL Uncaught Error: Call to a member function format() on bool’ is closed to new replies.