Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
4.6.0, 3.3.37, 4.5.6
-
Ibexa Open Source
Description
Reproducible probably on PHP API level only (but see if it affects IBX-4753 and similar - unlikely since the prioritized languages list is present there but it's not full in these cases - worth to check anyway).
Steps to reproduce
- Create content item with 2 separate translations
- Try loading auto-generated entries via URLAliasService::listLocationAliases(custom:false) for a second language // double check that SA layer doesn't inject prioritized list when testing via CMD
Actual result
- See that even while persistence URL alias object contains all the information (meaning all translations), only the first one is loaded
- See that if $prioritizedLanguagesList is given, the entry is loaded correctly
Expected result
If an entry exists, it should be returned correctly for an empty prioritized languages list. If an entry doesn't exist in a given language, the first one should be returned (as-is now).
Seems this diff might resolve the issue: (ezplatform-kernel:1.3)
diff --git a/eZ/Publish/Core/Repository/URLAliasService.php b/eZ/Publish/Core/Repository/URLAliasService.php index 8a7b11ad53..46bad50c33 100644 --- a/eZ/Publish/Core/Repository/URLAliasService.php +++ b/eZ/Publish/Core/Repository/URLAliasService.php @@ -299,9 +299,10 @@ class URLAliasService implements URLAliasServiceInterface if ($spiUrlAlias->alwaysAvailable || $showAllTranslations) { $lastLevelData = end($spiUrlAlias->pathData); - reset($lastLevelData['translations']); --- a/eZ/Publish/Core/Repository/URLAliasService.php +++ b/eZ/Publish/Core/Repository/URLAliasService.php @@ -299,9 +299,10 @@ class URLAliasService implements URLAliasServiceInterface if ($spiUrlAlias->alwaysAvailable || $showAllTranslations) { $lastLevelData = end($spiUrlAlias->pathData); - reset($lastLevelData['translations']); - return key($lastLevelData['translations']); + return isset($lastLevelData['translations'][$languageCode]) - return key($lastLevelData['translations']); + return isset($lastLevelData['translations'][$languageCode]) + ? $languageCode + : (key($lastLevelData['translations']) ?? false); } return false;