Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error in file.php when using PHP 8.2.0beta1 #2970

Closed
1 of 8 tasks
W1DJM opened this issue Jul 29, 2022 · 2 comments
Closed
1 of 8 tasks

Fatal error in file.php when using PHP 8.2.0beta1 #2970

W1DJM opened this issue Jul 29, 2022 · 2 comments

Comments

@W1DJM
Copy link

W1DJM commented Jul 29, 2022

This is:

[X] a bug report

What is the expected behavior?

The spreadsheet should be read and processed without error.

What is the current behavior?

A fatal error is thrown when using PHP 8.2.0beta1 - the same code does not produce an error when using PHP 8.1.8.

PHP Fatal error: Uncaught Error: Class "ZipArchive" not found in phpspreadsheet\src\PhpSpreadsheet\Shared\File.php:63

Stack trace:
#0 \phpspreadsheet\src\PhpSpreadsheet\Shared\File.php(183): PhpOffice\PhpSpreadsheet\Shared\File::fileExists('zip://\DEQ\Bent...')
#1 \phpspreadsheet\src\PhpSpreadsheet\Reader\Xlsx.php(77): PhpOffice\PhpSpreadsheet\Shared\File::testFileNoThrow('\DEQ\Benthos\Pl...', '_rels/.rels')
#2 \phpspreadsheet\src\PhpSpreadsheet\IOFactory.php(149): PhpOffice\PhpSpreadsheet\Reader\Xlsx->canRead('\DEQ\Benthos\Pl...')
#3 \phpspreadsheet\src\PhpSpreadsheet\IOFactory.php(110): PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile('\DEQ\Benthos\Pl...', NULL)
#4 Load_Benthic_Data.php(132): PhpOffice\PhpSpreadsheet\IOFactory::identify('\DEQ\Benthos\Pl...')
#5 {main}
thrown in \phpspreadsheet\src\PhpSpreadsheet\Shared\File.php on line 63

The file being processed is not a ZIP file, it is an xlsx file.

What are the steps to reproduce?

<?php

require __DIR__ . '/vendor/autoload.php';

$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify('BugReportData.xlsx');

What features do you think are causing the issue

  • Reader
  • Writer
  • Styles
  • Data Validations
  • Formula Calculations
  • Charts
  • AutoFilter
  • Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

Only tested with .xlsx files.

Which versions of PhpSpreadsheet and PHP are affected?

PHP 8.2.0beta1 and PhpSpreadhseet 1.24.1 (earlier versions were not tried)

BugReportData.xlsx
.

@MarkBaker
Copy link
Member

MarkBaker commented Jul 29, 2022

That sounds like your build of PHP 8.2 isn't built with the ext-zip extension

If you built it yourself, please follow the instructions from the PHP docs

@W1DJM
Copy link
Author

W1DJM commented Jul 29, 2022

Thanks for the comment Mark. I did not build it myself but I will go back to the packager and see if perhaps they missed it in their build. Comparing the registered streams from 8.1.8 to 8.2.0beta1 I do see that zip is not in the beta so this does indeed seem to be a PHP issue.

@W1DJM W1DJM closed this as completed Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants