]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix crash in OCS when getting info about an application
authorCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 13 Dec 2022 08:29:07 +0000 (09:29 +0100)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Fri, 20 Jan 2023 10:22:09 +0000 (11:22 +0100)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/AppFramework/OCS/BaseResponse.php

index dbff1b846c15413de37c742d858940e29247a059..f9577a7a5f2770163204e677b12d3618ac9dadff 100644 (file)
@@ -37,13 +37,13 @@ abstract class BaseResponse extends Response {
        /** @var string */
        protected $format;
 
-       /** @var string */
+       /** @var ?string */
        protected $statusMessage;
 
-       /** @var int */
+       /** @var ?int */
        protected $itemsCount;
 
-       /** @var int */
+       /** @var ?int */
        protected $itemsPerPage;
 
        /**
@@ -125,12 +125,15 @@ abstract class BaseResponse extends Response {
                return $writer->outputMemory(true);
        }
 
-       /**
-        * @param array $array
-        * @param \XMLWriter $writer
-        */
-       protected function toXML(array $array, \XMLWriter $writer) {
+       protected function toXML(array $array, \XMLWriter $writer): void {
                foreach ($array as $k => $v) {
+                       if ($k === '@attributes' && is_array($v)) {
+                               foreach ($v as $k2 => $v2) {
+                                       $writer->writeAttribute($k2, $v2);
+                               }
+                               continue;
+                       }
+
                        if (\is_string($k) && strpos($k, '@') === 0) {
                                $writer->writeAttribute(substr($k, 1), $v);
                                continue;