• Paul

    (@headwall)


    Hi

    Version 2.5.3 of the plugin is putting loads of warnings into our PHP error logs.

    File: includes/class-wc-sumup-block-gateway.php
    Line: 161 & 162

    The array settings array might not always contain the “enable_pix” or “open_payment_modal” keys. Can you please put some checking to see if those array keys exist (or populate them with sensible defaults)?

    Thanks

    Paul

Viewing 7 replies - 1 through 7 (of 7 total)
  • dlevain2800

    (@dlevain2800)

    Same problem here … lin 161 – class-wc-sumup-block-gateway.php :
    Warning: Undefined array key “enable_pix”

    cariboulette

    (@cariboulette)

    Same problem for me… 10 error messages on my shop :/

    Thread Starter Paul

    (@headwall)

    If you edit includes/class-wc-sumup-block-gateway.php and add the following snippet before the call to wp_localize_script(), it will get rid of the warnings safely:

    if (!array_key_exists('enable_pix', $this->settings)) {
        $this->settings['enable_pix'] = false;
    }
    
    if (!array_key_exists('open_payment_modal', $this->settings)) {
        $this->settings['open_payment_modal'] = false;
    }

    I’ve run this patch on three sites now and the logs are clean again. It will do for now, until the author releases an update.

    cariboulette

    (@cariboulette)

    Thanks for your reply… I tried this and it’s worse!

    Parse error: syntax error, unexpected token “}” in /homepages/45/d901075961/htdocs/wp-content/plugins/sumup-payment-gateway-for-woocommerce/includes/class-wc-sumup-block-gateway.php on line 143

    Notice: La fonction is_embed a été appelée de fa?on incorrecte. Les balises de requête conditionnelle ne fonctionnent pas avant le lancement de la requête. Avant cela, elles renvoient toujours le booléen false. Veuillez lire Débogage dans WordPress (en) pour plus d’informations. (Ce message a été ajouté à la version 3.1.0.) in /homepages/45/d901075961/htdocs/wp-includes/functions.php on line 5865

    Notice: La fonction is_search a été appelée de fa?on incorrecte. Les balises de requête conditionnelle ne fonctionnent pas avant le lancement de la requête. Avant cela, elles renvoient toujours le booléen false. Veuillez lire Débogage dans WordPress (en) pour plus d’informations. (Ce message a été ajouté à la version 3.1.0.) in /homepages/45/d901075961/htdocs/wp-includes/functions.php on line 5865
    Il y a eu une erreur critique sur ce site.

    Thread Starter Paul

    (@headwall)

    @cariboulette Check that you have pasted the code correctly. Here is the code snippet with a bit more context (between START and END)

    /**
     * Translators: the following error messages are shown to the end user
     */
    $error_general = __('Transaction was unsuccessful. Please check the minimum amount or use another valid card.', 'sumup-payment-gateway-for-woocommerce');
    $error_invalid_form = __('Fill in all required details.', 'sumup-payment-gateway-for-woocommerce');
    
    // START fix log warnings --------------------------------
    if (!array_key_exists('enable_pix', $this->settings)) {
        $this->settings['enable_pix'] = false;
    }
    
    if (!array_key_exists('open_payment_modal', $this->settings)) {
        $this->settings['open_payment_modal'] = false;
    }
    // END fix log warnings ----------------------------------
    
    wp_localize_script('wc-sumup-blocks-integration', 'sumup_gateway_params', [
        'showInstallments' => "$show_installments",
        'sumup_handler_url' => add_query_arg(
            [
                'wc-api' => 'sumup_api_handler',
                'action' => 'create_checkout'
            ],
            home_url() . '/'
        ),
        'showZipCode' => "$show_zipcode",
        'maxInstallments' => $number_of_installments,
        'locale' => "$card_locale",
        'country' => '',
        'status' => '',
        'errors' => [
            'general_error' => "$error_general",
            'invalid_form' => "$error_invalid_form",
            'payment_error' => ''
        ],
        'enablePix' => $this->settings['enable_pix'],
        'openPaymentInModal' => $this->settings['open_payment_modal'],
        'redirectUrl' => ''
    ]);

    I hope this helps

    • This reply was modified 6 months ago by Paul.
    • This reply was modified 6 months ago by Paul.
    cariboulette

    (@cariboulette)

    Thank you so much!!! the 10 messages have disappeared!

    fsda

    (@fsda)

    I also have this problem for no reason, since the update that to bug the itnernet sites using Sumup I have an error Credentials are not valid. Please check and try again. I have redone the API Auth but nothing changes impossible to make it work, if the osuci is not solved knowing that I have not touched anything I leave Sumup and I take another solution for collections…….. =(

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Version 2.5.3 PHP warnings’ is closed to new replies.