diff --git a/etemplate/inc/class.etemplate_widget_taglist.inc.php b/etemplate/inc/class.etemplate_widget_taglist.inc.php index de749628f4..33eb4459c3 100644 --- a/etemplate/inc/class.etemplate_widget_taglist.inc.php +++ b/etemplate/inc/class.etemplate_widget_taglist.inc.php @@ -96,7 +96,7 @@ class etemplate_widget_taglist extends etemplate_widget self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($allowed))),''); unset($value[$key]); } - if($this->type == 'taglist-email' && !preg_match('/('.etemplate_widget_url::EMAIL_PREG.')?/iu',$val)) + if($this->type == 'taglist-email' && !preg_match(etemplate_widget_url::EMAIL_PREG, $val)) { self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),''); } diff --git a/etemplate/inc/class.etemplate_widget_url.inc.php b/etemplate/inc/class.etemplate_widget_url.inc.php index b7023fc060..bd969a2ead 100644 --- a/etemplate/inc/class.etemplate_widget_url.inc.php +++ b/etemplate/inc/class.etemplate_widget_url.inc.php @@ -31,9 +31,9 @@ class etemplate_widget_url extends etemplate_widget * * About umlaut or IDN domains: we currently only allow German umlauts in domain part! * - * Same preg is in et2_widget_url Javascript class! + * Same preg is in et2_widget_url Javascript class, but no \x00 allowed and /u modifier for utf8! */ - const EMAIL_PREG = "/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|)\s?<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?$/i"; + const EMAIL_PREG = "/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|)\s?<)?[^\x01-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?$/iu"; /** * Validate input @@ -78,7 +78,7 @@ class etemplate_widget_url extends etemplate_widget } break; case 'url-email': - $this->attrs['preg'] = '/('.self::EMAIL_PREG.')?$/iu'; + $this->attrs['preg'] = self::EMAIL_PREG; break; } } @@ -94,6 +94,7 @@ class etemplate_widget_url extends etemplate_widget switch($this->type) { default: + //error_log("preg_match('{$this->attrs['preg']}', '$value')=".array2string(preg_match($this->attrs['preg'], $value))); self::set_validation_error($form_name,lang("'%1' has an invalid format",$value)/*." !preg_match('$this->attrs[preg]', '$value')"*/,''); break; }