• Resolved Aline K.

    (@titelala)


    After I upgraded the Gift Cards plugin (free version) to version 4.0.0, I get the following warnings when I try to apply any coupon:

    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 250
    
    Warning: Attempt to read property "post_title" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 262
    
    Warning: Attempt to read property "post_parent" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 263
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 266
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 271
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 274
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 279
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 280
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 295
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 300
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 301
    
    Warning: Attempt to read property "ID" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 307
    
    Warning: Attempt to read property "post_status" on array in /wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php on line 309

    The website runs with PHP 8.2, WordPress 6.2.2 and WooCommerce 7.7.1.

    It would have been nice to be able to rollback to the previous version of the plugin, but as someone else noted, it’s not available.

    Thank you in advance for your help !

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    Our plugins are currently compatible up to PHP 8.1. Could you try downgrading the PHP version and see if the problem persists?

    We will be attentive to your response.

    Best regards.

    Thread Starter Aline K.

    (@titelala)

    Hi, thank you for your answer !

    I downgraded to PHP 8.1 and yes the problem still occurs (even with PHP 8.0). I just tried the YITH Gift Cards plugin on a test website, with different settings and other plugins installed, and the exact same warnings are displayed when I appply a coupon (the coupon is still applied though).

    I noticed that the warnings are also visible on the admin coupon page, before the name of each coupon:

    Best regards.

    Hi there,
    Thank’s for your explanation!

    I have been checking and indeed there’s a problem in the code causing this, even if those are just warnings.
    We have solved the problem and it would be released in the next plugin version.

    In case you want to use the fix right now, you need to go to the following path:

    wp-content/plugins/yith-woocommerce-gift-cards/includes/class-yith-ywgc-gift-card.php

    To the line 250 where this code is located:

    if ( isset( $post ) ) {

    And change it for the following:

    if ( isset( $post ) && is_object( $post ) ) {

    That should solve the problem. And in the following plugin update, the change would be also there, so you can continue updating the plugin normally.

    Have a nice day!

    • This reply was modified 1 year, 5 months ago by Héctor.G.
    • This reply was modified 1 year, 5 months ago by Héctor.G.
    Thread Starter Aline K.

    (@titelala)

    Perfect, thank you so much for solving the problem !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP warnings with version 4.0.0’ is closed to new replies.