diff --git a/.travis.yml b/.travis.yml index b9ad8de8..353fe141 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,6 @@ php: - 7.3 - 7.4snapshot -matrix: - fast_finish: true - allow_failures: - - php: 7.4snapshot - cache: directories: - cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 3044b116..0fb8791b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] + +### Changed + +- PHP 7.4 compatibility + +### Added + +- ... + +### Fixed + +- ... + ## [1.10.0] - 2019-11-18 ### Changed diff --git a/composer.lock b/composer.lock index 59850e2a..9299919f 100644 --- a/composer.lock +++ b/composer.lock @@ -578,16 +578,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.0", + "version": "v2.16.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "ceaff36bee1ed3f1bbbedca36d2528c0826c336d" + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ceaff36bee1ed3f1bbbedca36d2528c0826c336d", - "reference": "ceaff36bee1ed3f1bbbedca36d2528c0826c336d", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", "shasum": "" }, "require": { @@ -598,15 +598,15 @@ "ext-tokenizer": "*", "php": "^5.6 || ^7.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", @@ -619,8 +619,8 @@ "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3", - "symfony/yaml": "^3.0 || ^4.0" + "symfony/phpunit-bridge": "^4.3 || ^5.0", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -663,7 +663,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-11-03T13:31:09+00:00" + "time": "2019-11-25T22:10:32+00:00" }, { "name": "jpgraph/jpgraph", @@ -707,16 +707,16 @@ }, { "name": "mpdf/mpdf", - "version": "v8.0.3", + "version": "v8.0.4", "source": { "type": "git", "url": "https://github.com/mpdf/mpdf.git", - "reference": "6dd4285aff21f013554ff752046bb44ab1240f5f" + "reference": "d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/6dd4285aff21f013554ff752046bb44ab1240f5f", - "reference": "6dd4285aff21f013554ff752046bb44ab1240f5f", + "url": "https://api.github.com/repos/mpdf/mpdf/zipball/d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f", + "reference": "d3147a0d790b6d11936fd9c73fa31a7ed45e3f6f", "shasum": "" }, "require": { @@ -724,7 +724,7 @@ "ext-mbstring": "*", "myclabs/deep-copy": "^1.7", "paragonie/random_compat": "^1.4|^2.0|9.99.99", - "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0", + "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0", "psr/log": "^1.0", "setasign/fpdi": "^2.1" }, @@ -772,7 +772,7 @@ "php", "utf-8" ], - "time": "2019-10-25T17:54:07+00:00" + "time": "2019-11-28T09:39:33+00:00" }, { "name": "myclabs/deep-copy", diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 69fa756e..2cda7536 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -3459,7 +3459,7 @@ class Calculation $parenthesisDepthMap[$pendingStoreKey] -= 1; } - if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? + if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? if (!empty($pendingStoreKey) && $parenthesisDepthMap[$pendingStoreKey] == -1) { // we are closing an IF( if ($d['value'] != 'IF(') { diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 38bd87c6..bb2170be 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -270,10 +270,12 @@ class Functions public static function ifCondition($condition) { $condition = self::flattenSingleValue($condition); - if (!isset($condition[0]) && !is_numeric($condition)) { + + if ($condition === '') { $condition = '=""'; } - if (!in_array($condition[0], ['>', '<', '='])) { + + if (!is_string($condition) || !in_array($condition[0], ['>', '<', '='])) { if (!is_numeric($condition)) { $condition = Calculation::wrapResult(strtoupper($condition)); } diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index 73905d97..a568e3fa 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -370,7 +370,7 @@ class DataSeriesValues if ($flatten) { $this->dataValues = Functions::flattenArray($newDataValues); foreach ($this->dataValues as &$dataValue) { - if ((!empty($dataValue)) && ($dataValue[0] == '#')) { + if (is_string($dataValue) && !empty($dataValue) && $dataValue[0] == '#') { $dataValue = 0.0; } } diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 4c107505..86ee135b 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -429,18 +429,20 @@ class Xlsx extends BaseReader $sharedStrings = []; $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); - //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" - $xmlStrings = simplexml_load_string( - $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), - 'SimpleXMLElement', - Settings::getLibXmlLoaderOptions() - ); - if (isset($xmlStrings, $xmlStrings->si)) { - foreach ($xmlStrings->si as $val) { - if (isset($val->t)) { - $sharedStrings[] = StringHelper::controlCharacterOOXML2PHP((string) $val->t); - } elseif (isset($val->r)) { - $sharedStrings[] = $this->parseRichText($val); + if ($xpath) { + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlStrings = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if (isset($xmlStrings, $xmlStrings->si)) { + foreach ($xmlStrings->si as $val) { + if (isset($val->t)) { + $sharedStrings[] = StringHelper::controlCharacterOOXML2PHP((string) $val->t); + } elseif (isset($val->r)) { + $sharedStrings[] = $this->parseRichText($val); + } } } } @@ -1421,7 +1423,7 @@ class Xlsx extends BaseReader } } - if ((!$this->readDataOnly) || (!empty($this->loadSheetsOnly))) { + if ((!$this->readDataOnly || !empty($this->loadSheetsOnly)) && isset($xmlWorkbook->bookViews->workbookView)) { $workbookView = $xmlWorkbook->bookViews->workbookView; // active sheet index diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 1b8bae27..59820628 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -1077,7 +1077,7 @@ class Parser public function parse($formula) { $this->currentCharacter = 0; - $this->formula = $formula; + $this->formula = (string) $formula; $this->lookAhead = $formula[1] ?? ''; $this->advance(); $this->parseTree = $this->condition(); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php index a12984e7..91f66263 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/SubTotalTest.php @@ -138,7 +138,7 @@ class SubTotalTest extends TestCase protected function cellIsFormula(array $cellValues) { foreach ($cellValues as $cellValue) { - yield $cellValue[0] === '='; + yield is_string($cellValue) && $cellValue[0] === '='; } } diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php index 86f00b19..0717fa82 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php @@ -86,7 +86,7 @@ class UnparsedDataTest extends TestCase $this->assertContains('pageSetup->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); - $this->assertNotEmpty($pageSetupAttributes['id'], 'sheet1.xml/pageSetup[r:id] not found!'); + $this->assertTrue(isset($pageSetupAttributes->id), 'sheet1.xml/pageSetup[r:id] not found!'); if (!$xmlWorksheet->sheetProtection) { $this->fail('sheet1.xml/sheetProtection not found!'); } else {