From c6e060b3716e8d1fd36baeaa47a4974973233faf Mon Sep 17 00:00:00 2001 From: matx132 Date: Thu, 7 Sep 2023 11:07:18 +0200 Subject: [PATCH 1/2] IBX-6484: Added check if $row is empty to prevent error --- eZ/Publish/Core/Persistence/Legacy/Content/Handler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php b/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php index 22abbb9db9..0fb6e39a2b 100644 --- a/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php +++ b/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php @@ -911,6 +911,11 @@ static function ($lang) use ($languageCode) { public function loadVersionInfoList(array $contentIds): array { $rows = $this->contentGateway->loadVersionInfoList($contentIds); + + if (empty($rows)) { + return []; + } + $mappedRows = array_map( static function (array $row): array { return [ From afa79edce0c0a1e1230f826a3a303674e352fa5e Mon Sep 17 00:00:00 2001 From: matx132 Date: Wed, 20 Sep 2023 14:41:37 +0200 Subject: [PATCH 2/2] Added test for LoadVersionInfoListByContentInfo on location 1 --- .../ContentService/LoadVersionInfoTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php b/tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php index 7938367526..5c8a7b5771 100644 --- a/tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php +++ b/tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php @@ -42,4 +42,18 @@ public function testLoadVersionInfoListByContentInfo(): void self::assertEquals($loadedVersionInfo, $versionInfo); } } + + public function testLoadVersionInfoListByContentInfoForTopLevelNode(): void + { + $contentService = self::getContentService(); + $locationService = self::getLocationService(); + + $location = $locationService->loadLocation(1); + + $versionInfoList = $contentService->loadVersionInfoListByContentInfo( + [$location->getContentInfo()] + ); + + self::assertCount(0, $versionInfoList); + } }