Merge pull request #7884 from owncloud/use-idn_to_ascii-if-available
idn_to_ascii is only used if available
This commit is contained in:
commit
82d1ea240e
2 changed files with 12 additions and 0 deletions
|
@ -137,6 +137,9 @@ class OC_Mail {
|
|||
* @return string
|
||||
*/
|
||||
public static function buildAsciiEmail($emailAddress) {
|
||||
if (!function_exists('idn_to_ascii')) {
|
||||
return $emailAddress;
|
||||
}
|
||||
|
||||
list($name, $domain) = explode('@', $emailAddress, 2);
|
||||
$domain = idn_to_ascii($domain);
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
|
||||
class Test_Mail extends PHPUnit_Framework_TestCase {
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if (!function_exists('idn_to_ascii')) {
|
||||
$this->markTestSkipped(
|
||||
'The intl extension is not available.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider buildAsciiEmailProvider
|
||||
* @param $expected
|
||||
|
|
Loading…
Reference in a new issue