From 453f8f182140930f18fe9edaf8dc84cd5560c9a3 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Fri, 22 Dec 2017 11:00:58 +0100 Subject: [PATCH] Simplify substr usages --- src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php | 2 +- src/PhpSpreadsheet/Writer/Xls/Parser.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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'); }