Problem/Motivation
PHP 8.0 will be end-of-life in November. Codesniffer found one issue in the module for PHP 8.1.
Steps to reproduce
Run a codesniffer with PHP 8.1 compatibility rules on the Pathologic module.
Note this error is returned:
pathologic.module
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
240 | ERROR | The default value of the $flags parameter for htmlspecialchars_decode() was changed
| | from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 in PHP 8.1. For
| | cross-version compatibility, the $flags parameter should be explicitly set.
------------------------------------------------------------------------------------------------------
Proposed resolution
Update the function call to explicitly set the flags parameter to ENT_COMPAT, which should produce the same results across all supported PHP versions.
Remaining tasks
Patch and test.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3385700-3.patch | 1.12 KB | dww |
| #2 | pathologic-php81-htmlspecialchars_decode-3385700-2.patch | 563 bytes | cboyden |
Comments
Comment #2
cboyden commentedPatch is attached.
Comment #4
dwwThanks! I queued up tests on "all" versions of PHP for the 7.x-3.x branch. Since they passed, I committed and pushed there.
Then checked and we've got the same problem (only a little worse) in the modern branches, too. So here's a port/re-roll that (thankfully) applies cleanly to both 8.x-1.x and 2.0.x branches.
Comment #7
dwwBot is happy, so am I. Pushed to both modern branches.
Thanks again!
-Derek