Fix empty $sublang dolSavePageAlias

Avoid to loop on `explode(',', $object->otherlang)` if
`$object->otherlang` is empty. Else we loop once on empty string which
is set in `$sublang` and erase the main alias for the page.
This commit is contained in:
Indelog 2021-04-06 22:21:00 +02:00
parent a50ca93a3e
commit 4d60fe8ff9

View File

@ -104,7 +104,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
}
// Save also alias into all language subdirectories if it is a main language
elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) {
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && !empty($object->otherlang)) {
$dirname = dirname($filealias);
$filename = basename($filealias);
foreach (explode(',', $object->otherlang) as $sublang) {