Problem/Motivation

Currently the module does not fully support PHP 8.2 because it's using the deprecated utf8_encode() function.

Deprecated function: Function utf8_encode() is deprecated in function Drupal\system_status\Services\SystemStatusEncryption::encryptOpenssl() (row 54 in file /var/www/builds/2024-05-22.08-20-20.commit--b0a8284/web/modules/contrib/system_status/src/Services/SystemStatusEncryption.php)

Source code: https://git.drupalcode.org/project/system_status/-/blob/3.0.x/src/Servic...

Steps to reproduce

Install the module with PHP 8.2 and monitor the dblog.

Proposed resolution

Looking at other modules they seem to have replaced utf8_encode() with mb_convert_encoding(), https://www.php.net/manual/en/function.mb-convert-encoding.php.

Remaining tasks

* Code changes
* Tests

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

HeikkiY created an issue. See original summary.

heikkiy’s picture

Issue summary: View changes

heikkiy’s picture

Status: Active » Needs review
silvi.addweb’s picture

Thanks, @heikkiy. We can add mb_detect_encoding() to detect the source encoding

$source_encoding = mb_detect_encoding($plaintext, mb_detect_order(), true);
$plaintext_utf8= mb_convert_encoding($plaintext, 'UTF-8', $source_encoding);
heikkiy’s picture

Sounds good @silviaddweb. Added it.

heikkiy’s picture

EDITED: Removed comment because the found errors don't exist anymore in 3.x branch.

heikkiy’s picture

Status: Needs review » Needs work
heikkiy’s picture

Status: Needs work » Needs review
astonvictor’s picture

thanks for the report. merged

astonvictor’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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