Home Forums WC Vendors Pro Support PHP Warning: A non-numeric value encountered

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #68637
    Yasa
    Participant

    Hi,
    I’ve been trying to solve this since MAY 30, I have some ideas about why variable product’s shipping shows “0” but you guys stopped responding on that topic. My php version is 7.1.6 and here is my log

    [20-Jun-2017 14:41:37 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 346
    [20-Jun-2017 14:41:37 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 377
    [20-Jun-2017 14:41:37 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 378
    [20-Jun-2017 14:41:40 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 346
    [20-Jun-2017 14:41:40 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 377
    [20-Jun-2017 14:41:40 UTC] PHP Warning:  A non-numeric value encountered in /wp-content/plugins/wc-vendors-pro/admin/class-wcvendors-pro-shipping.php on line 378
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7147 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7146 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7147 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7121 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7120 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7146 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7120 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7158 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7146 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:42:32 UTC] PHP Notice:  Undefined offset: 7121 in /wp-content/plugins/wc-vendors-pro/templates/dashboard/order/order_details.php on line 126
    [20-Jun-2017 14:40:34 UTC] The The "add_to_cart_fragments" hook uses out of date data structures and 
    function is deprecated since version 3.0.8. Replace with woocommerce_add_to_cart_fragments.

    Here is the solution I have found but I am not sure that is the case, maybe you can test it.

    It seems that in PHP 7.1, a Warning will be emitted if a non-numeric value is encountered. See this link.
    
    Here is the relevant portion that pertains to the Warning notice you are getting:
    
    New E_WARNING and E_NOTICE errors have been introduced when invalid strings are coerced using operators expecting numbers or their assignment equivalents. An E_NOTICE is emitted when the string begins with a numeric value but contains trailing non-numeric characters, and an E_WARNING is emitted when the string does not contain a numeric value.
    
    I'm guessing either $item['quantity'] or $product['price'] does not contain a numeric value, so make sure that they do before trying to multiply them. Maybe use some sort of conditional before calculating the $sub_total, like so:
    <?php
    
    if (is_numeric($item['quantity']) && is_numeric($product['price'])) {
      $sub_total += ($item['quantity'] * $product['price']);
    } else {
      // do some error handling...
    }
    
    #68673
    Anna
    Member

    @canyasa
    Ok thank you- we will look into this.

    #68677
    Yasa
    Participant

    Thank you

    #68693
    Jamie
    Keymaster

    Hello,

    Will test and add it to 1.4.4 if all is good. Running php 7.1.6 is nice and ‘fresh’ 🙂

    The variation shipping issue has been fixed in the soon to be released 1.4.4. I may have forgotten to report that back, apologies!

    cheers,

    Jamie.

    #68694
    Yasa
    Participant

    7.1.6 increases performance a lot.

    Thank you @digitalchild

    #68696
    Jamie
    Keymaster

    Hi @CANYASA

    I spoke to a couple of other woocommerce extension devs and they are reporting the same warnings. I will also check to see if there is any open issues with woocommerce also.

    cheers,

    Jamie.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.