• Resolved wabrbhome

    (@wabrbhome)


    After installing and configuring the Facebook for Woocommerce plugin, I wasn’t able to connect to my wp-admin dashboard and the website was inaccessible to clients…

    The logs are indicating a problem in the plugin (see logs below). Can you please help me? I needed to deactivate the plugin due to this problem…

    Logs:
    An error of type E_ERROR was caused in line 76 of the file /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Events/AAMSettings.php. Error message: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Events/AAMSettings.php:76
    Stack trace:
    #0 /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/includes/Events/AAMSettings.php(76): array_key_exists()

    #1 /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/facebook-commerce.php(452): WooCommerce\Facebook\Events\AAMSettings::build_from_pixel_id()

    #2 /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/facebook-commerce.php(343): WC_Facebookcommerce_Integration->load_aam_settings_of_pixel()

    #3 /home/…/domains/…/public_html/wp-content/plugins/facebook-for-woocommerce/class-wc-facebookcommerce.php(603): WC_Facebookcommerce_Integration->__construct()

    #4 /home/…/domains/…/public_html/wp-includes/class-wp-hook.php(308): WC_Facebookcommerce->get_integration()

    #5 /home/…/domains/…/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

    #6 /home/…/domains/…/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()

    #7 /home/…/domains/…/public_html/wp-settings.php(623): do_action()

Viewing 3 replies - 1 through 3 (of 3 total)
  • @wabrbhome I have the same issue.

    Done a little more digging and it seems that https://www.facebook.net/ domain is currently with an error “ERR_NAME_NOT_RESOLVED”.

    nslookup

    returns:

    ** server can't find www.facebook.net: NXDOMAIN

    Digging the code further it seems that this function in /facebook-for-woocommerce/includes/Events/AAMSettings.php:69 does not take into account that $response might not be a is_wp_error() but can be still empty. So “array_key_exists()” check fails cause there is no array there in the first place.

    public static function build_from_pixel_id( $pixel_id ) {
    		$url      = self::get_url( $pixel_id );
    		$response = wp_remote_get( $url );
    		if ( is_wp_error( $response ) ) {
    			return null;
    		} else {
    			$response_body = json_decode( wp_remote_retrieve_body( $response ), true );
    			if ( ! array_key_exists( 'errorMessage', $response_body ) ) {
    				$response_body['matchingConfig']['pixelId'] = $pixel_id;
    				return new AAMSettings( $response_body['matchingConfig'] );
    			}
    		}
    		return null;
    }

    Here is the “quick fix” for this function (which will still through GET “API” response as its 500):

    public static function build_from_pixel_id( $pixel_id ) {
            $url      = self::get_url( $pixel_id );
            $response = wp_remote_get( $url );
    
            if ( is_wp_error( $response ) ) {
                return null;
            }
    
            $response_body = json_decode( wp_remote_retrieve_body( $response ), true );
    
            if ( ! $response_body || array_key_exists( 'errorMessage', $response_body ) ) {
                return null;
            }
    
            $response_body['matchingConfig']['pixelId'] = $pixel_id;
            return new AAMSettings( $response_body['matchingConfig'] );
    }

    Hopefully we will get a fix in next release.

    • This reply was modified 1 year, 1 month ago by evscoding.
    Plugin Author Rodrigue T .a11n

    (@rawdreeg)

    Thanks, @evscoding, for looking into this.


    We have a opened a PR fixing this issue:

    https://github.com/woocommerce/facebook-for-woocommerce/pull/2558

    Thanks,

    R

    Plugin Author Gan Eng Chin

    (@ecgan)

    The fix for this issue has been released in version 3.0.25.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin Fatal Error | Site Inaccessible’ is closed to new replies.