port Christian Binders patch to handle config values as well (e.g.:customfields): 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

This commit is contained in:
Klaus Leithoff 2009-11-02 10:55:30 +00:00
parent 0a4c2614a5
commit a49344abf1

View File

@ -218,7 +218,12 @@ class config
$value = $row['config_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;
}
}