do NOT (re)move data with numerical indexes to JSON blob, as filters are also run through data2db

This commit is contained in:
ralf 2024-12-17 14:26:17 +01:00
parent a4cc3ef55f
commit b45a33842b

View File

@ -137,7 +137,10 @@ class Json extends Base
$data = &$this->data;
}
// json-encode non db columns into ths json blob
if ($this->json_column && is_array($data) && ($json = array_diff_key($data, array_flip($this->db_cols+[self::USER_TIMEZONE_READ]))))
if ($this->json_column && is_array($data) && ($json = array_filter($data, function($key)
{
return !is_int($key) && !isset($this->db_cols[$key]) && !in_array($key, [self::USER_TIMEZONE_READ]);
}, ARRAY_FILTER_USE_KEY)))
{
$data = [
$this->json_column => json_encode($json, JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR),