From 4d60fe8ff9ff9c3971185b0a2307fe785cef41a6 Mon Sep 17 00:00:00 2001 From: Indelog Date: Tue, 6 Apr 2021 22:21:00 +0200 Subject: [PATCH] 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. --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 380a7c0dc12..0258d3d2c05 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -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) {