Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ committed May 13, 2018
1 parent 6bdd170 commit 0e03396
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libraries/src/Form/Rule/EmailRule.php
Expand Up @@ -133,14 +133,17 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry
$domainParts = array_reverse(explode('.', $domain->name));
$status = 0;

if ($emailCount >= count($domainParts))
// Don't run if the email has less segments than the rule.
if ($emailCount < count($domainParts))
{
foreach ($emailParts as $key => $emailPart)
continue;
}

foreach ($emailParts as $key => $emailPart)
{
if (!isset($domainParts[$key]) || $domainParts[$key] == $emailPart || $domainParts[$key] == '*')
{
if ($domainParts[$key] == $emailPart || $domainParts[$key] == '*')
{
$status++;
}
$status++;
}
}

Expand Down

0 comments on commit 0e03396

Please sign in to comment.