You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the Nextcloud Android app (v35.0.0), tap "+" → "New document" (or spreadsheet).
App calls GET /ocs/v2.php/apps/files/api/v1/directEditing/templates/richdocuments/document (and /spreadsheet).
Expected behaviour
Template list is returned, template picker opens.
Actual behaviour
500 error, request fails every time, for every creator type (document, spreadsheet — both tested). Exception in nextcloud.log:
Cannot use object of type OCA\Richdocuments\DirectEditing\OfficeTemplate as array in file
'/var/www/html/lib/private/DirectEditing/Manager.php' line 91
This array-mutation code appears unchanged since at least Nextcloud 30 (checked v30.0.0 tag, identical logic), so it silently relied on apps returning raw arrays despite the interface declaring ATemplate[] since 18.0.0. Any app that follows the documented contract literally (as richdocuments now does, after its recent OCP\DirectEditing refactor) breaks this code with a fatal error.
Steps to reproduce
OCP\DirectEditing\ACreateFromTemplateand follows PR feat(direct-editing): integrate with OCP\DirectEditing API richdocuments#5656, "integrate with OCP\DirectEditing API").GET /ocs/v2.php/apps/files/api/v1/directEditing/templates/richdocuments/document(and/spreadsheet).Expected behaviour
Template list is returned, template picker opens.
Actual behaviour
500 error, request fails every time, for every creator type (document, spreadsheet — both tested). Exception in
nextcloud.log:Root cause
OCP\DirectEditing\ACreateFromTemplate::getTemplates()is documented to returnATemplate[]:https://github.com/nextcloud/server/blob/v34.0.4/lib/public/DirectEditing/ACreateFromTemplate.php
richdocuments'
AbstractOfficeCreator::getTemplates()follows this literally and returns an array ofOfficeTemplateobjects (extendingATemplate):https://github.com/nextcloud/richdocuments/blob/v11.1.1/lib/DirectEditing/AbstractOfficeCreator.php#L67-L75
But
OC\DirectEditing\Manager::getTemplates()(private) treats each element as a plain associative array, not an object:https://github.com/nextcloud/server/blob/v34.0.4/lib/private/DirectEditing/Manager.php#L75-L96
This array-mutation code appears unchanged since at least Nextcloud 30 (checked
v30.0.0tag, identical logic), so it silently relied on apps returning raw arrays despite the interface declaringATemplate[]since 18.0.0. Any app that follows the documented contract literally (as richdocuments now does, after its recentOCP\DirectEditingrefactor) breaks this code with a fatal error.Fix suggestion
Manager::getTemplates()should call$template->jsonSerialize()(or equivalent) before mutating, sinceATemplate implements JsonSerializableand already exposesid/title/previewviajsonSerialize():https://github.com/nextcloud/server/blob/v34.0.4/lib/public/DirectEditing/ATemplate.php
Environment
documentandspreadsheetcreator types