diff --git a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php index 9792fe0f..3b2eb9af 100644 --- a/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -217,7 +217,7 @@ class BIFFwriter // Retrieve the last chunk of data $header = pack('vv', $record, strlen($data) - $i); $tmp .= $header; - $tmp .= substr($data, $i, strlen($data) - $i); + $tmp .= substr($data, $i); return $tmp; } diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 19a3b3f8..b7404a1b 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -561,7 +561,7 @@ class Parser private function convertString($string) { // chop away beggining and ending quotes - $string = substr($string, 1, strlen($string) - 2); + $string = substr($string, 1, -2); if (strlen($string) > 255) { throw new WriterException('String is too long'); }