Getting array_merge() error

#512559
  • Resolved gamernamer
    Rank Math free

    Hey! Something strange happend for one of our admins.
    (The error did not showed up for me but one of our admins experienced the problem)

    He tried to edit pages in our backend but a fatal error was caught.

    [14-Jan-2023 15:28:47 UTC] PHP Fatal error:  Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /home/u885534680/domains/beerballer.com/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-blocks.php:71
    Stack trace:
    #0 /home/u885534680/domains/beerballer.com/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-blocks.php(71): array_merge()
    #1 /home/u885534680/domains/beerballer.com/public_html/wp-includes/class-wp-hook.php(310): RankMath\Schema\Blocks->block_categories()
    #2 /home/u885534680/domains/beerballer.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #3 /home/u885534680/domains/beerballer.com/public_html/wp-includes/block-editor.php(85): apply_filters()
    #4 /home/u885534680/domains/beerballer.com/public_html/wp-admin/edit-form-blocks.php(81): get_block_categories()
    #5 /home/u885534680/domains/beerballer.com/public_html/wp-admin/post.php(187): require('/home/u88553468...')
    #6 {main}
      thrown in /home/u885534680/domains/beerballer.com/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-blocks.php on line 71

    Im not sure what is causing the error (because I could edit the pages as normal) but it seems so that $categories isn’t an array… Adding a small check beforeis_array($categories) ? $categories : $categories = []; fixed my error. Not sure if that is the best option but would be happy if you could add a small check if $categories is an array before merging šŸ™‚

    Thanks in advance!
    Justus

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay and for any inconvenience this issue may have caused you.

    We appreciate the modification you have shared for fixing the issue.

    Could you please also share the steps from one of your site admins to reproduce the error so we can also replicate the issue on our test site as well?

    Looking forward to helping you.

    Thank you.

    Hey,
    I’ll need to check a bit deeper. Will take a look at the weekend on this!
    The User where the problem occured said that the error has been fixed.. – but it hasn’t šŸ˜€

    I’ve just one guess right now. It seems that he has the wordpress rank “Shop Manager” (not Admin) – I think this one is from WooCommerce and when he tries to edit a page the error occures. I’ll need to debug this a bit deeper. Perhaps it’s a combination with another plugin…

    If you could check if the error also occures on your site (when the user is a Shop Manager) that would be very helpful!

    Best, Justus

    Hello,

    Sure, let us know how this goes.

    Meanwhile, we have tried the Shop Manager role to replicate the issue, but it seems to be working fine.

    Looking forward to helping you.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Getting array_merge() error’ is closed to new replies.