Support » Plugin: WooCommerce - Gift Cards » PHP 7 fatal error

  • Hi Guys

    Great plugin. It’s the only one that does a decent job. 🙂

    Only issue is I cannot use on servers running PHP 7.1 as the below error:

    PHP Fatal error: Uncaught Error: [] operator not supported for strings in …./wp-content/plugins/gift-cards-for-woocommerce/includes/giftcard-checkout.php:302



Viewing 1 replies (of 1 total)
  • SoLoGHoST


    This is because of this in checkout.php:

    $giftCard_IDs = get_post_meta ( $giftCard_id, 'wpr_existingOrders_id', true );
    $giftCard_IDs[] = $order_id;

    In PHP 7 $giftCard_IDs is a string, and than directly below it, it is being assigned as an array and trying to append the $order_id to it.

    I’m not entirely sure what this is supposed to do with the order id, so not entirely sure how to fix this. I’m thinking that it expects the post meta of wpr_existingOrders_id to be returned as an unserialized array, but instead is returning as a string.

    Again, not entirely sure how to fix this issue, because I’m not entirely sure if they just used the wrong variable name or if that is supposed to be an array…

    It would be great if they could update this plugin so that it can be used in PHP 7!

Viewing 1 replies (of 1 total)
  • The topic ‘PHP 7 fatal error’ is closed to new replies.