• Resolved Fahad Mahmood

    (@fahadmahmood)


    <b>Warning</b>: array_key_exists() expects parameter 2 to be array, string given in <b>/var/www/vhosts/tropicalplants.es/test.tropicalplants.es/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php</b> on line <b>155</b><br>
    <br>
    <b>Warning</b>: array_key_exists() expects parameter 2 to be array, string given in <b>/var/www/vhosts/tropicalplants.es/test.tropicalplants.es/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php</b> on line <b>159</b><br>

    Suggestion:
    $settings = is_array($settings)?$settings:array();

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Fahad,
    Thanks for sharring this! What’s strange about this is that all the code above this (this and this) should already ensure this unless the settings data as stored in the order has become corrupted (containing a string instead of an array). Could you check for me what the value of the $settings variable is in the order that throws this error? That way I can make this a bit smarter to ensure that if data is corrupted this is never used in the first place but I’d like to know what it is currently.

    Thread Starter Fahad Mahmood

    (@fahadmahmood)

    In previous version you were using unset even it was just nothing in variable, that was a serious error and client thought maybe its related to my plugin. When i was troubleshooting so i found these issues but luckily i saw your updates and unset issue got fixed. Now these warnings are there, 2nd parameter isn’t array by default. You are right that after saving the value, it will be fixed but until that its bugging. I have no issues, i can simply turn of the debugging mode but in case some developers couldn’t reach this point so they might will report the clients, this plugin is buggy so find an alternative.

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks, can you let me know the current value, that is not an array, which throws this particular warning? I need this to be able to backtrace how this was a string in the first place.

    Because simply casting to array or checking if it’s an array in these particular lines that throw the notice may fix the warning but can still produce errors further downstream.

    Thread Starter Fahad Mahmood

    (@fahadmahmood)

    I am out of that project now, you replied with much delay else i could help you on the spot.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side note to @fahadmahmood Please repeat this three times.

    “Do not use these forums to promote your plugin.”
    “Do not use these forums to promote your plugin.”
    “Do not use these forums to promote your plugin.”

    Introducing that plugin as if it was not yours isn’t cool. I have removed that part of your reply. Don’t do that again please.

    Thread Starter Fahad Mahmood

    (@fahadmahmood)

    @jdembowski i got it.

    One line answer:

    $settings = is_array($settings)?$settings:array();

    Hello, I also have this error.

    I think it is connected with the order separation (I use for this https://wpwham.com/products/multi-order-for-woocommerce/).

    Here the screenshot: https://1drv.ms/u/s!Asaa-3t8-bVzgeAC3PYN-2UuXD5ygQ?e=Wg3NIc

    Have you an idea of how to fix this? If you need, I can share more details or give you access to a staging of my installation.

    Best regards and thanks in advance!

    Plugin Author WP Overnight

    (@wpovernight)

    Hi! Yes, that would be helpful. If you can send an email to [email protected] we’ll do our best to help resolve this issue. Thanks!

    Plugin Contributor Ewout

    (@pomegranate)

    This indeed turned out to be caused by the Multi Order for WooCommerce plugin, which duplicates all order data to ‘sub orders’, but the duplication process had a bug that corrupted the data from PDF invoices and other data that is stored as an array (serializing already serialized data).
    This has been fixed for the upcoming release, with the note that the Multi Order for WooCommerce does in fact duplicate all order data including the invoice number to all sub orders, and this may need to be addressed in that plugin as I think this is undesirable.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘2 Warnings – abstract-wcpdf-order-document.php’ is closed to new replies.