Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4:
  Fix abstract method name in PHP doc block
  Various cleanups
  [HttpClient] fix issues in tests
  Fixes sprintf(): Too few arguments in form transformer
  [Console] Fix QuestionHelper::disableStty()
  [Validator] Use Mime component to determine mime type for file validator
  validate subforms in all validation groups
  Update Hungarian translations
  Add meaningful message when Process is not installed (ProcessHelper)
  [PropertyAccess] Fix TypeError parsing again.
  [TwigBridge] fix fallback html-to-txt body converter
  [Form] add missing Czech validators translation
  [Validator] add missing Czech translations
  never directly validate Existence (Required/Optional) constraints
  • Loading branch information
nicolas-grekas committed May 30, 2020
2 parents 8310ff7 + 13a9659 commit 144f5f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Mime/BodyRenderer.php
Expand Up @@ -74,6 +74,6 @@ private function convertHtmlToText(string $html): string
return $this->converter->convert($html);
}

return strip_tags($html);
return strip_tags(preg_replace('{<(head|style)\b.*?</\1>}i', '', $html));
}
}
5 changes: 3 additions & 2 deletions Tests/Mime/BodyRendererTest.php
Expand Up @@ -29,11 +29,12 @@ public function testRenderTextOnly(): void

public function testRenderHtmlOnly(): void
{
$email = $this->prepareEmail(null, '<b>HTML</b>');
$html = '<head>head</head><b>HTML</b><style type="text/css">css</style>';
$email = $this->prepareEmail(null, $html);
$body = $email->getBody();
$this->assertInstanceOf(AlternativePart::class, $body);
$this->assertEquals('HTML', $body->getParts()[0]->bodyToString());
$this->assertEquals('<b>HTML</b>', $body->getParts()[1]->bodyToString());
$this->assertEquals(str_replace('=', '=3D', $html), $body->getParts()[1]->bodyToString());
}

public function testRenderHtmlOnlyWithTextSet(): void
Expand Down

0 comments on commit 144f5f9

Please sign in to comment.