From 91185a93dcb38190a31c5e40d4910cef7e04e90c Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 9 Aug 2020 14:12:17 +0200 Subject: [PATCH 01/17] Starting from scratch again: PHP8 nightly build included in test run, and it should pickup PHPUnit >= 9.3 --- .travis.yml | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 77eed441..b22f6a26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 7.2 - 7.3 - 7.4 + - nightly cache: directories: diff --git a/composer.json b/composer.json index 00b6fe9e..5e966ed9 100644 --- a/composer.json +++ b/composer.json @@ -66,7 +66,7 @@ "jpgraph/jpgraph": "^4.0", "mpdf/mpdf": "^8.0", "phpcompatibility/php-compatibility": "^9.3", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^8.5|^9.3", "squizlabs/php_codesniffer": "^3.5", "tecnickcom/tcpdf": "^6.3" }, From 9d17408f1d212cdc42b027d8c59563886de6f0cc Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 9 Aug 2020 14:26:44 +0200 Subject: [PATCH 02/17] xdebug isn't built into the nightly PHP, so we'll get an error if we try to remove it; nightly should also be allow failures untilany identified issues are resolved --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b22f6a26..95ba404d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,15 @@ cache: before_script: # Deactivate xdebug - - phpenv config-rm xdebug.ini + - if [[ $TRAVIS_PHP_VERSION <> nightly ]]; then phpenv config-rm xdebug.ini; fi - composer install --ignore-platform-reqs script: - ./vendor/bin/phpunit --color=always --coverage-text +allow_failures: + - php: nightly + jobs: include: From adc0e980e152583f804141b774cf8e46de6d1b5d Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 9 Aug 2020 14:33:13 +0200 Subject: [PATCH 03/17] <>/!= --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 95ba404d..c99c3aa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ cache: before_script: # Deactivate xdebug - - if [[ $TRAVIS_PHP_VERSION <> nightly ]]; then phpenv config-rm xdebug.ini; fi + - if [[ $TRAVIS_PHP_VERSION != nightly ]]; then phpenv config-rm xdebug.ini; fi - composer install --ignore-platform-reqs script: From 23e3a09dd365da772c463e9338d14dc15a7fd944 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Tue, 1 Sep 2020 11:02:07 +0200 Subject: [PATCH 04/17] Update to versions of complex and matrix libraries --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 5e966ed9..a122ec2c 100644 --- a/composer.json +++ b/composer.json @@ -54,8 +54,8 @@ "ext-zip": "*", "ext-zlib": "*", "maennchen/zipstream-php": "^2.1", - "markbaker/complex": "^1.4", - "markbaker/matrix": "^1.2", + "markbaker/complex": "^1.5|^2.0", + "markbaker/matrix": "^1.2|^2.0", "psr/simple-cache": "^1.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" From 7d05e0557c1c0150db1ec02492c66aeec3e34724 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 1 Oct 2020 11:30:09 +0200 Subject: [PATCH 05/17] Update to versions of complex and matrix libraries --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a122ec2c..09e6edf9 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ ] }, "require": { - "php": "^7.2", + "php": "^7.2|^8.0", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", From 71f21fb94aff88603cca26bcbf694f51c1cc5943 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 8 Oct 2020 02:56:13 +0200 Subject: [PATCH 06/17] Separate compoer.json for PHP8 to enforce phpunit ^9.3 --- .travis.yml | 1 + composer.php8.json | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 composer.php8.json diff --git a/.travis.yml b/.travis.yml index c99c3aa4..24888140 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ cache: before_script: # Deactivate xdebug - if [[ $TRAVIS_PHP_VERSION != nightly ]]; then phpenv config-rm xdebug.ini; fi + - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then cp composer.php8.json composer.json; fi - composer install --ignore-platform-reqs script: diff --git a/composer.php8.json b/composer.php8.json new file mode 100644 index 00000000..b7ba2813 --- /dev/null +++ b/composer.php8.json @@ -0,0 +1,89 @@ +{ + "name": "phpoffice/phpspreadsheet", + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"], + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "scripts": { + "check": [ + "php-cs-fixer fix --ansi --dry-run --diff", + "phpcs", + "phpunit --color=always" + ], + "fix": [ + "php-cs-fixer fix --ansi" + ], + "versions": [ + "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.2- -n" + ] + }, + "require": { + "php": "^7.2|^8.0", + "ext-ctype": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-fileinfo": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-SimpleXML": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "maennchen/zipstream-php": "^2.1", + "markbaker/complex": "^1.5|^2.0", + "markbaker/matrix": "^1.2|^2.0", + "psr/simple-cache": "^1.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "require-dev": { + "dompdf/dompdf": "^0.8.5", + "friendsofphp/php-cs-fixer": "^2.16", + "jpgraph/jpgraph": "^4.0", + "mpdf/mpdf": "^8.0", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "^6.3" + }, + "suggest": { + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer", + "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers" + }, + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "autoload-dev": { + "psr-4": { + "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests" + } + } +} From f399acccc9adca54202b609f58397ff8740e6871 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 8 Oct 2020 03:00:53 +0200 Subject: [PATCH 07/17] We don't want the composer lock file for PHP8 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 24888140..f5866b98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ cache: before_script: # Deactivate xdebug - if [[ $TRAVIS_PHP_VERSION != nightly ]]; then phpenv config-rm xdebug.ini; fi + - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then rm composer.lock; fi - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then cp composer.php8.json composer.json; fi - composer install --ignore-platform-reqs From 3db9fb7958623360c7f21e3222f785a156d1997a Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 8 Oct 2020 05:51:06 +0200 Subject: [PATCH 08/17] Work with existing composer file; but force a fresh install to require new dependency versions --- .travis.yml | 1 - composer.php8.json | 89 ---------------------------------------------- 2 files changed, 90 deletions(-) delete mode 100644 composer.php8.json diff --git a/.travis.yml b/.travis.yml index f5866b98..d8e0c168 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ before_script: # Deactivate xdebug - if [[ $TRAVIS_PHP_VERSION != nightly ]]; then phpenv config-rm xdebug.ini; fi - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then rm composer.lock; fi - - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then cp composer.php8.json composer.json; fi - composer install --ignore-platform-reqs script: diff --git a/composer.php8.json b/composer.php8.json deleted file mode 100644 index b7ba2813..00000000 --- a/composer.php8.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "phpoffice/phpspreadsheet", - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"], - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "https://blog.maartenballiauw.be" - }, - { - "name": "Mark Baker", - "homepage": "https://markbakeruk.net" - }, - { - "name": "Franck Lefevre", - "homepage": "https://rootslabs.net" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Adrien Crivelli" - } - ], - "scripts": { - "check": [ - "php-cs-fixer fix --ansi --dry-run --diff", - "phpcs", - "phpunit --color=always" - ], - "fix": [ - "php-cs-fixer fix --ansi" - ], - "versions": [ - "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.2- -n" - ] - }, - "require": { - "php": "^7.2|^8.0", - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-fileinfo": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-SimpleXML": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "maennchen/zipstream-php": "^2.1", - "markbaker/complex": "^1.5|^2.0", - "markbaker/matrix": "^1.2|^2.0", - "psr/simple-cache": "^1.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0" - }, - "require-dev": { - "dompdf/dompdf": "^0.8.5", - "friendsofphp/php-cs-fixer": "^2.16", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", - "phpcompatibility/php-compatibility": "^9.3", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "^6.3" - }, - "suggest": { - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers" - }, - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "autoload-dev": { - "psr-4": { - "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests" - } - } -} From 8d0bb374e4337d74f426c807c303353636b58c19 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 8 Oct 2020 06:09:16 +0200 Subject: [PATCH 09/17] Allow failures on nightly --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d8e0c168..29e780f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ php: - 7.2 - 7.3 - 7.4 - - nightly cache: directories: From 723ca37530ceb7ee42e1680c582d2edf45f5f1e1 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 8 Oct 2020 06:10:16 +0200 Subject: [PATCH 10/17] Allow failures on nightly fails if we remove it from the grid --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 29e780f3..d8e0c168 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 7.2 - 7.3 - 7.4 + - nightly cache: directories: From 87a909aaf8987166541d95b702b05a16fd7e5163 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 12:58:33 +0200 Subject: [PATCH 11/17] Use ZipArchive methods as zip_* functions are deprecated in PHP8 --- .../Writer/Xlsx/UnparsedDataCloneTest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php index d2afb423..2eeaef9d 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php @@ -34,19 +34,20 @@ class UnparsedDataCloneTest extends TestCase $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); $writer->save($resultFilename); $dupname = 'Unable to open saved file'; - $zip = zip_open($resultFilename); - if (is_resource($zip)) { + + $zip = new \ZipArchive(); + if ($zip->open($resultFilename) !== false) { $names = []; $dupname = ''; - while ($zip_entry = zip_read($zip)) { - $zipname = zip_entry_name($zip_entry); - if (in_array($zipname, $names)) { - $dupname .= "$zipname,"; + for ($index = 0; $index < $zip->numFiles; ++$index) { + $filename = $zip->getNameIndex($index); + if (in_array($filename, $names)) { + $dupname .= "$filename,"; } else { - $names[] = $zipname; + $names[] = $filename; } } - zip_close($zip); + $zip->close(); } unlink($resultFilename); self::assertEquals('', $dupname); From ee13533db3c06b3f256bcd96e0e75b5f5ce53aad Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 14:31:16 +0200 Subject: [PATCH 12/17] Remove tests that include tcPDF and DomPDF libraries when running against PHP8, because neither library is yet PHP8-ready --- samples/Basic/26_Utf8.php | 10 ++++---- samples/Pdf/21b_Pdf.php | 24 +++++++++++-------- .../Functional/StreamTest.php | 13 +++++++--- .../PhpSpreadsheetTests/Helper/SampleTest.php | 10 ++++++++ 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/samples/Basic/26_Utf8.php b/samples/Basic/26_Utf8.php index 52a64509..52953251 100644 --- a/samples/Basic/26_Utf8.php +++ b/samples/Basic/26_Utf8.php @@ -12,10 +12,12 @@ $spreadsheet = $reader->load(__DIR__ . '/../templates/26template.xlsx'); // at this point, we could do some manipulations with the template, but we skip this step $helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']); -// Export to PDF (.pdf) -$helper->log('Write to PDF format'); -IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class); -$helper->write($spreadsheet, __FILE__, ['Pdf']); +if (\PHP_VERSION_ID < 80000) { + // Export to PDF (.pdf) + $helper->log('Write to PDF format'); + IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class); + $helper->write($spreadsheet, __FILE__, ['Pdf']); +} // Remove first two rows with field headers before exporting to CSV $helper->log('Removing first two heading rows for CSV export'); diff --git a/samples/Pdf/21b_Pdf.php b/samples/Pdf/21b_Pdf.php index c67ff3d2..6770b7c5 100644 --- a/samples/Pdf/21b_Pdf.php +++ b/samples/Pdf/21b_Pdf.php @@ -32,11 +32,13 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false); $helper->log('Set orientation to landscape'); $spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); -$helper->log('Write to Dompdf'); -$writer = new Dompdf($spreadsheet); -$filename = $helper->getFileName('21b_Pdf_dompdf.xlsx', 'pdf'); -$writer->setEditHtmlCallback('replaceBody'); -$writer->save($filename); +if (\PHP_VERSION_ID < 80000) { + $helper->log('Write to Dompdf'); + $writer = new Dompdf($spreadsheet); + $filename = $helper->getFileName('21b_Pdf_dompdf.xlsx', 'pdf'); + $writer->setEditHtmlCallback('replaceBody'); + $writer->save($filename); +} $helper->log('Write to Mpdf'); $writer = new Mpdf($spreadsheet); @@ -44,8 +46,10 @@ $filename = $helper->getFileName('21b_Pdf_mpdf.xlsx', 'pdf'); $writer->setEditHtmlCallback('replaceBody'); $writer->save($filename); -$helper->log('Write to Tcpdf'); -$writer = new Tcpdf($spreadsheet); -$filename = $helper->getFileName('21b_Pdf_tcpdf.xlsx', 'pdf'); -$writer->setEditHtmlCallback('replaceBody'); -$writer->save($filename); +if (\PHP_VERSION_ID < 80000) { + $helper->log('Write to Tcpdf'); + $writer = new Tcpdf($spreadsheet); + $filename = $helper->getFileName('21b_Pdf_tcpdf.xlsx', 'pdf'); + $writer->setEditHtmlCallback('replaceBody'); + $writer->save($filename); +} \ No newline at end of file diff --git a/tests/PhpSpreadsheetTests/Functional/StreamTest.php b/tests/PhpSpreadsheetTests/Functional/StreamTest.php index dcca6b8a..3ca01fc4 100644 --- a/tests/PhpSpreadsheetTests/Functional/StreamTest.php +++ b/tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -10,16 +10,23 @@ class StreamTest extends TestCase { public function providerFormats(): array { - return [ + $providerFormats = [ ['Xls'], ['Xlsx'], ['Ods'], ['Csv'], ['Html'], - ['Tcpdf'], - ['Dompdf'], ['Mpdf'], ]; + + if (\PHP_VERSION_ID < 80000) { + $providerFormats = array_merge( + $providerFormats, + [['Tcpdf'],['Dompdf']] + ); + } + + return $providerFormats; } /** diff --git a/tests/PhpSpreadsheetTests/Helper/SampleTest.php b/tests/PhpSpreadsheetTests/Helper/SampleTest.php index eb729dc9..369b205e 100644 --- a/tests/PhpSpreadsheetTests/Helper/SampleTest.php +++ b/tests/PhpSpreadsheetTests/Helper/SampleTest.php @@ -31,6 +31,16 @@ class SampleTest extends TestCase 'Chart/32_Chart_read_write_PDF.php', // Unfortunately JpGraph is not up to date for latest PHP and raise many warnings 'Chart/32_Chart_read_write_HTML.php', // idem ]; + // TCPDF and DomPDF libraries don't support PHP8 yet + if (\PHP_VERSION_ID >= 80000) { + $skipped = array_merge( + $skipped, + [ + 'Pdf/21_Pdf_Domdf.php', + '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 From 6e6c68e7b3e294d9e8a1acd921ca4a039db56aa6 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 14:52:01 +0200 Subject: [PATCH 13/17] Let's try to figure out why we're having an issue with a temp csv file --- src/PhpSpreadsheet/Reader/Csv.php | 1 + tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index db2b50b9..30b39a9b 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -522,6 +522,7 @@ class Csv extends BaseReader // Attempt to guess mimetype $type = mime_content_type($pFilename); + var_dump($type); $supportedTypes = [ 'text/csv', 'text/plain', diff --git a/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php b/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php index d048183c..d4799356 100644 --- a/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php @@ -153,6 +153,7 @@ class CsvEnclosureTest extends Functional\AbstractFunctional $writer->save($filename); $filedata = file_get_contents($filename); $filedata = preg_replace('/\\r/', '', $filedata); + var_dump($filedata); $reader = new CsvReader(); $reader->setDelimiter($delimiter); $reader->setEnclosure($enclosure); From e3b9b0d29cfd301a8ba3f9af37e1080607dac6df Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 14:57:45 +0200 Subject: [PATCH 14/17] Need to add `application/csv` to the list of valid CSV mime types --- src/PhpSpreadsheet/Reader/Csv.php | 2 +- tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index 30b39a9b..d6eb16b0 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -522,8 +522,8 @@ class Csv extends BaseReader // Attempt to guess mimetype $type = mime_content_type($pFilename); - var_dump($type); $supportedTypes = [ + 'application/csv', 'text/csv', 'text/plain', 'inode/x-empty', diff --git a/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php b/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php index d4799356..d048183c 100644 --- a/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Csv/CsvEnclosureTest.php @@ -153,7 +153,6 @@ class CsvEnclosureTest extends Functional\AbstractFunctional $writer->save($filename); $filedata = file_get_contents($filename); $filedata = preg_replace('/\\r/', '', $filedata); - var_dump($filedata); $reader = new CsvReader(); $reader->setDelimiter($delimiter); $reader->setEnclosure($enclosure); From 930fdc1b0c0f3ef3bbeb50641997e1a330de0402 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 15:59:59 +0200 Subject: [PATCH 15/17] Locale-specific float to string is changed in PHP as per https://wiki.php.net/rfc/locale_independent_float_to_string --- tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php index 81d4a777..83defb7b 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest.php @@ -54,6 +54,7 @@ class LocaleFloatsTest extends TestCase preg_match('/(?:double|float)\(([^\)]+)\)/mui', ob_get_clean(), $matches); self::assertArrayHasKey(1, $matches); $actual = $matches[1]; - self::assertEquals('1,1', $actual); + // From PHP8, https://wiki.php.net/rfc/locale_independent_float_to_string applies + self::assertEquals((\PHP_VERSION_ID < 80000) ? '1,1' : '1.1', $actual); } } From dcc47fb287d4bac982fab8d80780583151b4188b Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 9 Oct 2020 16:08:20 +0200 Subject: [PATCH 16/17] Codestyle clean-ups --- samples/Pdf/21b_Pdf.php | 2 +- tests/PhpSpreadsheetTests/Functional/StreamTest.php | 2 +- .../PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/samples/Pdf/21b_Pdf.php b/samples/Pdf/21b_Pdf.php index 6770b7c5..ad2f609b 100644 --- a/samples/Pdf/21b_Pdf.php +++ b/samples/Pdf/21b_Pdf.php @@ -52,4 +52,4 @@ if (\PHP_VERSION_ID < 80000) { $filename = $helper->getFileName('21b_Pdf_tcpdf.xlsx', 'pdf'); $writer->setEditHtmlCallback('replaceBody'); $writer->save($filename); -} \ No newline at end of file +} diff --git a/tests/PhpSpreadsheetTests/Functional/StreamTest.php b/tests/PhpSpreadsheetTests/Functional/StreamTest.php index 3ca01fc4..03f9a2d9 100644 --- a/tests/PhpSpreadsheetTests/Functional/StreamTest.php +++ b/tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -22,7 +22,7 @@ class StreamTest extends TestCase if (\PHP_VERSION_ID < 80000) { $providerFormats = array_merge( $providerFormats, - [['Tcpdf'],['Dompdf']] + [['Tcpdf'], ['Dompdf']] ); } diff --git a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php index 2eeaef9d..660e40fe 100644 --- a/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataCloneTest.php @@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Shared\File; use PHPUnit\Framework\TestCase; +use ZipArchive; class UnparsedDataCloneTest extends TestCase { @@ -35,7 +36,7 @@ class UnparsedDataCloneTest extends TestCase $writer->save($resultFilename); $dupname = 'Unable to open saved file'; - $zip = new \ZipArchive(); + $zip = new ZipArchive(); if ($zip->open($resultFilename) !== false) { $names = []; $dupname = ''; From 2d93c36a1a0cc3faff4f76ccef883eec27e3cd73 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 10 Oct 2020 12:11:00 +0200 Subject: [PATCH 17/17] Update composer suggestions --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 09e6edf9..0fcb2556 100644 --- a/composer.json +++ b/composer.json @@ -72,8 +72,8 @@ }, "suggest": { "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer", + "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)", "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers" }, "autoload": {