• Resolved eugenefvdm

    (@eugenevdm)


    // deprecated if statement
    // if (hash_equals($authHeader, $auth)) {

    // working if statement
    if ( ! empty( $authHeader ) && ! empty( $auth ) && hash_equals( (string) $authHeader, (string) $auth ) ) {
    return $this->handle_webhook_notification($filteredParams);
    } else {
    if ($this->settings[‘logging’] == ‘yes’) {
    SnapLogger::log(‘[App] Auth header on payment does not match plugin settings: [‘ . $this->settings[‘webhook_auth’] . ‘]’);
    }
    return [‘error’ => “Auth header on payment does not match plugin settings.”];
    }

    Without the fix you’ll get this:

    AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given in /home/example/domains/subdomain.example.com/public_html/wp-content/plugins/snapscan-online-payments/SnapScan/woocommerce-snapscan.php:366\nStack trace:\n#0 /home/example/domains/subdomain.example.com/public_html/wp-content/plugins/snapscan-online-payments/SnapScan/woocommerce-snapscan.php(366): hash_equals()\n#1 /home/example/domains/subdomain.example.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(1292): WC_Ecentric_Snapscan->handle_snapscan_webhook_notification()\n#2 /home/example/domains/subdomain.example.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request()\n#3 /home/example/domains/subdomain.example.com/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()\n#4 /home/example/domains/subdomain.example.com/public_html…’

    • This topic was modified 1 week, 2 days ago by eugenefvdm.

You must be logged in to reply to this topic.