Jump to content

Prestashopexception Property Customer->Lastname Is Empty (Php 7)


Recommended Posts

Hi, 

 

I've just installed version 1.6.1.3 on a new server and while I've succeeded in working through a few issues, this one is a little beyond me (so far). It occurs when I try to create a new customer account. I enter the email on page 1, then First Name, Last Name, email & password on page 2, click "Register" and get the following.

 

I am running on PHP 7.0.1, with changes as listed at:

 

https://github.com/PrestaShop/PrestaShop/pull/4503/files

 

https://github.com/PrestaShop/PrestaShop/pull/4630/files

 

Any thoughts? All assistance is much appreciated.

 

- Joel

 

[PrestaShopException]

Property Customer->lastname is empty
at line 909 in file classes/ObjectModel.php

904. }
905.
906. $message = $this->validateField($field, $this->$field);
907. if ($message !== true) {
908. if ($die) {
909. throw new PrestaShopException($message);
910. }
911. return $error_return ? $message : false;
912. }
913. }
914.
  • ObjectModelCore->validateFields - [line 246 - classes/ObjectModel.php]
    241. * @return array All object fields
    242. * @throws PrestaShopException
    243. */
    244. public function getFields()
    245. {
    246. $this->validateFields();
    247. $fields = $this->formatFields(self::FORMAT_COMMON);
    248.
    249. // For retro compatibility
    250. if (Shop::isTableAssociated($this->def['table'])) {
    251. $fields = array_merge($fields, $this->getFieldsShop());
  • ObjectModelCore->getFields - [line 487 - classes/ObjectModel.php]
    482.
    483. // Database insertion
    484. if (Shop::checkIdShopDefault($this->def['table'])) {
    485. $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
    486. }
    487. if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values)) {
    488. return false;
    489. }
    490.
    491. // Get object id in database
    492. $this->id = Db::getInstance()->Insert_ID();
  • ObjectModelCore->add - [line 229 - classes/Customer.php] - [2 Arguments]
    224.
    225. /* Can't create a guest customer, if this feature is disabled */
    226. if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
    227. return false;
    228. }
    229. $success = parent::add($autodate, $null_values);
    230. $this->updateGroup($this->groupBox);
    231. return $success;
    232. }
    233.
    234. public function update($nullValues = false)
  • CustomerCore->add - [line 458 - controllers/front/AuthController.php]
    453. // New Guest customer
    454. $customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0);
    455. $customer->active = 1;
    456.
    457. if (!count($this->errors)) {
    458. if ($customer->add()) {
    459. if (!$customer->is_guest) {
    460. if (!$this->sendConfirmationMail($customer)) {
    461. $this->errors[] = Tools::displayError('The email cannot be sent.');
    462. }
    463. }
  • AuthControllerCore->processSubmitAccount - [line 256 - controllers/front/AuthController.php]
    251. if (Tools::isSubmit('SubmitCreate')) {
    252. $this->processSubmitCreate();
    253. }
    254.
    255. if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) {
    256. $this->processSubmitAccount();
    257. }
    258.
    259. if (Tools::isSubmit('SubmitLogin')) {
    260. $this->processSubmitLogin();
    261. }
  • AuthControllerCore->postProcess - [line 178 - classes/controller/Controller.php]
    173. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    174. $this->setMedia();
    175. }
    176.
    177. // postProcess handles ajaxProcess
    178. $this->postProcess();
    179.
    180. if (!empty($this->redirect_after)) {
    181. $this->redirect();
    182. }
    183.
  • ControllerCore->run - [line 367 - classes/Dispatcher.php]
    362. if (isset($params_hook_action_dispatcher)) {
    363. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    364. }
    365.
    366. // Running controller
    367. $controller->run();
    368. } catch (PrestaShopException $e) {
    369. $e->displayMessage();
    370. }
    371. }
    372.
  • DispatcherCore->dispatch - [line 28 - index.php]
    23. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
    24. * International Registered Trademark & Property of PrestaShop SA
    25. */
    26.
    27. require(dirname(__FILE__).'/config/config.inc.php');
    28. Dispatcher::getInstance()->dispatch();
   
Link to comment
Share on other sites

I have now tested this with a fresh install of 1.6.1.3 on PHP 7.0.1 and no multistore this time.

 

Same error.

 

This appears to be where the problem occurs, where "field" = "lastname" and "$this->$field" is empty and does not validate.

 

$message = $this->validateField($field, $this->$field);

 

 

On both installations, if I set the Registration process type to "Standard (account creation with address creation)" I get the foll error:

 

Country cannot be loaded with address->id_country
Country is invalid

 

 

 

 

Also,

 

Without the patches at:

 

https://github.com/PrestaShop/PrestaShop/pull/4503/files

 

https://github.com/PrestaShop/PrestaShop/pull/4630/files

 

The site crashes out with:

 

PHP Fatal error:  
Uncaught Error:
Access to undeclared static property: Validate::$data in /home/admin/web/domain.com/public_html/prestashop/classes/ObjectModel.php:1149

Stack trace:

#0 /home/admin/web/domain.com/public_html/prestashop/controllers/front/AuthController.php(437): ObjectModelCore->validateController()

#1 /home/admin/web/domain.com/public_html/prestashop/controllers/front/AuthController.php(256): AuthControllerCore->processSubmitAccount()

#2 /home/admin/web/domain.com/public_html/prestashop/classes/controller/Controller.php(178): AuthControllerCore->postProcess()

#3 /home/admin/web/domain.com/public_html/prestashop/classes/Dispatcher.php(367): ControllerCore->run()

#4 /home/admin/web/domain.com/public_html/prestashop/index.php(28): DispatcherCore->dispatch()

#5 {main}
  thrown in /home/admin/web/domain.com/public_html/prestashop/classes/ObjectModel.php on line 1149, referer: http://domain.com/prestashop/login?back=my-account
 

Link to comment
Share on other sites

  • 3 years later...

ok, ,changed my calsses/ObjectModel.php file with this one and i am still getting the same error : "• Property Customer->lastname is empty" i am using opc ps module on 1.6.1.24. i made some changes in order to remove some address things but i am %100 sure the i rolled back, so files are original ones but still getting the same error. it started when i placed one test order. after the test order tried to make new one with the option registration. can not resolve it now. deleted that test customer from db and still the same.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...