Closed (outdated)
Project:
Diff
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2024 at 08:06 UTC
Updated:
10 Mar 2025 at 07:00 UTC
Jump to comment: Most recent
After updating our system to PHP 8.2, we are facing this error:
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() (Zeile 630 in /var/www/html/docport/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableDiff.php)
This not a bug of the diff module, but the Caxy library that is a requirement of a library required by the module.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
himanshu_jhaloya commentedHi @dbielke1986 Is this a bug in the Caxy library related with.
Comment #4
himanshu_jhaloya commentedTo Fix the issue you can add the following code..
php-htmldiff/lib/Caxy/HtmlDiff/Table
/TableDiff.php
instead
line 592
$htmlDiff = HtmlDiff::create(
mb_convert_encoding($oldContent, 'UTF-8', 'HTML-ENTITIES'),
mb_convert_encoding($newContent, 'UTF-8', 'HTML-ENTITIES'),
$this->config
);
to
$htmlDiff = HtmlDiff::create(
htmlspecialchars_decode($oldContent, ENT_QUOTES | ENT_HTML5),
htmlspecialchars_decode($newContent, ENT_QUOTES | ENT_HTML5),
$this->config
);
instead
line 630---
$dom->loadHTML(mb_convert_encoding(
$this->purifyHtml(mb_convert_encoding($text, $this->config->getEncoding(), mb_detect_encoding($text))),
'HTML-ENTITIES',
$this->config->getEncoding()
));
to
$dom->loadHTML(mb_convert_encoding(
$this->purifyHtml(mb_convert_encoding($text, $this->config->getEncoding(), mb_detect_encoding($text))),
'HTML-ENTITIES',
$this->config->getEncoding()
));
Comment #5
dbielke1986 commentedI think we need an MR for this issue before it should be "Needs review".
Can you push your changes to an MR?
Comment #6
himanshu_jhaloya commentedHi @dbielke1986 you please review if this works i will create the MR
Comment #7
bluegeek9 commentedThe issue is with php-htmldiff. The library needs the patch, and then the dependency revision needs to increase.
https://github.com/caxy/php-htmldiff/issues/123
Comment #8
bluegeek9 commentedComment #9
robpowellJust adding that there are now two PRS
Comment #10
anicotoAs the issue is in a module dependency and not the module itself, we need to wait until library maintainers approve the PR. For now, I apply the patch with composer using the vendor folder as this:
Comment #11
bluegeek9 commentedComment #12
jannakha commented+1 for #10 comment
Comment #13
heddnThis is postponed on an upstream fix.
Comment #14
biguzis commentedAfter patching as said in #10, I get error
Adding
//TRANSLITsolves issue for me.Full line:
Comment #15
acbramley commentedhttps://github.com/caxy/php-htmldiff/releases/tag/v0.1.16 contains fixes for this and PHP 8.4 deprecations.
Comment #16
alistairmc commentedCan we get an update to the module to include the https://github.com/caxy/php-htmldiff/releases/tag/v0.1.16 version in the composer.json
Comment #17
acbramley commentedDiff doesn't directly depend on caxy/php-htmldiff, it's a dependency of mkalkbrenner/php-htmldiff-advanced.
Comment #18
ivnishThanks #14 //TRANSLIT helps me too.