Support » Plugin: WooCommerce Stripe Payment Gateway » CRITICAL Uncaught Error: Call to a member function get_type() on boolean

  • Resolved Andrii Sydorenko

    (@sidorenkoand)


    Hi,
    I caught the next error in my logs:

    2019-01-02T23:11:18+00:00 CRITICAL Uncaught Error: Call to a member function get_type() on boolean in /public_html/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-payment-request.php:807
    Stack trace:
    #0 /public_html/wp-includes/class-wp-hook.php(286): WC_Stripe_Payment_Request->ajax_get_selected_product_data('')
    #1 /public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
    #2 /public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #3 /public_html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(78): do_action('wc_ajax_wc_stri...')
    #4 /public_html/wp-includes/class-wp-hook.php(286): WC_AJAX::do_wc_ajax('')
    #5 /public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(false, Array)

    It seems that there needs to be a validation of the $product variable:
    includes/payment-methods/class-wc-stripe-payment-request.php:807

    And for some reason “try, catch” doesn’t help.
    If I change “catch” to this, then it works:
    } catch ( Throwable $e ) {
    or
    } catch ( Error $e ) {

    How to reproduce:
    Send the next request
    /?wc-ajax=wc_stripe_get_selected_product_data&_ajax_nonce=<nonce_from_site>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author royho

    (@royho)

    Hello,

    My hunch here would be PHP 7 is using Throwable and PHP 5 is using Exception. Are you using PHP 7?

    We may need to chain the catches so it looks like this try { ... } catch ( Throwable $t ) { ... } catch ( Exception $e ) { ... }

    Since PHP 5 doesn’t support Throwable, it will have a fallback.

    Yes,it’s PHP7.
    Thank you, I look forward to see this fix in new versions of the plugin.

    Plugin Support Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Hey @sidorenkoand

    Just wanted to let you know that we have included this fix in a future scheduled release.

    Thanks for bringing this to our attention 🙂

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