diff options
author | Sebastian Krupinski <165827823+SebastianKrupinski@users.noreply.github.com> | 2024-12-13 20:20:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-13 20:20:42 -0500 |
commit | dd89911b311d03627b710b157cbc5b5f7f9c7fe6 (patch) | |
tree | 5da57f123f7af2967d699762736d292b5e7df733 /apps/dav/tests | |
parent | 2bbc4f59886c8586c5de55956af68b7c7f8159fd (diff) | |
parent | c1dd8ddf591337c5fb5ca2da7d476a4f0fc254c5 (diff) | |
download | nextcloud-server-dd89911b311d03627b710b157cbc5b5f7f9c7fe6.tar.gz nextcloud-server-dd89911b311d03627b710b157cbc5b5f7f9c7fe6.zip |
Merge pull request #49528 from nextcloud/fix/issue-47879-property-serialization
fix: replace null character when serializing
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 6fc87437fe0..fa71fd8016b 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -458,4 +459,21 @@ class CustomPropertiesBackendTest extends TestCase { [str_repeat('long_path1', 100), str_repeat('long_path2', 100)] ]; } + + public function testDecodeValueFromDatabaseObjectCurrent(): void { + $propertyValue = 'O:48:"Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp":1:{s:8:"\x00*\x00value";s:6:"opaque";}'; + $propertyType = 3; + $decodeValue = $this->invokePrivate($this->backend, 'decodeValueFromDatabase', [$propertyValue, $propertyType]); + $this->assertInstanceOf(\Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp::class, $decodeValue); + $this->assertEquals('opaque', $decodeValue->getValue()); + } + + public function testDecodeValueFromDatabaseObjectLegacy(): void { + $propertyValue = 'O:48:"Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp":1:{s:8:"' . chr(0) . '*' . chr(0) . 'value";s:6:"opaque";}'; + $propertyType = 3; + $decodeValue = $this->invokePrivate($this->backend, 'decodeValueFromDatabase', [$propertyValue, $propertyType]); + $this->assertInstanceOf(\Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp::class, $decodeValue); + $this->assertEquals('opaque', $decodeValue->getValue()); + } + } |