Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2022-08-06 19:58:23 +0300
committerAleksander Machniak <alec@alec.pl>2022-08-06 19:58:23 +0300
commit1389e573d31c77455ed9759e622fee4b20f4fd2f (patch)
treeb9439fe6793bbd2e090ab295eb3052e4bffb75bc /program
parentaac9b696b8435c34c542e47877a3644a16a6f4f2 (diff)
Remove use of utf8_encode() and utf8_decode() functions deprecated in PHP 8.2
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_charset.php2
-rw-r--r--program/lib/Roundcube/rcube_db.php31
2 files changed, 6 insertions, 27 deletions
diff --git a/program/lib/Roundcube/rcube_charset.php b/program/lib/Roundcube/rcube_charset.php
index 94e539612..660856064 100644
--- a/program/lib/Roundcube/rcube_charset.php
+++ b/program/lib/Roundcube/rcube_charset.php
@@ -588,7 +588,7 @@ class rcube_charset
return $input;
}
- if (!is_string($input) || $input == '') {
+ if (!is_string($input) || $input === '') {
return $input;
}
diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index 2ed915981..e18336633 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -1089,7 +1089,8 @@ class rcube_db
}
/**
- * Encodes non-UTF-8 characters in string/array/object (recursive)
+ * Makes sure the input can be stored in database.
+ * With $serialize=false non-UTF-8 characters will be removed.
*
* @param mixed $input Data to fix
* @param bool $serialized Enable serialization
@@ -1111,19 +1112,12 @@ class rcube_db
return $input;
}
- else if (is_array($input)) {
- foreach ($input as $idx => $value) {
- $input[$idx] = self::encode($value);
- }
-
- return $input;
- }
- return utf8_encode($input);
+ return rcube_charset::clean($input);
}
/**
- * Decodes encoded UTF-8 string/object/array (recursive)
+ * Decodes the data encoded using self::encode().
*
* @param mixed $input Input data
* @param bool $serialized Enable serialization
@@ -1143,22 +1137,7 @@ class rcube_db
return @unserialize(base64_decode($input));
}
- if (is_object($input)) {
- foreach (get_object_vars($input) as $idx => $value) {
- $input->$idx = self::decode($value);
- }
-
- return $input;
- }
- else if (is_array($input)) {
- foreach ($input as $idx => $value) {
- $input[$idx] = self::decode($value);
- }
-
- return $input;
- }
-
- return utf8_decode($input);
+ return $input;
}
/**