diff options
-rw-r--r-- | lib/private/AppFramework/OCS/BaseResponse.php | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/OCS/BaseResponseTest.php | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/AppFramework/OCS/BaseResponse.php b/lib/private/AppFramework/OCS/BaseResponse.php index 1191b861278..533cff74a30 100644 --- a/lib/private/AppFramework/OCS/BaseResponse.php +++ b/lib/private/AppFramework/OCS/BaseResponse.php @@ -143,6 +143,10 @@ abstract class BaseResponse extends Response { $k = 'element'; } + if ($v instanceof \stdClass) { + $v = []; + } + if (\is_array($v)) { $writer->startElement($k); $this->toXML($v, $writer); diff --git a/tests/lib/AppFramework/OCS/BaseResponseTest.php b/tests/lib/AppFramework/OCS/BaseResponseTest.php index 9038aee6baf..a1e0c620574 100644 --- a/tests/lib/AppFramework/OCS/BaseResponseTest.php +++ b/tests/lib/AppFramework/OCS/BaseResponseTest.php @@ -45,13 +45,14 @@ class BaseResponseTest extends \Test\TestCase { 'someElement' => 'withAttribute', ], 'value without key', + 'object' => new \stdClass(), ]; $this->invokePrivate($response, 'toXml', [$data, $writer]); $writer->endDocument(); $this->assertEquals( - "<?xml version=\"1.0\"?>\n<hello>hello</hello><information test=\"some data\"><someElement>withAttribute</someElement></information><element>value without key</element>\n", + "<?xml version=\"1.0\"?>\n<hello>hello</hello><information test=\"some data\"><someElement>withAttribute</someElement></information><element>value without key</element><object/>\n", $writer->outputMemory(true) ); } |