From 81067a3d91530ea9109977750f907c3f474feaf9 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Tue, 14 Apr 2026 17:47:14 +0200 Subject: [PATCH] Prevent fetched object double wrapping --- lib/Service/SynchronizationService.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php index dca821e23..47faf55df 100644 --- a/lib/Service/SynchronizationService.php +++ b/lib/Service/SynchronizationService.php @@ -628,10 +628,12 @@ private function synchronizeExternToIntern( $stageStartTime = microtime(true); $result['objects']['found'] = count($objectList); - if ($sourceConfig['resultsPosition'] === '_object') { - $objectList = [$objectList]; - $result['objects']['found'] = count($objectList); - } + if ($sourceConfig['resultsPosition'] === '_object') { + if (array_is_list($objectList) === false) { + $objectList = [$objectList]; + } + $result['objects']['found'] = count($objectList); + } $result['timing']['stages']['object_preparation'] = [ 'duration_ms' => round((microtime(true) - $stageStartTime) * 1000, 2), @@ -1942,9 +1944,9 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is usesPagination: $usesPagination ); - if (array_is_list($objects) === false) { - $objects = [$objects]; - } + if ($sourceConfig['resultsPosition'] !== '_object' && array_is_list($objects) === false) { + $objects = [$objects]; + } // Merge additional data into each object if $data is provided if ($data !== null