Found a Bug on GoogleCards most recent extension, main.ERROR: Warning: array_keys() expects parameter 1 to be array, null given in ... public_html/app/code/WeltPixel/GoogleCards/Block/GoogleCards.php on line 354 [] []

Comments

6 comments

  • Official comment
    Avatar
    Support

    Hi everyone! Our dev team has already been made aware of this issue for Configurable Products related to the Rich Snippets extension. A fix has already been developed and it'll be included in the next version of the extension, as well as all Pearl Theme Packs.

    We hope to have the new release out within a few days, and apart from the regular fixes, improvements, and optimizations, we'll also be confirming compatibility with the newly released Magento 2.4.2! We announce all new Product Releases via Newsletter, so make sure you subscribe on weltpixel.com if you haven't done so yet! :)

    Comment actions Permalink
  • Avatar
    Jason Becker

    I had to workaround it, by checking if the array was set, and creating empty array if it wasn't.... I'm not the best PHP programmer by any means... so my correction may have been sub-optimal.

                $usedproductAttributes = $product->getData('_cache_instance_used_product_attributes');

                if (isset($usedproductAttributes)) {

                    $productAttributes = array_keys($usedproductAttributes);

                } else {

                    $productAttributes = [];

                }
    0
    Comment actions Permalink
  • Avatar
    Eduard

    Hi,
    we are using Pearl Theme 1.10.1, Magento 2.4.1, php 7.4.14 and we have the same error and it is probably caused by php 7.4 because we do not have this problem on php 7.3.23.

    Jason Becker's solution doesn't work.

    Does anyone have the right solution? Weltpixel support has no solution?

    So far, the only solution is to disable WeltPixel_GoogleCards.

    Regards

    Eduard

    0
    Comment actions Permalink
  • Avatar
    Jason Becker

    My system is on PHP 7.3.24, and if it shows up exactly at the same time the bug showed up for me... I think you applied the workaround incorrectly.  They should fix this bug though.

    0
    Comment actions Permalink
  • Avatar
    Eduard

    Hi,

    I also have Magento on php 7.3.24 and there the patch from Jason Becker doesn't work for me, this patch works for me (row 354 inWeltPixel/GoogleCards/Block/GoogleCards.php):

    if (is_array ($ product)) {
    $ productAttributes = array_keys ($ product-> getData ('_ cache_instance_used_product_attributes'));
    }

    Try it.

    Regards

    Eduard

    0
    Comment actions Permalink
  • Avatar
    Eduard

    Hi,

    now I have applied my patch to Magento with php 7.4.14 and my patch works properly.

    Please note that the error occurs with a configurable product, with a simple product there is no error.

    Regards

    Eduard

    0
    Comment actions Permalink

Please sign in to leave a comment.