Problem/Motivation

PHP 8.0 will be end-of-life in November. Codesniffer found multiple instances of one issue in the module for PHP 8.1.

Steps to reproduce

Run a codesniffer with PHP 8.1 compatibility rules on the module.
Note these errors are returned:

FILE: feeds/plugins/FeedsSimplePieParser.inc
----------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------------------------------
  83 | ERROR | The default value of the $flags parameter for html_entity_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.
  85 | ERROR | The default value of the $flags parameter for html_entity_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.
  91 | ERROR | The default value of the $flags parameter for html_entity_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.
  93 | ERROR | The default value of the $flags parameter for html_entity_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.
 105 | ERROR | The default value of the $flags parameter for html_entity_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 html_entity_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.

CommentFileSizeAuthor
#2 feeds-php81-ent_compat-3391744-2.patch2.17 KBcboyden

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
StatusFileSize
new2.17 KB

Patch is attached.

cboyden’s picture

Issue summary: View changes

  • joelpittet committed 8934ca5a on 7.x-2.x
    Issue #3391744 by cboyden: Update call to html_entity_decode for PHP 8.1
    
joelpittet’s picture

Status: Needs review » Fixed

Thanks for fixing this @cboyden. I have committed it to the dev branch

Status: Fixed » Closed (fixed)

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