mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 15:38:27 +01:00
backport of Christian Binders patch: little helper for prefs if unserialize failed - this can happen if the pref comes from an installation with another charset than the current system charset, ported to handle config as well
This commit is contained in:
parent
b350351d40
commit
8a6fc34c88
@ -218,6 +218,11 @@ class config
|
|||||||
$value = $row['config_value'];
|
$value = $row['config_value'];
|
||||||
|
|
||||||
$test = @unserialize($value);
|
$test = @unserialize($value);
|
||||||
|
if($test === false)
|
||||||
|
{
|
||||||
|
// manually retrieve the string lengths of the serialized array if unserialize failed
|
||||||
|
$test = @unserialize(preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.mb_strlen('$2','8bit').':\"$2\";'", $value));
|
||||||
|
}
|
||||||
|
|
||||||
$config[$name] = is_array($test) ? $test : $value;
|
$config[$name] = is_array($test) ? $test : $value;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,11 @@ class preferences
|
|||||||
// The following replacement is required for PostgreSQL to work
|
// The following replacement is required for PostgreSQL to work
|
||||||
$app = trim($row['preference_app']);
|
$app = trim($row['preference_app']);
|
||||||
$value = unserialize($row['preference_value']);
|
$value = unserialize($row['preference_value']);
|
||||||
|
if($value === false)
|
||||||
|
{
|
||||||
|
// manually retrieve the string lengths of the serialized array if unserialize failed
|
||||||
|
$value = unserialize(preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.mb_strlen('$2','8bit').':\"$2\";'", $row['preference_value']));
|
||||||
|
}
|
||||||
$this->unquote($value);
|
$this->unquote($value);
|
||||||
if (!is_array($value))
|
if (!is_array($value))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user