PHP warning in country_currency_check()
-
Current implementation in klarna-payments-for-woocommerce/classes/class-wc-gateway-klarna-payments.php in WC_Gateway_Klarna_Payments::country_currency_check at line 230 has a flaw:
$klarna_country = kp_get_klarna_country( $order );
$country = strtolower( $klarna_country );
$country_values = KP_Form_Fields::$kp_form_auto_countries[ $country ];
if ( ! isset( KP_Form_Fields::$kp_form_auto_countries[ $country ] ) ) {
kp_unset_session_values();
return new WP_Error( 'country', "Country ({$country}) is not supported by Klarna Payments." );
}You are trying to access array value by key (highlighted in bold) first and then do isset() check and exit the function if it’s not found. Unfortunately this generates a PHP warning for undefined array key every time this method is called.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.