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:
Thomas Müller 2014-04-01 22:51:23 +02:00
commit 82d1ea240e
2 changed files with 12 additions and 0 deletions

View file

@ -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);

View file

@ -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