diff --git a/lib/excellib.class.php b/lib/excellib.class.php index b75f173a06e..ff382526cd8 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -163,6 +163,8 @@ class MoodleExcelWorksheet { $name = strtr(trim($name, "'"), '[]*/\?:', ' '); // Shorten the title if necessary. $name = core_text::substr($name, 0, 31); + // After the substr, we might now have a single quote on the end. + $name = trim($name, "'"); if ($name === '') { // Name is required!