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

[Bug]: "MyCLabs\Enum\Enum" triggered while exporting #4040

Closed
1 task done
Henalexandre opened this issue Nov 27, 2023 · 3 comments
Closed
1 task done

[Bug]: "MyCLabs\Enum\Enum" triggered while exporting #4040

Henalexandre opened this issue Nov 27, 2023 · 3 comments
Labels

Comments

@Henalexandre
Copy link

Henalexandre commented Nov 27, 2023

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1.50

What version of Laravel are you using?

10.33.0

What version of PHP are you using?

8.1.23

Describe your issue

Since I upgraded my Laravel project to php 8.1 and the latest versions of all packages, I can't export anything anymore because the "return Excel::download" returns a "Class "MyCLabs\Enum\Enum" not found" error.

How can the issue be reproduced?

I've just called the function to get my export :
return Excel::download(new AbonneExport($_POST['start-abo']), 'abonnements-'.date('dmy').'.xlsx');

The "AbonneExport" contained code to retrieve subscriptions from a Woocommerce site, but the exception is still thrown without any import or code inside.

What should be the expected behaviour?

I'm not sure where this exception actually comes from so I was hoping you could guide me. I can't figure out where in the project Enum would be used. Every other part of the site works fine, the exception is just being thrown here. From what I understand php 8.1 now supports the enum class, so I guess it overrides some stuff, but there doesn't seem to be any enum involved here. As it's only happening on exports, I was wondering if you had any idea.

@patrickbrouwers
Copy link
Member

I don't see how this is related to this package. We don't use MyCLabs\Enum\Enum. You probably have another package that uses that package. Check your composer.lock to see which package installs it.

@ziolupo68
Copy link

I have the same problem since I updated all the packages last week.

What is really strange is that CSV exporting is working while Excel exporting not. And using the same export class:
Working:

  public function exportOfferToCSV(int $id)
  {
    return Excel::download(new OfferExport($id), 'offer.csv');
  }

Not working:

  public function exportOfferToExcel(int $id)
  {
    return Excel::download(new OfferExport($id), 'offer.xlsx');
  }  

Error is the following: Class "MyCLabs\Enum\Enum" not found
Php Version 8.2.13
Laravel version: 10.37.3

@Henalexandre
Copy link
Author

It seems that one of the component of Laravel-Excel was not updated/installed correctly by composer. I reinstalled the different dependencies from the package to make it work. I can't remember which one fixed it but I'm pretty sure it was either maennchen/zipstream-php or phpoffice/phpspreadsheet (which includes the previous one)

To reinstall a dependency :
composer reinstall phpoffice/phpspreadsheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants