From d2f55ffa07c8c725e26334f02c8e09f202503dc2 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 28 Jan 2018 16:23:38 +0900 Subject: [PATCH] Support PHP 7.2 --- .travis.yml | 4 +--- CHANGELOG.md | 1 + src/PhpSpreadsheet/Calculation/Calculation.php | 3 ++- tests/PhpSpreadsheetTests/Helper/SampleTest.php | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a63cdec1..ae5f5a09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,8 @@ php: matrix: include: - - php: 7.0 + - php: 7.1 env: COVERAGE=1 - allow_failures: - - php: 7.2 cache: directories: diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ef9d064..915c6081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added +- Support for PHP 7.2 - Support cell comments in HTML writer and reader - [#308](https://github.com/PHPOffice/PhpSpreadsheet/issues/308) - Option to stop at a conditional styling, if it matches (only XLSX format) - [#292](https://github.com/PHPOffice/PhpSpreadsheet/pull/292) - Support for line width for data series when rendering Xlsx - [#329](https://github.com/PHPOffice/PhpSpreadsheet/pull/329) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 721acc33..80d5b288 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2798,11 +2798,12 @@ class Calculation $matrixRows = count($matrix); $matrixColumns = 0; foreach ($matrix as $rowKey => $rowValue) { - $matrixColumns = max(count($rowValue), $matrixColumns); if (!is_array($rowValue)) { $matrix[$rowKey] = [$rowValue]; + $matrixColumns = max(1, $matrixColumns); } else { $matrix[$rowKey] = array_values($rowValue); + $matrixColumns = max(count($rowValue), $matrixColumns); } } $matrix = array_values($matrix); diff --git a/tests/PhpSpreadsheetTests/Helper/SampleTest.php b/tests/PhpSpreadsheetTests/Helper/SampleTest.php index 2f87d058..be1f50c6 100644 --- a/tests/PhpSpreadsheetTests/Helper/SampleTest.php +++ b/tests/PhpSpreadsheetTests/Helper/SampleTest.php @@ -30,6 +30,11 @@ class SampleTest extends TestCase 'Chart/32_Chart_read_write_HTML.php', // idem ]; + // TCPDF does not support PHP 7.2 + if (version_compare(PHP_VERSION, '7.2.0') >= 0) { + $skipped[] = 'Pdf/21_Pdf_TCPDF.php'; + } + // Unfortunately some tests are too long be ran with code-coverage // analysis on Travis, so we need to exclude them global $argv;