Skip to content
Snippets Groups Projects

Issue #3337418: PHP 8.2 and PHP 9: utf8_encode + utf8_decode are deprecated

Merged Issue #3337418: PHP 8.2 and PHP 9: utf8_encode + utf8_decode are deprecated
Merged Patrick Kenny requested to merge issue/dbee-3337418:php_8.2 into 3.x
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 2
2
@@ -66,7 +66,7 @@ function dbee_encrypt($string) {
// The email address is valid.
$encryption_profile = EncryptionProfile::load(DBEE_ENCRYPT_NAME);
try {
$encrypted = utf8_encode(\Drupal::service('encryption')->encrypt($string, $encryption_profile));
$encrypted = \Drupal::service('encryption')->encrypt($string, $encryption_profile);
// Ensure the encrypted value is correct.
// (Check if the email address is no longer valid.)
$decrypt = dbee_decrypt($encrypted);
@@ -108,7 +108,7 @@ function dbee_decrypt($string, $prev_encrypt = FALSE) {
$encrypt_profile = (!$prev_encrypt) ? DBEE_ENCRYPT_NAME : DBEE_PREV_ENCRYPT_NAME;
$encryption_profile = EncryptionProfile::load($encrypt_profile);
try {
$uncrypted_mail = utf8_encode(\Drupal::service('encryption')->decrypt(utf8_decode($string), $encryption_profile));
$uncrypted_mail = \Drupal::service('encryption')->decrypt($string, $encryption_profile);
// Check whether the decrypted email address is valid before returning it.
if ($uncrypted_mail && dbee_email_to_alter($uncrypted_mail)) {
// The decrypted value is a valid email address, so return it.
Loading