Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit a6be508

Browse files
committed
Back ported ed9612d by @clue
1 parent 2707429 commit a6be508

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Mime/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function extract(array $replacements, UrlInterface $url)
4444
if (preg_match('#<title[^>]*>(.*?)</title>#is', $url->getBody(), $match)) {
4545
$replacements['%composed-title%'] =
4646
$replacements['%title%'] =
47-
preg_replace('/[\s\v]+/', ' ', trim(html_entity_decode($match[1])));
47+
preg_replace('/[\s\v]+/', ' ', trim(html_entity_decode($match[1], ENT_QUOTES | ENT_HTML5)));
4848
}
4949

5050
return $replacements;

tests/Mime/HtmlTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ public function testExtractProvider() {
5353
),
5454
new Url('', '<html><title>foo</title></html></html>', array(), 200, 1),
5555
),
56+
array(
57+
array(
58+
'%title%' => 'foo\'s wörk',
59+
'%composed-title%' => 'foo\'s wörk',
60+
),
61+
new Url('', '<html><title>foo&#39;s w&ouml;rk</title></html></html>', array(), 200, 1),
62+
),
5663
array(
5764
array(),
5865
new Url('', '', array(), 200, 1),
@@ -68,4 +75,4 @@ public function testExtract($expected, $url) {
6875
$this->assertSame($expected, $mime->extract(array(), $url));
6976
}
7077

71-
}
78+
}

0 commit comments

Comments
 (0)