Skip to content

Commit

Permalink
bug symfony#44092 [Mime] Provide the right flags to IDN methods for e…
Browse files Browse the repository at this point in the history
…mail addresses conversion
  • Loading branch information
j-bernard committed Nov 18, 2021
1 parent 1d11d0d commit f19d064
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Mime/Encoder/IdnAddressEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function encodeString(string $address): string
}

if (preg_match('/[^\x00-\x7F]/', $domain)) {
$address = sprintf('%s@%s', $local, idn_to_ascii($domain, 0, \INTL_IDNA_VARIANT_UTS46));
$address = sprintf('%s@%s', $local, idn_to_ascii($domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46));
}
}

Expand Down
13 changes: 13 additions & 0 deletions src/Symfony/Component/Mime/Tests/Encoder/IdnAddressEncoderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Symfony\Component\Mime\Encoder;

use PHPUnit\Framework\TestCase;

class IdnAddressEncoderTest extends TestCase
{
public function testEncodeString()
{
$this->assertEquals('test@xn--fuball-cta.test', (new IdnAddressEncoder())->encodeString('test@fußball.test'));
}
}

0 comments on commit f19d064

Please sign in to comment.