• Resolved oreolek

    (@oreolek)


    There is a fatal error in includes/class-wc-gateway-revolut-blocks-support.php file. The function get_option returns false if the option does not exist in the database; if you try to run array_merge on non-array value, PHP throws a fatal error. Please check your argument types better.

    Here’s a simple patch:

    From e8b898b1423d3573754fb62eb9d41fd11a1b3ac3 Mon Sep 17 00:00:00 2001
    From: Aleksandr Yakovlev <keloero@oreolek.me>
    Date: Wed, 19 Mar 2025 11:12:27 +0600
    Subject: [PATCH] Check type on settings

    get_option() returns false if option does not exists, not the
    default value; array_merge() fatally breaks on non-array values.
    ---
    ...lass-wc-gateway-revolut-blocks-support.php | 20 +++++++++++++++----
    1 file changed, 16 insertions(+), 4 deletions(-)

    diff --git a/includes/class-wc-gateway-revolut-blocks-support.php b/includes/class-wc-gateway-revolut-blocks-support.php
    index 48c2543..4b1c4c8 100644
    --- a/includes/class-wc-gateway-revolut-blocks-support.php
    +++ b/includes/class-wc-gateway-revolut-blocks-support.php
    @@ -66,10 +66,22 @@ class WC_Gateway_Revolut_Blocks_Support extends Automattic\WooCommerce\Blocks\Pa
    * Initializes the payment gateway
    */
    public function initialize() {
    - $this->settings = array_merge(
    - get_option( 'woocommerce_revolut_cc_settings', array() ),
    - get_option( 'woocommerce_revolut_pay_settings', array() ),
    - get_option( 'woocommerce_revolut_payment_request_settings', array() )
    + $settings_1 = get_option( 'woocommerce_revolut_cc_settings', array() );
    + if ($settings_1 === false) {
    + $settings_1 = [];
    + }
    + $settings_2 = get_option( 'woocommerce_revolut_pay_settings', array() );
    + if ($settings_2 === false) {
    + $settings_2 = [];
    + }
    + $settings_3 = get_option( 'woocommerce_revolut_payment_request_settings', array() );
    + if ($settings_3 === false) {
    + $settings_3 = [];
    + }
    + $this->settings = array_merge(
    + $settings_1,
    + $settings_2,
    + $settings_3
    );
    }

    --
    2.49.0

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support businessrevolutsupport_jordie

    (@jordiesimrev)

    Hello @oreolek

    Thank you for flagging this — we appreciate you taking the time to point it out and share a patch.
    I will forward this information to our developers.

    I might come back with a couple of follow-up questions.

    Kind Regards,
    Jordie

    Plugin Support businessrevolutsupport_jordie

    (@jordiesimrev)

    Hello @oreolek,

    Could you please tell us which PHP and WooCommerce version you are running?

    Kind Regards,
    Jordie

    Thread Starter oreolek

    (@oreolek)

    php8.3, woocommerce 9.7.1

    Plugin Support businessrevolutsupport_jordie

    (@jordiesimrev)

    Hello @oreolek

    I hope you’re doing well.

    I wanted to follow up on the above. I tried to reproduce the issue locally, but in my case, it didn’t result in a fatal error—so it’s most likely related to your local setup.

    For further investigation, please reach out via our in-app Help section and ask for your case to be escalated.

    Here’s how to get in touch:
    – Open the Revolut Business app
    – Tap your account name (top left corner)
    – Open the “Help” section
    – Scroll down and tap on the “Chat” option
    – Click “Start new chat” (chat bubble icon)

    Thanks again for raising this.

    Kind Regards,
    Jordie

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

The topic ‘Fatal error on 4.18.8 (patch attached)’ is closed to new replies.