Jump to content

Edit History

Fady S. Ghatas

Fady S. Ghatas

Hello,

I've a problem after upgrading from Prestashop 1.7.1.1 to 1.7.6.2; I can't add new customers through the BO. I get this error message:

"An unexpected error occurred. [PrestaShop\PrestaShop\Core\Domain\Customer\Exception\CustomerException code 0]"

 

Steps to reproduce

  1. Upgrade from 1.7.1 to 1.7.6
  2. Go to the "Add New Customer" form in the backoffice. 
  3. Fill all fields
  4. You will get the error message mentioned above.

 

I've tried several solutions but none worked:

  1. Enable/Disable phone and phone_mobile in Customers>Addresses>Set required fields for this section.
  2. Add/Remove phone field in address format in Translations>Locations>[COUNTRY]>Address format.

 

Debugging

I tried to debug the problem further, so I've added var_dump in /src/Adapter/Customer/CommandHandler/AddCustomerHandler.php after assertRequiredFieldsAreNotMissing and got the following result; the form wants a value of 'phone':

object(Customer)#4148 (61) {
  ...
  ["phone"]=>
  NULL
  ...
  ["fieldsRequired":protected]=>
  array(6) {
    [0]=>
    string(8) "lastname"
    [1]=>
    string(9) "firstname"
    [2]=>
    string(5) "email"
    [3]=>
    string(5) "phone"
    [4]=>
    string(6) "passwd"
    [5]=>
    string(8) "birthday"
  }
  ["fieldsSize":protected]=>
  array(7) {
    ["lastname"]=>
    int(255)
    ["firstname"]=>
    int(255)
    ["email"]=>
    int(128)
    ["phone"]=>
    int(32)
    ["passwd"]=>
    int(60)
    ["note"]=>
    int(65000)
    ["reset_password_token"]=>
    int(40)
  }
  ["fieldsValidate":protected]=>
  array(29) {
    ...
    ["phone"]=>
    string(13) "isPhoneNumber"
    ...
  }
  ["def":protected]=>
  array(4) {
    ["table"]=>
    string(8) "customer"
    ["primary"]=>
    string(11) "id_customer"
    ["fields"]=>
    array(33) {
      ...
      ["phone"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(13) "isPhoneNumber"
        ["size"]=>
        int(32)
        ["required"]=>
        bool(true)
      }
      ...
    }
    ["classname"]=>
    string(8) "Customer"
  }
  ["update_fields":protected]=>
  NULL
  ["force_id"]=>
  bool(false)
}

Also, when I tried to debug the CustomerException, I got that the form has invalid field values. 

 

Any suggestions?

 

Thank you

Fady S. Ghatas

Fady S. Ghatas

Hello,

I've a problem after upgrading from Prestashop 1.7.1.1 to 1.7.6.2; I can't add new customers through the BO. I get this error message:

"An unexpected error occurred. [PrestaShop\PrestaShop\Core\Domain\Customer\Exception\CustomerException code 0]"

 

Steps to reproduce

  1. Upgrade from 1.7.1 to 1.7.6
  2. Go to the "Add New Customer" form in the backoffice. 
  3. Fill all fields
  4. You will get the error message mentioned above.

 

I've tried several solutions but none worked:

  1. Enable/Disable phone and phone_mobile in Customers>Addresses>Set required fields for this section.
  2. Add/Remove phone field in address format in Translations>Locations>[COUNTRY]>Address format.

 

Debugging

I tried to debug the problem further, so I've added var_dump in /src/Adapter/Customer/CommandHandler/AddCustomerHandler.php after assertRequiredFieldsAreNotMissing and got the following result; the form wants a value of 'phone':

object(Customer)#4148 (61) {
  ["phone"]=>
  NULL
  ["id"]=>
  NULL
  ["id_shop"]=>
  int(1)
  ["id_shop_group"]=>
  NULL
  ["secure_key"]=>
  NULL
  ["note"]=>
  NULL
  ["id_gender"]=>
  int(1)
  ["id_default_group"]=>
  int(3)
  ["id_lang"]=>
  NULL
  ["lastname"]=>
  string(4) "Last"
  ["firstname"]=>
  string(5) "First"
  ["birthday"]=>
  string(10) "1904-06-08"
  ["email"]=>
  string(16) "[email protected]"
  ["newsletter"]=>
  NULL
  ["ip_registration_newsletter"]=>
  NULL
  ["newsletter_date_add"]=>
  NULL
  ["optin"]=>
  bool(false)
  ["website"]=>
  NULL
  ["company"]=>
  NULL
  ["siret"]=>
  NULL
  ["ape"]=>
  NULL
  ["outstanding_allow_amount"]=>
  NULL
  ["show_public_prices"]=>
  int(0)
  ["id_risk"]=>
  NULL
  ["max_payment_days"]=>
  NULL
  ["passwd"]=>
  string(60) "$2y$10$ym1YEAffpfxljNJ9Tq3nZuVCkVRWzFNqHLwz6c3mpC4660wZqLynS"
  ["last_passwd_gen"]=>
  NULL
  ["active"]=>
  bool(true)
  ["is_guest"]=>
  int(0)
  ["deleted"]=>
  int(0)
  ["date_add"]=>
  NULL
  ["date_upd"]=>
  NULL
  ["years"]=>
  NULL
  ["days"]=>
  NULL
  ["months"]=>
  NULL
  ["geoloc_id_country"]=>
  NULL
  ["geoloc_id_state"]=>
  NULL
  ["geoloc_postcode"]=>
  NULL
  ["logged"]=>
  int(0)
  ["id_guest"]=>
  NULL
  ["groupBox"]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  ["reset_password_token"]=>
  NULL
  ["reset_password_validity"]=>
  NULL
  ["webserviceParameters":protected]=>
	 ...
  }
  ["id_shop_list"]=>
  array(0) {
  }
  ["get_shop_from_context":protected]=>
  bool(true)
  ["table":protected]=>
  string(8) "customer"
  ["identifier":protected]=>
  string(11) "id_customer"
  ["fieldsRequired":protected]=>
  array(6) {
    [0]=>
    string(8) "lastname"
    [1]=>
    string(9) "firstname"
    [2]=>
    string(5) "email"
    [3]=>
    string(5) "phone"
    [4]=>
    string(6) "passwd"
    [5]=>
    string(8) "birthday"
  }
  ["fieldsSize":protected]=>
  array(7) {
    ["lastname"]=>
    int(255)
    ["firstname"]=>
    int(255)
    ["email"]=>
    int(128)
    ["phone"]=>
    int(32)
    ["passwd"]=>
    int(60)
    ["note"]=>
    int(65000)
    ["reset_password_token"]=>
    int(40)
  }
  ["fieldsValidate":protected]=>
  array(29) {
    ["secure_key"]=>
    string(5) "isMd5"
    ["lastname"]=>
    string(6) "isName"
    ["firstname"]=>
    string(6) "isName"
    ["email"]=>
    string(7) "isEmail"
    ["phone"]=>
    string(13) "isPhoneNumber"
    ["passwd"]=>
    string(8) "isPasswd"
    ["id_gender"]=>
    string(12) "isUnsignedId"
    ["birthday"]=>
    string(11) "isBirthDate"
    ["newsletter"]=>
    string(6) "isBool"
    ["optin"]=>
    string(6) "isBool"
    ["website"]=>
    string(5) "isUrl"
    ["company"]=>
    string(13) "isGenericName"
    ["siret"]=>
    string(7) "isSiret"
    ["ape"]=>
    string(5) "isApe"
    ["outstanding_allow_amount"]=>
    string(7) "isFloat"
    ["show_public_prices"]=>
    string(6) "isBool"
    ["id_risk"]=>
    string(13) "isUnsignedInt"
    ["max_payment_days"]=>
    string(13) "isUnsignedInt"
    ["active"]=>
    string(6) "isBool"
    ["deleted"]=>
    string(6) "isBool"
    ["note"]=>
    string(11) "isCleanHtml"
    ["is_guest"]=>
    string(6) "isBool"
    ["id_shop"]=>
    string(12) "isUnsignedId"
    ["id_shop_group"]=>
    string(12) "isUnsignedId"
    ["id_lang"]=>
    string(12) "isUnsignedId"
    ["date_add"]=>
    string(6) "isDate"
    ["date_upd"]=>
    string(6) "isDate"
    ["reset_password_token"]=>
    string(6) "isSha1"
    ["reset_password_validity"]=>
    string(12) "isDateOrNull"
  }
  ["fieldsRequiredLang":protected]=>
  array(0) {
  }
  ["fieldsSizeLang":protected]=>
  array(0) {
  }
  ["fieldsValidateLang":protected]=>
  array(0) {
  }
  ["tables":protected]=>
  array(0) {
  }
  ["image_dir":protected]=>
  NULL
  ["image_format":protected]=>
  string(3) "jpg"
  ["translator":protected]=>
  NULL
  ["def":protected]=>
  array(4) {
    ["table"]=>
    string(8) "customer"
    ["primary"]=>
    string(11) "id_customer"
    ["fields"]=>
    array(33) {
      ["secure_key"]=>
      array(3) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(5) "isMd5"
        ["copy_post"]=>
        bool(false)
      }
      ["lastname"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(6) "isName"
        ["required"]=>
        bool(true)
        ["size"]=>
        int(255)
      }
      ["firstname"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(6) "isName"
        ["required"]=>
        bool(true)
        ["size"]=>
        int(255)
      }
      ["email"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(7) "isEmail"
        ["required"]=>
        bool(true)
        ["size"]=>
        int(128)
      }
      ["phone"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(13) "isPhoneNumber"
        ["size"]=>
        int(32)
        ["required"]=>
        bool(true)
      }
      ["passwd"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(8) "isPasswd"
        ["required"]=>
        bool(true)
        ["size"]=>
        int(60)
      }
      ["last_passwd_gen"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["copy_post"]=>
        bool(false)
      }
      ["id_gender"]=>
      array(2) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(12) "isUnsignedId"
      }
      ["birthday"]=>
      array(3) {
        ["type"]=>
        int(5)
        ["validate"]=>
        string(11) "isBirthDate"
        ["required"]=>
        bool(true)
      }
      ["newsletter"]=>
      array(2) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
      }
      ["newsletter_date_add"]=>
      array(2) {
        ["type"]=>
        int(5)
        ["copy_post"]=>
        bool(false)
      }
      ["ip_registration_newsletter"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["copy_post"]=>
        bool(false)
      }
      ["optin"]=>
      array(2) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
      }
      ["website"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(5) "isUrl"
      }
      ["company"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(13) "isGenericName"
      }
      ["siret"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(7) "isSiret"
      }
      ["ape"]=>
      array(2) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(5) "isApe"
      }
      ["outstanding_allow_amount"]=>
      array(3) {
        ["type"]=>
        int(4)
        ["validate"]=>
        string(7) "isFloat"
        ["copy_post"]=>
        bool(false)
      }
      ["show_public_prices"]=>
      array(3) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
        ["copy_post"]=>
        bool(false)
      }
      ["id_risk"]=>
      array(3) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(13) "isUnsignedInt"
        ["copy_post"]=>
        bool(false)
      }
      ["max_payment_days"]=>
      array(3) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(13) "isUnsignedInt"
        ["copy_post"]=>
        bool(false)
      }
      ["active"]=>
      array(3) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
        ["copy_post"]=>
        bool(false)
      }
      ["deleted"]=>
      array(3) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
        ["copy_post"]=>
        bool(false)
      }
      ["note"]=>
      array(4) {
        ["type"]=>
        int(6)
        ["validate"]=>
        string(11) "isCleanHtml"
        ["size"]=>
        int(65000)
        ["copy_post"]=>
        bool(false)
      }
      ["is_guest"]=>
      array(3) {
        ["type"]=>
        int(2)
        ["validate"]=>
        string(6) "isBool"
        ["copy_post"]=>
        bool(false)
      }
      ["id_shop"]=>
      array(3) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(12) "isUnsignedId"
        ["copy_post"]=>
        bool(false)
      }
      ["id_shop_group"]=>
      array(3) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(12) "isUnsignedId"
        ["copy_post"]=>
        bool(false)
      }
      ["id_default_group"]=>
      array(2) {
        ["type"]=>
        int(1)
        ["copy_post"]=>
        bool(false)
      }
      ["id_lang"]=>
      array(3) {
        ["type"]=>
        int(1)
        ["validate"]=>
        string(12) "isUnsignedId"
        ["copy_post"]=>
        bool(false)
      }
      ["date_add"]=>
      array(3) {
        ["type"]=>
        int(5)
        ["validate"]=>
        string(6) "isDate"
        ["copy_post"]=>
        bool(false)
      }
      ["date_upd"]=>
      array(3) {
        ["type"]=>
        int(5)
        ["validate"]=>
        string(6) "isDate"
        ["copy_post"]=>
        bool(false)
      }
      ["reset_password_token"]=>
      array(4) {
        ["type"]=>
        int(3)
        ["validate"]=>
        string(6) "isSha1"
        ["size"]=>
        int(40)
        ["copy_post"]=>
        bool(false)
      }
      ["reset_password_validity"]=>
      array(3) {
        ["type"]=>
        int(5)
        ["validate"]=>
        string(12) "isDateOrNull"
        ["copy_post"]=>
        bool(false)
      }
    }
    ["classname"]=>
    string(8) "Customer"
  }
  ["update_fields":protected]=>
  NULL
  ["force_id"]=>
  bool(false)
}

Also, when I tried to debug the CustomerException, I got that the form has invalid field values. 

 

Any suggestions?

 

Thank you

×
×
  • Create New...