Page 2 of 2
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Mon Oct 11, 2010 3:07 pm
by dantheman50_98
Agreed - there is no $pattern = '/^[A-Z0-9._%\-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i'; in the admin\controller\sale\order.php file. Not even a $pattern.
Are we to ignore this file then and just proceed with the files that do contain this code?
Also, if we've already installed opencart how are we supposed to get the new code into the install/controller/step_3.php file?
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Mon Oct 11, 2010 5:40 pm
by jones
dantheman50_98 wrote:
Also, if we've already installed opencart how are we supposed to get the new code into the install/controller/step_3.php file?
this is for new fresh OC installation only, but you can add the mod to install/controller/step_3.php file
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Sun Oct 31, 2010 9:52 pm
by Shark
Qphoria wrote:I've searched around for the holy grail of email regex.. still not found one.
But I was a step ahead with the one place pattern. The day I made this fix I checked in a change to define the pattern once and use that constant. That will be in effect for 1.5.0
I noticed this bug before; I changed the code using:
if (!filter_var(filter_var($this->request->post['email'], FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}
See also:
http://www.charles-reace.com/blog/2008/ ... ate_email/
Or is the change you made to the regex better? (I'm not an professional php-coder). thx.
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Sun Oct 31, 2010 10:08 pm
by Qphoria
Shark wrote:Qphoria wrote:I've searched around for the holy grail of email regex.. still not found one.
But I was a step ahead with the one place pattern. The day I made this fix I checked in a change to define the pattern once and use that constant. That will be in effect for 1.5.0
I noticed this bug before; I changed the code using:
if (!filter_var(filter_var($this->request->post['email'], FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL)) {
$this->error['email'] = $this->language->get('error_email');
}
See also:
http://www.charles-reace.com/blog/2008/ ... ate_email/
Or is the change you made to the regex better? (I'm not an professional php-coder). thx.
Actually it seems the FILTER_SANITIZE_EMAIL does use a regex in the background. I've never even thought about this function for email validation. I wonder if it would in fact be a better more standardized approach. I'll research it more. Thanks!
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Tue Apr 12, 2011 2:39 pm
by myjl
Qphoria wrote:Confirmed.
1. EDIT the following files:
catalog/controller/account/create.php
catalog/controller/account/edit.php
catalog/controller/checkout/guest_step_1.php
catalog/controller/information/contact.php
catalog/model/checkout/order.php
admin/controller/sale/customer.php
admin/controller/sale/order.php
admin/controller/setting/setting.php
install/controller/step_3.php
2. FIND:
Code: Select all
$pattern = '/^[A-Z0-9._%-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
3. REPLACE WITH:
Code: Select all
$pattern = '/^[A-Z0-9._%\-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
We can increase readability by positioning the dash at first or at last inside the brackets.
So, the string will be
Code: Select all
$pattern = '/^[A-Z0-9._%+-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
HTH !
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Tue Apr 12, 2011 9:20 pm
by Qphoria
This has been changed in the latest version to be much simpler anyway. Just use the line from the 1.4.9.4 version of startup.php
Re: [1.4.9.1]Does not accept any email that contains Dash
Posted: Fri Nov 04, 2011 11:03 pm
by ThePath
I did this fix and it seemed to break the orders coming through via email to the store admin?
Have tried reverting back to the old way for the admin->controller->setting->setting.php file see if that works.