TypeError: Argument 2 Passed To CommercePayment Credit Card::validate Number() Must Be Of The Type Array, Boolean Given - Drupal - Fix

typeerror: argument 2 passed to commercepayment credit card::validate number() must be of the type array, boolean given - drupal - fix

TypeError: Argument 2 Passed To CommercePayment Credit Card::validate Number() Must Be Of The Type Array, Boolean Given - Drupal - Fix

Issue : Argument 2 passed to CommercePayment Credit Card::validate Number() must be of the type array, boolean given - Drupal - Fix

How to fix:-

Edit modules/payment/includes/commerce_payment.credit_card.inc and apply patch.

Patch:-

function commerce_payment_validate_credit_card_number($number) {
  $type = CommercePaymentCreditCard::detectType($number);
  +
  +  if (!$type || !is_array($type)) {
  +    return FALSE;
  +  }
  +
  return CommercePaymentCreditCard::validateNumber($number, $type);
}
 function commerce_payment_validate_credit_card_security_code($number, $code) {
  $type = CommercePaymentCreditCard::detectType($number);
  +
  +  if (!$type || !is_array($type)) {
  +    return FALSE;
  +  }
  +
  return CommercePaymentCreditCard::validateSecurityCode($code, $type);
}


Now it is fixed.

Regards.


0 Claps

Show your love in the form of Claps and Comments...

Comments...

No comments found. Leave your reply here.