@@ -161,13 +161,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
161161 * @var array
162162 */
163163 public array $ subscriptionPropertyMap = [
164- '{DAV:}displayname ' => ['displayname ' , 'string ' ],
165- '{http://apple.com/ns/ical/}refreshrate ' => ['refreshrate ' , 'string ' ],
166- '{http://apple.com/ns/ical/}calendar-order ' => ['calendarorder ' , 'int ' ],
167- '{http://apple.com/ns/ical/}calendar-color ' => ['calendarcolor ' , 'string ' ],
168- '{http://calendarserver.org/ns/}subscribed-strip-todos ' => ['striptodos ' , 'bool ' ],
169- '{http://calendarserver.org/ns/}subscribed-strip-alarms ' => ['stripalarms ' , 'string ' ],
170- '{http://calendarserver.org/ns/}subscribed-strip-attachments ' => ['stripattachments ' , 'string ' ],
164+ '{DAV:}displayname ' => ['displayname ' , 'string ' , 100 ],
165+ '{http://apple.com/ns/ical/}refreshrate ' => ['refreshrate ' , 'string ' , 10 ],
166+ '{http://apple.com/ns/ical/}calendar-order ' => ['calendarorder ' , 'int ' , 0 ],
167+ '{http://apple.com/ns/ical/}calendar-color ' => ['calendarcolor ' , 'string ' , 255 ],
168+ '{http://calendarserver.org/ns/}subscribed-strip-todos ' => ['striptodos ' , 'bool ' , 0 ],
169+ '{http://calendarserver.org/ns/}subscribed-strip-alarms ' => ['stripalarms ' , 'bool ' , 0 ],
170+ '{http://calendarserver.org/ns/}subscribed-strip-attachments ' => ['stripattachments ' , 'bool ' , 0 ],
171171 ];
172172
173173 /**
@@ -3040,9 +3040,14 @@ public function createSubscription($principalUri, $uri, array $properties) {
30403040
30413041 $ propertiesBoolean = ['striptodos ' , 'stripalarms ' , 'stripattachments ' ];
30423042
3043- foreach ($ this ->subscriptionPropertyMap as $ xmlName => [$ dbName , $ type ]) {
3043+ foreach ($ this ->subscriptionPropertyMap as $ xmlName => [$ dbName , $ type, $ length ]) {
30443044 if (array_key_exists ($ xmlName , $ properties )) {
3045- $ values [$ dbName ] = $ properties [$ xmlName ];
3045+ if ($ type == 'string ' ) {
3046+ $ values [$ dbName ] = mb_substr ($ properties [$ xmlName ], 0 , $ length );
3047+ } else {
3048+ $ values [$ dbName ] = $ properties [$ xmlName ];
3049+ }
3050+
30463051 if (in_array ($ dbName , $ propertiesBoolean )) {
30473052 $ values [$ dbName ] = true ;
30483053 }
@@ -3099,7 +3104,14 @@ public function updateSubscription($subscriptionId, PropPatch $propPatch) {
30993104 $ newValues ['source ' ] = $ propertyValue ->getHref ();
31003105 } else {
31013106 $ fieldName = $ this ->subscriptionPropertyMap [$ propertyName ][0 ];
3102- $ newValues [$ fieldName ] = $ propertyValue ;
3107+ $ fieldType = $ this ->subscriptionPropertyMap [$ propertyName ][1 ];
3108+
3109+ if ($ fieldType === 'string ' ) {
3110+ $ fieldLength = $ this ->subscriptionPropertyMap [$ propertyName ][2 ];
3111+ $ newValues [$ fieldName ] = mb_substr ($ propertyValue , 0 , $ fieldLength );
3112+ } else {
3113+ $ newValues [$ fieldName ] = $ propertyValue ;
3114+ }
31033115 }
31043116 }
31053117
0 commit comments