aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-11-27 22:16:58 -0500
committerSebastianKrupinski <krupinskis05@gmail.com>2024-12-13 11:46:26 -0500
commitc1dd8ddf591337c5fb5ca2da7d476a4f0fc254c5 (patch)
treef945ab57282f581a1a46e1ff5bc726db2e54db7b /apps/dav/lib
parent10852d38e345eab68035a2442f3a76b5c5e7bf1a (diff)
downloadnextcloud-server-c1dd8ddf591337c5fb5ca2da7d476a4f0fc254c5.tar.gz
nextcloud-server-c1dd8ddf591337c5fb5ca2da7d476a4f0fc254c5.zip
fix: replace null character when serializingfix/issue-47879-property-serialization
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/DAV/CustomPropertiesBackend.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php
index f73246161ba..bc3c146875b 100644
--- a/apps/dav/lib/DAV/CustomPropertiesBackend.php
+++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php
@@ -519,7 +519,9 @@ class CustomPropertiesBackend implements BackendInterface {
$value = $value->getHref();
} else {
$valueType = self::PROPERTY_TYPE_OBJECT;
- $value = serialize($value);
+ // serialize produces null character
+ // these can not be properly stored in some databases and need to be replaced
+ $value = str_replace(chr(0), '\x00', serialize($value));
}
return [$value, $valueType];
}
@@ -534,7 +536,9 @@ class CustomPropertiesBackend implements BackendInterface {
case self::PROPERTY_TYPE_HREF:
return new Href($value);
case self::PROPERTY_TYPE_OBJECT:
- return unserialize($value);
+ // some databases can not handel null characters, these are custom encoded during serialization
+ // this custom encoding needs to be first reversed before unserializing
+ return unserialize(str_replace('\x00', chr(0), $value));
case self::PROPERTY_TYPE_STRING:
default:
return $value;