MDL-76412 general: Fixed PHP 8.2 utf8_encode deprecations

This commit is contained in:
raortegar 2023-01-31 15:27:09 +01:00
parent f6608a7e32
commit a03e6363de
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ if ($publickey !== false) {
// Encrypt data.
$message = $CFG->release;
$success = openssl_public_encrypt(utf8_encode($message), $encrypteddata, $publickeystr);
$success = openssl_public_encrypt(\core_text::convert($message, 'ISO-8859-1', 'UTF-8'), $encrypteddata, $publickeystr);
if ($success) {
echo base64_encode($encrypteddata);

View File

@ -1716,7 +1716,7 @@ EOD;
if (iconv('UTF-8', 'UTF-8', $parts[$i]) == $parts[$i]) {
$parts[$i] = rawurlencode($parts[$i]);
} else {
$parts[$i] = rawurlencode(utf8_encode($parts[$i]));
$parts[$i] = rawurlencode(\core_text::convert($parts[$i], 'ISO-8859-1', 'UTF-8'));
}
}
return implode('/', $parts);
@ -1733,7 +1733,7 @@ EOD;
$fullpath = $path;
if (iconv('UTF-8', 'UTF-8', $fullpath) == $fullpath) {
$this->_error_log("filename is utf-8. Needs conversion...");
$fullpath = utf8_decode($fullpath);
$fullpath = \core_text::convert($fullpath, 'UTF-8', 'ISO-8859-1');
}
return $fullpath;
}