[Image Proxy] Replace deprecated HTML entity conversion#493
Conversation
9d03c62 to
73c885a
Compare
|
I tried that already and it didn't work very well. I'd much rather just switch to the PHP 8.4 HTML parser. |
|
Thanks for the context. I found the earlier discussion in #272, but not the exact patch or input that failed. I tested the Could you clarify two points?
I agree that switching to the standards-compliant PHP 8.4 parser is preferable to keeping the legacy parser and only suppressing the deprecation warning. Once the compatibility expectation is clear, I can revise this PR accordingly. |
73c885a to
b8ac3bc
Compare
|
I prefer to do nothing at all until such time as FreshRSS itself raises its version but in lieu of that switching over to PHP 8.4's HTML parser prematurely is still preferable over other changes imho. |
|
Thanks, understood. I see the rationale for waiting and eventually replacing the parser itself instead of making an interim conversion change. Even if the conversion change in this PR is not adopted, the regression tests added here might still be useful as a starting point for validating the future PHP 8.4 HTML parser migration. They could potentially be kept or reused separately when that work happens. |
|
I did some testing and I think this should be fine. |
Summary
mb_convert_encoding(..., 'HTML-ENTITIES', ...)call withmb_encode_numericentity()DOMDocumentprocessing pathFixes #225
Root cause
ImageProxy converts non-ASCII UTF-8 characters to HTML entities before passing article fragments to
DOMDocument::loadHTML(). UsingHTML-ENTITIESas anmb_convert_encoding()target has been deprecated since PHP 8.2, so every processed article could emit a deprecation warning.mb_encode_numericentity()performs the required non-ASCII-to-entity conversion without using the deprecated pseudo-encoding. This keeps HTML tags and existing entities intact and avoids raising the minimum supported PHP version.Regression coverage
The new standalone test runner converts
E_DEPRECATEDnotices into exceptions and verifies:src,srcset, and original-URL data attributesValidation
composer run test-image-proxyvia Docker: 19 assertions passednpm run eslintnpx stylelint "**/*.css"npm run markdownlintPHPCS and PHPStan are validated by GitHub Actions.