@@ -531,6 +531,18 @@ private function formatPath(string $path): string {
531531		return  $ path
532532	}
533533
534+ 	private  static  function  checkIsArrayOfScalar (string  $ namearray  $ arrayvoid  {
535+ 		foreach  ($ arrayas  $ item
536+ 			if  (is_array ($ item
537+ 				self ::checkIsArrayOfScalar ($ name$ item
538+ 			} elseif  ($ itemnull  && !is_scalar ($ item
539+ 				throw  new  DavException (
540+ 					"Property  \"$ name has an invalid value of array containing  "  . gettype ($ item
541+ 				);
542+ 			}
543+ 		}
544+ 	}
545+ 
534546	/** 
535547	 * @throws ParseException If parsing a \Sabre\DAV\Xml\Property\Complex value fails 
536548	 * @throws DavException If the property value is invalid 
@@ -567,25 +579,20 @@ private function encodeValueForDatabase(string $path, string $name, mixed $value
567579		} else  {
568580			if  (is_array ($ value
569581				// For array only allow scalar values 
570- 				foreach  ($ valueas  $ item
571- 					if  (!is_scalar ($ item
572- 						throw  new  DavException (
573- 							"Property  \"$ name has an invalid value of array containing  "  . gettype ($ value
574- 						);
575- 					}
576- 				}
582+ 				self ::checkIsArrayOfScalar ($ name$ value
577583			} elseif  (!is_object ($ value
578584				throw  new  DavException (
579585					"Property  \"$ name has an invalid value of type  "  . gettype ($ value
580586				);
581- 			}
582- 			if  (!str_starts_with ($ value'Sabre \\DAV \\Xml \\Property \\' )
583- 				&& !str_starts_with ($ value'Sabre \\CalDAV \\Xml \\Property \\' )
584- 				&& !str_starts_with ($ value'Sabre \\CardDAV \\Xml \\Property \\' )
585- 				&& !str_starts_with ($ value'OCA \\DAV \\' )) {
586- 				throw  new  DavException (
587- 					"Property  \"$ name has an invalid value of class  "  . $ value
588- 				);
587+ 			} else  {
588+ 				if  (!str_starts_with ($ value'Sabre \\DAV \\Xml \\Property \\' )
589+ 					&& !str_starts_with ($ value'Sabre \\CalDAV \\Xml \\Property \\' )
590+ 					&& !str_starts_with ($ value'Sabre \\CardDAV \\Xml \\Property \\' )
591+ 					&& !str_starts_with ($ value'OCA \\DAV \\' )) {
592+ 					throw  new  DavException (
593+ 						"Property  \"$ name has an invalid value of class  "  . $ value
594+ 					);
595+ 				}
589596			}
590597			$ valueTypeself ::PROPERTY_TYPE_OBJECT ;
591598			// serialize produces null character 
0 commit comments