rokity Posted January 6, 2016 Share Posted January 6, 2016 Hi... I'm new on Prestashop, I installed it on mu ubuntu latop, with apache,mysql and PHP 7. All works fine until I try to create a new account for customer and it fails when I click button "Registrer" with this error : Fatal error: Uncaught Error: Access to undeclared static property: Validate::$data in /var/www/html/prestashop/classes/ObjectModel.php:1149 Stack trace: #0 /var/www/html/prestashop/controllers/front/AuthController.php(437): ObjectModelCore->validateController() #1 /var/www/html/prestashop/controllers/front/AuthController.php(256): AuthControllerCore->processSubmitAccount() #2 /var/www/html/prestashop/classes/controller/Controller.php(178): AuthControllerCore->postProcess() #3 /var/www/html/prestashop/classes/Dispatcher.php(367): ControllerCore->run() #4 /var/www/html/prestashop/index.php(28): DispatcherCore->dispatch() #5 {main} thrown in /var/www/html/prestashop/classes/ObjectModel.php on line 1149 The page is : "http://127.0.0.1/prestashop/login" form where I get Error. I search on google for all day , but there isn't a solution.Can you help me ?Please Link to comment Share on other sites More sharing options...
vekia Posted January 6, 2016 Share Posted January 6, 2016 Hi... I'm new on Prestashop, I installed it on mu ubuntu latop, with apache,mysql and PHP 7. All works fine until I try to create a new account for customer and it fails when I click button "Registrer" with this error : Fatal error: Uncaught Error: Access to undeclared static property: Validate::$data in /var/www/html/prestashop/classes/ObjectModel.php:1149 Stack trace: #0 /var/www/html/prestashop/controllers/front/AuthController.php(437): ObjectModelCore->validateController() #1 /var/www/html/prestashop/controllers/front/AuthController.php(256): AuthControllerCore->processSubmitAccount() #2 /var/www/html/prestashop/classes/controller/Controller.php(178): AuthControllerCore->postProcess() #3 /var/www/html/prestashop/classes/Dispatcher.php(367): ControllerCore->run() #4 /var/www/html/prestashop/index.php(28): DispatcherCore->dispatch() #5 {main} thrown in /var/www/html/prestashop/classes/ObjectModel.php on line 1149 The page is : "http://127.0.0.1/prestashop/login" form where I get Error. I search on google for all day , but there isn't a solution. Can you help me ? Please what php version you've got on your local ubuntu lamp configuration? seems like it's a case of php version. Link to comment Share on other sites More sharing options...
vekia Posted January 6, 2016 Share Posted January 6, 2016 (edited) php 7.0 prestashop 1.6 doesnt support php 7.0 downgrade it, because you will not be able to use the prestashop 1.6.x on this kind of lamp configuration Edited January 6, 2016 by vekia (see edit history) 1 Link to comment Share on other sites More sharing options...
rokity Posted January 6, 2016 Author Share Posted January 6, 2016 I have php 7. This is the response for "php --version" command: php --version PHP 7.0.1-5+deb.sury.org~wily+1 (cli) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies What's wrong?Thank for the help. Link to comment Share on other sites More sharing options...
rokity Posted January 6, 2016 Author Share Posted January 6, 2016 What is the best version of PHP for Prestashop 1.6 ? Link to comment Share on other sites More sharing options...
vekia Posted January 6, 2016 Share Posted January 6, 2016 in my opinion 5.5.1 Link to comment Share on other sites More sharing options...
rokity Posted January 7, 2016 Author Share Posted January 7, 2016 It works fine with php 5.5. Thank you. Link to comment Share on other sites More sharing options...
murc134 Posted December 15, 2016 Share Posted December 15, 2016 Even though there might be a problem with the original Prestashop code and PHP7, I found this solution that supports PHP7... http://stackoverflow.com/questions/35406163/presta-shop-errors-on-registration 1down vote /home/unikalna/public_html/classes/ObjectModel.php:1032 OLD CODE Replace with below code block NEW CODE Link to comment Share on other sites More sharing options...
karaya Posted February 6, 2017 Share Posted February 6, 2017 The support for Prestashop 1.5.4.1 on PHP7 File: /classes/ObjectModel.php Line number: approx. 981 Original code part: // Checking for fields validity // Hack for postcode required for country which does not have postcodes if (($value = Tools::getValue($field, $this->{$field})) || ($field == 'postcode' && $value == '0')) { if (isset($data['validate']) && !Validate::$data['validate']($value) && (!empty($value) || $data['required'])) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.'); else { if (isset($data['copy_post']) && !$data['copy_post']) continue; if ($field == 'passwd') { if ($value = Tools::getValue($field)) $this->{$field} = Tools::encrypt($value); } else $this->{$field} = $value; } } } New code part: // Checking for fields validity // Hack for postcode required for country which does not have postcodes if (($value = Tools::getValue($field, $this->{$field})) || ($field == 'postcode' && $value == '0')) { if (isset($data['validate']) && !call_user_func('Validate::'.$data['validate'],$value) && (!empty($value) || $data['required'])) $errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.'); else { if (isset($data['copy_post']) && !$data['copy_post']) continue; if ($field == 'passwd') { if ($value = Tools::getValue($field)) $this->{$field} = Tools::encrypt($value); } else $this->{$field} = $value; } } } 1 Link to comment Share on other sites More sharing options...
Empire121 Posted December 5, 2017 Share Posted December 5, 2017 @karaya Thank you 1000 times. Your code solved my problem! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now