• dyin

    (@dyin)


    I have tried updating my Woocommerce 8.4 to 8.7 and got a fatal error. I have been in contact with Woocommerce and they have send me this way.

    This is what they say:
    The error you’re experiencing seems to be related to the Code Snippets plugin, specifically in the snippet-ops.php file. This error usually occurs when the function array_push is trying to add an element to a null or non-array variable.

    The link to the topic: Critical error from v 8.4 to v 8.7 | WordPress.org

    Has anyone else had the same issue or can anyone help me?

    Thank you in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • HelgaTheViking

    (@helgatheviking)

    looking at the log you posted in the other thread, i would suspect the issue may be your snippet itself.

    array_push(): Argument #1 ($array) must be of type array, null given

    you’ll need to check any snippets for array_push() and make sure the first param is definitely an array… And not null… For example getting some post meta that doesn’t exist yet.

    I saw you say that code snippets was critical so would recommend doing quick debugging by creating a staging site (check out WP staging)

    good luck!

    Thread Starter dyin

    (@dyin)

    @helgatheviking thank you for your help. I rechecked the code and there are no problems with the array_push. The only thing that could be happening is that the PHP code is being activated without being on the correct page or the code is being interpreted by Woocommerce without going through the page.
    As in that case the value will be null. Is there any reason this could be happening.

    The error says the problem is with array_push()… specifically the first parameter is not an array. You can do a basic type check or something before calling array_push() to be sure. It’s hard to say without seeing your entire snippet. If you can post it, I might be able to take a look.

    In general, the Code Snippets plugin loads snippets on the plugins_loaded hook so Woo is active then.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.