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.

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
StatusFileSize
new563 bytes

Patch is attached.

  • dww committed 609d306b on 7.x-3.x
    Task #3385700: Update call to htmlspecialchars_decode() for PHP 8.1:...
dww’s picture

Version: 7.x-3.x-dev » 2.0.x-dev
StatusFileSize
new1.12 KB

Thanks! 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.

  • dww committed b8ff7e17 on 2.0.x
    Task #3385700: Update call to htmlspecialchars_decode() for PHP 8.1:...

  • dww committed ec43863f on 8.x-1.x
    Task #3385700: Update call to htmlspecialchars_decode() for PHP 8.1:...
dww’s picture

Status: Needs review » Fixed

Bot is happy, so am I. Pushed to both modern branches.

Thanks again!
-Derek

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.