Skip to content

Commit

Permalink
MDL-52983 excel output: avoid single quote on end of sheet name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aolley committed Feb 8, 2016
1 parent 9d5d9c6 commit 15c9a9d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/excellib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public function __construct($name, PHPExcel $workbook) {
$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!
Expand Down

0 comments on commit 15c9a9d

Please sign in to comment.