Skip to content

Commit

Permalink
Fix type error in email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
musmanikram committed Feb 20, 2020
1 parent 091a438 commit a933848
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public function setReplyTo($replyto, $name = '')
/**
* Set Recipients
*
* @param string $to
* @param string|array $to
*
* @return Email
*/
Expand Down Expand Up @@ -892,7 +892,7 @@ protected function getMimeMessage()
/**
* Validate Email Address
*
* @param string $email
* @param string|array $email
*
* @return boolean
*/
Expand All @@ -907,7 +907,7 @@ public function validateEmail($email)
{
if (! $this->isValidEmail($val))
{
$this->setErrorMessage(lang('Email.invalidAddress', $val));
$this->setErrorMessage(lang('Email.invalidAddress', [$val]));
return false;
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/system/Email/EmailTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php namespace system\Email;

class EmailTest extends \CIUnitTestCase
{
public function testEmailValidation()
{
$config = config('Email');
$config->validate = true;
$email = new \CodeIgniter\Email\Email($config);
$email->setTo('invalid');
$this->assertStringContainsString('Invalid email address: invalid', $email->printDebugger());
}
}

0 comments on commit a933848

Please sign in to comment.