Problem/Motivation

utf8_encode() function has been deprecated as of php8.2.0. This function is used in many places to encode log messages or interface messages when performing bulk actions, resulting in the display of Drupal warning messages such as "Deprecated function: Function utf8_encode() is deprecated in Drupal\moderated_content_bulk_publish\AdminModeration->unpublish() (line 44 of modules/contrib/moderated_content_bulk_publish/src/AdminModeration.php)." when performing bulk actions.

Steps to reproduce

  • Drupal 9/10 + php8.2
  • Out of the box editorial workflow
  • Perform any bulk action on moderated content (Publish/Unpublish latest revision, Pin/Unpin content, Archive current revision)

The action performs well, but Drupal warning messages are displayed.

Proposed resolution

Follow recommendation of official php documentation and replace use of utf8_encode() with mb_convert_encoding() function.

Attached is a patch that follows the above recommendation.

Comments

misterdidi created an issue. See original summary.

mohd sahzad’s picture

i have fixed PHP 8.2 utf8_encode() compatibility issue

noorulshameera’s picture

Status: Active » Needs review

I verified that patch #2 applied cleanly and it replaces all the occurrences of the deprecated function utf8_encode() in the code.

joseph.olstad’s picture

Version: 2.0.25 » 3.0.x-dev
Status: Needs review » Needs work

The first patch was taken and committed (thank you), the patch 3 was incomplete.

3.0.x likely has the same issue

joseph.olstad’s picture

Fixed in 2.0.26

Thank you to the above
https://www.drupal.org/project/moderated_content_bulk_publish/releases/2...

3.0.x needs work

csmdgl’s picture

Status: Needs work » Needs review
StatusFileSize
new14.93 KB

Patch for 3.0.x

  • joseph.olstad committed b202f463 on 3.0.x authored by csmdgl
    Issue #3380518 by misterdidi, csmdgl, Mohd Sahzad, noorulshameera: PHP 8...
joseph.olstad’s picture

Status: Needs review » Fixed
joseph.olstad’s picture

Thanks @csmdgl , great work!

Status: Fixed » Closed (fixed)

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