wiki.techinc.nl/tests/phpunit/unit/includes/mail/UserMailerTest.php
Ammarpad eb344c676c mail: Encode period (ascii 46) if it appears in encoded email header.
Strings that do not need encoding like 'Foo.Bar' are already quoted;
but where the string is encoded, the character appears literally which
makes the string to fail pear/mail validation.

Bug: T344912
Change-Id: I9bce80c1c99c67a65bce1a30b1d9a77e00b0bc18
2023-10-01 18:26:59 +01:00

24 lines
500 B
PHP

<?php
class UserMailerTest extends MediaWikiUnitTestCase {
/**
* @covers UserMailer::quotedPrintable
*/
public function testQuotedPrintable() {
$this->assertEquals(
"=?UTF-8?Q?=C4=88u=20legebla=3F?=",
UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" )
);
$this->assertEquals(
"=?UTF-8?Q?F=C3=B6o=2EBar?=",
UserMailer::quotedPrintable( "Föo.Bar", "UTF-8" )
);
$this->assertEquals(
"Foo.Bar",
UserMailer::quotedPrintable( "Foo.Bar", "UTF-8" )
);
}
}