Details
-
Bug
-
Resolution: Fixed
-
Critical
-
2.3.2
Description
Hello,
Explanation and reproduction are pretty simple.
Create a CollectionList block, add few locations and publish.
Then remove one of the locations you associated in the Block
Result: it is crashing the page entirely.
Debug:
vendor/ezsystems/ezplatform-page-fieldtype/src/lib/FieldType/Page/Block/Relation/Extractor/LocationListBlockAttributeRelationExtractor.php (line 54)
public function extract( Page $page, BlockValue $blockValue, BlockAttributeDefinition $attributeDefinition, Attribute $attribute ): array { $contentIds = []; if (!empty($attribute->getValue())) { $locationIds = explode(',', $attribute->getValue()); $locations = array_map([$this->locationService, 'loadLocation'], $locationIds); $contentIds = array_column($locations, 'contentId'); } return array_unique(array_map('intval', $contentIds)); }
This is wrong:
$locations = array_map([$this->locationService, 'loadLocation'], $locationIds);
some kind of tests must be done.
Also I think the error could also be fixed by removing the locationId from the list when the actual location is removed.
Thx!