Skip to content

Commit a213cbc

Browse files
Merge branch '4.4' into 5.4
* 4.4: Remove former core members from code owners [Form] fix populating single widget time view data with different timezones [DomCrawler][VarDumper] Fix html-encoding emojis
2 parents c0bda97 + be5a046 commit a213cbc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,11 +1186,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
11861186
set_error_handler(function () { throw new \Exception(); });
11871187

11881188
try {
1189-
return mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], $charset);
1189+
return mb_encode_numericentity($htmlContent, [0x80, 0x10FFFF, 0, 0x1FFFFF], $charset);
11901190
} catch (\Exception|\ValueError $e) {
11911191
try {
11921192
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
1193-
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8');
1193+
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
11941194
} catch (\Exception|\ValueError $e) {
11951195
}
11961196

Tests/AbstractCrawlerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ public function testHtml()
381381
$this->assertSame('my value', $this->createTestCrawler(null)->filterXPath('//ol')->html('my value'));
382382
}
383383

384+
public function testEmojis()
385+
{
386+
$crawler = $this->createCrawler('<body><p>Hey 👋</p></body>');
387+
388+
$this->assertSame('<body><p>Hey 👋</p></body>', $crawler->html());
389+
}
390+
384391
public function testExtract()
385392
{
386393
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');

0 commit comments

Comments
 (0)