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

unexpected identifier "Closure" #3616

Closed
1 of 8 tasks
yjg18com opened this issue Jun 15, 2023 · 8 comments
Closed
1 of 8 tasks

unexpected identifier "Closure" #3616

yjg18com opened this issue Jun 15, 2023 · 8 comments

Comments

@yjg18com
Copy link

yjg18com commented Jun 15, 2023

This is:

I have a project that requires the use of exported excel and am learning PhpSpreadsheet, but for some reason it always fails to execute in my projects.

Error message
ParseError: syntax error, unexpected identifier "Closure", expecting variable in
/wwwroot/admin/vendor/maennchen/zipstream-php/src/ZipStream.php:111

php 8.02+ phpspreadsheet 1.29

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);
$file_path = public_path().'/hello_world.xlsx';
$writer->save($file_path);

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?

Which versions of PhpSpreadsheet and PHP are affected?

ubuntu 20.04.6
PHP 8.02
PhpSpreadsheet 1.29

@maennchen
Copy link

ZipStream v3 requires PHP ^8.1 to work. I think you've ignored the plaform requirements when installing your dependencies or are running with a different version than the one used to run composer.

You can force the dependency back to v2 which is compatible with PHP 8.0 by requiring "maennchen/zipstream-php": "^2.4".

@oleibman
Copy link
Collaborator

A similar problem was solved via #3615 (comment)
Perhaps that would also work for you.

@Benjizle
Copy link

Benjizle commented Jul 3, 2023

ZipStream v3 requires PHP ^8.1 to work. I think you've ignored the plaform requirements when installing your dependencies or are running with a different version than the one used to run composer.

You can force the dependency back to v2 which is compatible with PHP 8.0 by requiring "maennchen/zipstream-php": "^2.4".

Had this issue and your suggested solution helped me

@shaileshmmane
Copy link

shaileshmmane commented Jul 21, 2023

Installed PHP version 8.2.8 with Codeigniter 4
I did composer require phpoffice/phpspreadsheet.

Getting error "syntax error, unexpected identifier "Closure", expecting variable "
VENDORPATH/maennchen/zipstream-php/src/ZipStream.php at line 111

@tanay-ictlayer
Copy link

tanay-ictlayer commented Aug 19, 2023

Install PHP VERSION >= 8.2 . I hope your problem will be solved ( For me it worked )

@oleibman
Copy link
Collaborator

Closed as duplicate of #3615.

@MSayib
Copy link

MSayib commented Sep 14, 2023

ZipStream v3 requires PHP ^8.1 to work. I think you've ignored the plaform requirements when installing your dependencies or are running with a different version than the one used to run composer.

You can force the dependency back to v2 which is compatible with PHP 8.0 by requiring "maennchen/zipstream-php": "^2.4".

works like a charm

@yashtomer
Copy link

ZipStream v3 requires PHP ^8.1 to work. I think you've ignored the plaform requirements when installing your dependencies or are running with a different version than the one used to run composer.

You can force the dependency back to v2 which is compatible with PHP 8.0 by requiring "maennchen/zipstream-php": "^2.4".

Thanks @maennchen !

works like a charm

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

8 participants