Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/dom-crawler
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.0.6
Choose a base ref
...
head repository: symfony/dom-crawler
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.0.9
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Apr 30, 2022

  1. Copy the full SHA
    be5a046 View commit details

Commits on May 4, 2022

  1. 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
    nicolas-grekas committed May 4, 2022
    Copy the full SHA
    a213cbc View commit details
  2. Merge branch '5.4' into 6.0

    * 5.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
    nicolas-grekas committed May 4, 2022
    Copy the full SHA
    6571e51 View commit details
Showing with 9 additions and 2 deletions.
  1. +2 −2 Crawler.php
  2. +7 −0 Tests/AbstractCrawlerTest.php
4 changes: 2 additions & 2 deletions Crawler.php
Original file line number Diff line number Diff line change
@@ -1075,11 +1075,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
set_error_handler(function () { throw new \Exception(); });

try {
return mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], $charset);
return mb_encode_numericentity($htmlContent, [0x80, 0x10FFFF, 0, 0x1FFFFF], $charset);
} catch (\Exception|\ValueError $e) {
try {
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8');
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
} catch (\Exception|\ValueError $e) {
}

7 changes: 7 additions & 0 deletions Tests/AbstractCrawlerTest.php
Original file line number Diff line number Diff line change
@@ -371,6 +371,13 @@ public function testHtml()
$this->assertSame('my value', $this->createTestCrawler(null)->filterXPath('//ol')->html('my value'));
}

public function testEmojis()
{
$crawler = $this->createCrawler('<body><p>Hey 👋</p></body>');

$this->assertSame('<body><p>Hey 👋</p></body>', $crawler->html());
}

public function testExtract()
{
$crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li');