Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(dav): Allow arrays (of scalars) in property values
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Oct 20, 2025
commit 22728601ba4d7b62486662a33aa30580848149f4
15 changes: 14 additions & 1 deletion apps/dav/lib/DAV/CustomPropertiesBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,16 @@ private function encodeValueForDatabase(string $path, string $name, mixed $value
$valueType = self::PROPERTY_TYPE_HREF;
$value = $value->getHref();
} else {
if (!is_object($value)) {
if (is_array($value)) {
// For array only allow scalar values
foreach ($value as $item) {
if (!is_scalar($item)) {
throw new DavException(
"Property \"$name\" has an invalid value of array containing " . gettype($value),
);
}
}
} elseif (!is_object($value)) {
throw new DavException(
"Property \"$name\" has an invalid value of type " . gettype($value),
);
Expand Down Expand Up @@ -636,6 +645,10 @@ private function decodeValueFromDatabase(string $value, int $valueType): mixed {
case self::PROPERTY_TYPE_HREF:
return new Href($value);
case self::PROPERTY_TYPE_OBJECT:
if (preg_match('/^a:/', $value)) {
// Array, unserialize only scalar values
return unserialize(str_replace('\x00', chr(0), $value), ['allowed_classes' => false]);
}
if (!preg_match('/^O\:\d+\:\"(OCA\\\\DAV\\\\|Sabre\\\\(Cal|Card)?DAV\\\\Xml\\\\Property\\\\)/', $value)) {
throw new \LogicException('Found an object class serialized in DB that is not allowed');
}
Expand Down