From d70e6e4e9a32dedbf637eadacd2574161f104c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Aug 2019 02:17:33 +0200 Subject: [PATCH] Fix record file with empty name --- htdocs/website/class/website.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 31b10401c8c..147955db4a5 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1065,6 +1065,8 @@ class Website extends CommonObject { while (! feof($fp)) { + $reg = array(); + // Warning fgets with second parameter that is null or 0 hang. $buf = fgets($fp, 65000); if (preg_match('/^-- Page ID (\d+)\s[^\s]+\s(\d+).*Aliases\s(.*)\s--;/i', $buf, $reg)) @@ -1086,8 +1088,11 @@ class Website extends CommonObject // Regenerate alternative aliases pages foreach($aliasesarray as $aliasshortcuttocreate) { - $filealias=$conf->website->dir_output.'/'.$object->ref.'/'.$aliasshortcuttocreate.'.php'; - dolSavePageAlias($filealias, $object, $objectpagestatic); + if (trim($aliasshortcuttocreate)) + { + $filealias=$conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php'; + dolSavePageAlias($filealias, $object, $objectpagestatic); + } } } }