• Valtteri

    (@valtterih)


    Hi there!

    I’m getting the following warning in the PHP error log when saving a product:

    PHP Warning: Undefined array key “br_labels” in …/plugins/advanced-product-labels-for-woocommerce/includes/custom_post.php on line 1107

    This happens because the $_POST[‘br_labels’] key is not always set, but the plugin tries to access it directly:

    $_POST[‘br_labels’] = apply_filters(‘berocket_apl_wc_save_product’, $_POST[‘br_labels’], $post_id);

    To make this compatible with PHP 8+, it would be good to add a check.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author RazyRx

    (@razyrx)

    Hello,

    Do not heard about this issue before. Do you use product edit page to save products or it is some custom code to update products?

    We will try to fix this issue in next plugin release.

    Regards,
    Oleg

    Thread Starter Valtteri

    (@valtterih)

    Hi Oleg,

    Thanks for your reply!

    We’re using the native WooCommerce product edit page – no custom code for saving products.

    It should be an easy fix – for example (before accessing):

    if ( !isset($_POST['br_labels']) ) {
    $_POST['br_labels'] = [];
    }

    Great to hear that you’ll look into fixing it in the next release!

    Best,
    Valtteri

    Plugin Author RazyRx

    (@razyrx)

    Hello,

    Latest version of plugin must fix this issue.

    Regards,
    Oleg

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

The topic ‘Warnings on PHP 8+ when saving products’ is closed to new replies.