MDL-52983 excel output: avoid single quote on end of sheet name

This change resolves a problem where a long sheet name, which gets
trimmed down with substr($name, 0, 31), could result in a sheet name
with a single quote on the end because the quote removal was done before
the substr.
This commit is contained in:
Adam Olley
2016-02-08 15:18:00 +10:30
parent 80b09028d1
commit 26685f13a0
+2
View File
@@ -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!