• Resolved kirilld

    (@kirilld)


    Hello:

    I am getting the following warning:

    Warning: array_key_exists(): The first argument should be either a string or an integer in /home/domain/public_html/wp-content/plugins/ti-woocommerce-wishlist/public/cart.class.php on line 284

    on the order confirmation page after an order has been placed and paid for. It certainly appears if there is an outstanding item in the wishlist for the currently logged user.

    I am running WooCommerce version 3.9.0 and TI WooCommerce Wishlist Plugin version 1.16.0

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Paul

    (@paulschiretz)

    Yep same here… hope this gets fixed soon!

    My Workaround for today:

    		if( !is_string($cart_item_key) && !is_integer($cart_item_key) )
    			return false;

    Just add this before before the line 284 where the error is thrown.

    Basically just BEFORE these lines:

    		if ( ! array_key_exists( $cart_item_key, $data ) ) {
    			return false;
    		}

    Thanks Paul

    • This reply was modified 4 years, 10 months ago by Paul.
    Thread Starter kirilld

    (@kirilld)

    @paulschiretz

    Hi, Paul – thanks for your workaround! Does it still work as intended – i.e. you have enough orders to say with certainty it is not affecting something else ?? ?

    Thanks again!

    Paul

    (@paulschiretz)

    @kirilld Actually I’m not sure, I just did a test purchase and it worked as usual ??

    But what should the wishlist plugin do anyway if an order is sent? maybe remove something from the wishlist… (i guess thats what this function is doing) if thats broken till the dev updates the plugin I’m fine with that!

    I’m a dev too so all i did was looking at the code and the function array_key_exists() prints a warning AND returns false if the key is not valid. So i check the key first if it is valid and return false to avoid the warning to beprinted, soooo the behaviour stays exactily the same as with the warning, except the warning itself ??

    LONG WORDS SHORT: this code cannot break anything thats not already broken, but avoids the errormessage!

    But I’m sure we’ll hear from the TI guys soon!

    Thread Starter kirilld

    (@kirilld)

    @paulschiretz

    Thanks, Paul – I too had a quick look at the code and could not figure out what that function is for and why the warning would only kick in at the order confirmation page.

    Still, getting a site together requires the integration of dozens of plugins each of which is capable rendering the whole thing dead. So I just wanted to make sure that nothing else popped up after your fix!

    Thanks again, and I too look forward to a fix from the devs soon.

    Plugin Author templateinvaders

    (@templateinvaders)

    Hi all!

    Sorry for the delayed reply.

    This issue fixed in the 1.16.1 version that already available!

    Paul

    (@paulschiretz)

    Thanks a LOT!!!!

    Thread Starter kirilld

    (@kirilld)

    Great, thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Warning: array_key_exists() on order confirmation page’ is closed to new replies.