Nilsemann2 Posted March 14, 2013 Share Posted March 14, 2013 (edited) Hello! I've suddenly got an error that says: There is 1 error : Invalid e-mail address when customers try to log in, create a new account or sign up to the newsletter. The same error message occurs when I try to log into the back office. Prestashop version is 1.4.8.2 and the server has been upgraded to PHP 5.3.3 I have not changed anything in codes and the store has worked fine since July 2012. The error occured late in February 2013. Anybody have an idea what this could be, please? Regards Nils Edited March 15, 2013 by Nilsemann2 (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted March 14, 2013 Share Posted March 14, 2013 ps uses class/Validate.php this function: at or around line 40 /** * Check for e-mail validity * * @param string $email e-mail address to validate * @return boolean Validity is ok or not */ public static function isEmail($email) { return !empty($email) && preg_match('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui', $email); } check that the code above is the same as posted. check that the file date (using ftp) has not been recently updated. check that a module has not installed a class override? -->override/classes (look for Validate.php) Link to comment Share on other sites More sharing options...
Radu Posted March 14, 2013 Share Posted March 14, 2013 Do you have an override for the Customer class/model? if yes, can you please post the code here? Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 Thanks for the reply. elpatron: The code in Validate.php is the same one that you posted. validated.php has the same date as the rest of the files and is unaffected since 07/24/12. That was when the system was installed. I can not find Validate.php in override/classes Link to comment Share on other sites More sharing options...
El Patron Posted March 14, 2013 Share Posted March 14, 2013 make sure to follow up on radu's post. what overrides do you have in the override/classes folder? no need to document the files prefixed with _ Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 In override / classes there are two files without the prefix _ The files are FirePHP.class.php and fb.php Link to comment Share on other sites More sharing options...
El Patron Posted March 14, 2013 Share Posted March 14, 2013 anything in the override/controllers beside index.php else look (via ftp)...for any file updates (dates) that are on or near when your site stopped accepting login's... Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 No nothing in override/controllers either, just the index-file. I will check for file updates. Do you think this error may have something to do with that the server's php version was upgraded recently? Link to comment Share on other sites More sharing options...
El Patron Posted March 14, 2013 Share Posted March 14, 2013 (edited) No nothing in override/controllers either, just the index-file. I will check for file updates. Do you think this error may have something to do with that the server's php version was upgraded recently? try this (check compatibility) back office-->tools-->configuration information scroll to the bottom should look like this: http://screencast.com/t/04MPCslg1DSL Edited March 14, 2013 by elpatron (see edit history) Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 I would do that, but the same error message occurs when I try to log into the back office. So I am a bit lost here :-( Link to comment Share on other sites More sharing options...
El Patron Posted March 14, 2013 Share Posted March 14, 2013 well...that is a mess....as you can guess...guessing your problem was difficult enough...now even more so you should just go look for updated files... and it may not hurt to contact your hosting company....about php upgrade.... also you could create a subomain and additional db, place a fresh 1.4.8 prestashop there and try installing it, see if it warns you of incompatibility issues. Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 Well, thank you so much for trying to help me. I have come to the same idea as you, install a fresh 1.4.8 and test the compatibility. I will come back here with the results. Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 (edited) I have now tried to install the fresh version of PS 1.4.8.2 and a fresh database on the same server. As you can see below, both the system compatibility and database configuration are OK, but when it comes to the shop configuration I get the same error "This e-mail address is invalid!" Strange error, but this has to be something with the server configuration to do since I've installed the same version and enjoyed a working shop for over half a year? Or what do you think? Edited March 14, 2013 by Nilsemann2 (see edit history) Link to comment Share on other sites More sharing options...
benjamin utterback Posted March 14, 2013 Share Posted March 14, 2013 Hello, this may have to do with your server configuration. Test it out on a local host to see if it installs fine. It should, then contact your hosting provider, could be a php setting but I am not positive. Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 14, 2013 Author Share Posted March 14, 2013 (edited) Yes, it installs fine on another server. Edit: I also tried to install the newest Prestashop version 1.5.3.1 and get the same error at Shop Configuration! Edited March 15, 2013 by Nilsemann2 (see edit history) Link to comment Share on other sites More sharing options...
Radu Posted March 15, 2013 Share Posted March 15, 2013 just an experiment: replace/create the file in override/classes/Validate.php with this content: <?php class Validate extends ValidateCore { public static function isEmail($email) { return !empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL); } } Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 15, 2013 Author Share Posted March 15, 2013 just an experiment: replace/create the file in override/classes/Validate.php with this content: <?php class Validate extends ValidateCore { public static function isEmail($email) { return !empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL); } } Good thinking, but unfortunately it does not work, get the same error. Link to comment Share on other sites More sharing options...
Radu Posted March 15, 2013 Share Posted March 15, 2013 and if you return true? at least to see if the reason is the email validation Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 15, 2013 Author Share Posted March 15, 2013 and if you return true? at least to see if the reason is the email validation Nope, same error. Link to comment Share on other sites More sharing options...
Radu Posted March 15, 2013 Share Posted March 15, 2013 interesting, let's see at least what we have passed in the validation method. instead of that return place CODE]echo $email; exit;[/code] public static function isEmail($email) { echo $email;exit; } maybe here the email variables arrives empty Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 15, 2013 Author Share Posted March 15, 2013 Ok, I made a stupid mistake with the file transfer, sorry. When I return with true, I get another error: "failed to verify username and password" and when I echo $email I get my e-mail as output. Link to comment Share on other sites More sharing options...
Radu Posted March 15, 2013 Share Posted March 15, 2013 at this point it's becoming tricky for me. If you want I can debug directly on your shop for a few min to see if I can find something Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 15, 2013 Author Share Posted March 15, 2013 (edited) That's very nice of you to offer, thank you, maybe we can so that later? But for now I've discovered that I can log in as customer and also in the BO if I use return true in override/classes/Validate.php <?php class Validate extends ValidateCore { public static function isEmail($email) { return true; } } However this does not solve the problem because I have not changed anything in Validate.php since I installed the system.. and now no new e-mails gets validated. Could it has something to do with the PHP upgrade and its handling of e-mail validation? Edited March 15, 2013 by Nilsemann2 (see edit history) Link to comment Share on other sites More sharing options...
Radu Posted March 15, 2013 Share Posted March 15, 2013 Just to confirm, if you return true, the account creation works correctly? If yes you just need to see what is wrong with the regex that validates the email or try to implement another way. However the best solution is to find the reason of the issue. Link to comment Share on other sites More sharing options...
Nilsemann2 Posted March 15, 2013 Author Share Posted March 15, 2013 (edited) I can confirm that. When I create a new account or login as an existing customer, everything works correctly. Even when I login to the BO, it works :-) But now I can write what ever I want in the email field when I create a new customer. That is not optimal. Here is the code in Validation.php who makes the error happen: public static function isEmail($email) { return !empty($email) && preg_match('/^[a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z0-9]+$/ui', $email); } I cant see anything wrong here, can you? I even replaced Validate.php with the orginal file today, but got the same error. Edit: I have a theory that this can have something to do with the preg_match() function. It fails in PHP 5.3.3 and returns false.. Edited March 15, 2013 by Nilsemann2 (see edit history) Link to comment Share on other sites More sharing options...
Radu Posted March 16, 2013 Share Posted March 16, 2013 it seems so, but what's strange is that even with the filter I sent last time: return !empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL); it's not working. Maybe this is just as a shortcode for preg_match I just found something here: http://bytes.com/topic/php/answers/780352-weird-issue-php-preg_match read the last reply meantime you can use a raw php check by checking if the email has @ at least a . for the domain Link to comment Share on other sites More sharing options...
Recommended Posts