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 Tablefield module.
Note this error is returned:

views/plugins/views_plugin_style.inc
---------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------
 490 | 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 htmlspecialchars_decode() 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
new642 bytes

Patch is attached.

damienmckenna’s picture

This looks like it'll work; I took a quick check and the flags change for htmlspecialchars_decode() and it shouldn't cause problems with older versions of PHP.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thank you!

Status: Fixed » Closed (fixed)

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