Skip to content

Conversation

Copy link

Copilot AI commented Dec 27, 2025

PHP 8.2+ deprecates mb_convert_encoding() with 'HTML-ENTITIES' encoding, causing warnings in TableDiff::diffCells().

Changes

  • lib/Caxy/HtmlDiff/Table/TableDiff.php: Replaced mb_convert_encoding($content, 'UTF-8', 'HTML-ENTITIES') with html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8') in lines 593-594
// Before
$htmlDiff = HtmlDiff::create(
    mb_convert_encoding($oldContent, 'UTF-8', 'HTML-ENTITIES'),
    mb_convert_encoding($newContent, 'UTF-8', 'HTML-ENTITIES'),
    $this->config
);

// After
$htmlDiff = HtmlDiff::create(
    html_entity_decode($oldContent, ENT_QUOTES | ENT_HTML5, 'UTF-8'),
    html_entity_decode($newContent, ENT_QUOTES | ENT_HTML5, 'UTF-8'),
    $this->config
);

Both functions decode HTML entities to UTF-8 characters. The new implementation provides better HTML5 entity support (e.g., ') while maintaining backward compatibility with PHP >= 7.3.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/ezyang/htmlpurifier/zipball/b287d2a16aceffbf6e0295559b39662612b77fcf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/4XuSh0 /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/uLmnOq /usr/bin/composer install -q (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>TableDiff: Deprecated function mb_convert_encoding() in PHP 8.2</issue_title>
<issue_description>I'm still getting this but for TableDiff:

Deprecated function: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in Caxy\HtmlDiff\Table\TableDiff->createDocumentWithHtml() (line 630 of /var/www/html/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableDiff.php).

Originally posted by @Ambient-Impact in #120 (comment)
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Dec 27, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix deprecated function mb_convert_encoding in TableDiff Fix deprecated mb_convert_encoding() in TableDiff for PHP 8.2+ Dec 27, 2025
Copilot AI requested a review from jschroed91 December 27, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableDiff: Deprecated function mb_convert_encoding() in PHP 8.2

2 participants