mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
2d46fc60be
commit
853d866c35
2 changed files with 9 additions and 5 deletions
|
@ -325,7 +325,7 @@ class CakeEmail {
|
|||
if ($this->_appCharset !== null) {
|
||||
$this->charset = $this->_appCharset;
|
||||
}
|
||||
$this->_domain = env('HTTP_HOST');
|
||||
$this->_domain = preg_replace('/\:\d+$/', '', env('HTTP_HOST'));
|
||||
if (empty($this->_domain)) {
|
||||
$this->_domain = php_uname('n');
|
||||
}
|
||||
|
|
|
@ -411,14 +411,18 @@ class CakeEmailTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testMessageIdWithDomain() {
|
||||
$result = $this->CakeEmail->getHeaders();
|
||||
$expected = '@' . (env('HTTP_HOST') ? env('HTTP_HOST') : php_uname('n')) . '>';
|
||||
$this->assertTextContains($expected, $result['Message-ID']);
|
||||
|
||||
$this->CakeEmail->domain('example.org');
|
||||
$result = $this->CakeEmail->getHeaders();
|
||||
$expected = '@example.org>';
|
||||
$this->assertTextContains($expected, $result['Message-ID']);
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'example.org';
|
||||
$result = $this->CakeEmail->getHeaders();
|
||||
$this->assertTextContains('example.org', $result['Message-ID']);
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'example.org:81';
|
||||
$result = $this->CakeEmail->getHeaders();
|
||||
$this->assertTextNotContains(':81', $result['Message-ID']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue