maennchen/ZipStream-PHP

Issues with PHP 8.1 nightly build

MarkBaker opened this issue · 2 comments

Description of the problem

Version 2.1.0 is triggering errors against the latest PHP 8.1 nightly build

Example code

Literally just instantiating a new archive with

$options = new \ZipStream\Option\Archive();

Informations

  • ZipStream-PHP version: 2.1.0
  • PHP version: 8.1 (nightly)

Please include any supplemental information you deem relevant to this issue.

This may be an issue with one of our dependencies, looking at the stack trace

/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/myclabs/php-enum/src/Enum.php:301
/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/myclabs/php-enum/src/Enum.php:22
/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/maennchen/zipstream-php/src/Option/Method.php:15
/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/maennchen/zipstream-php/src/Option/Archive.php:116

The actual error message is:

PHPUnit\Framework\Exception: PHP Fatal error:  During inheritance of JsonSerializable: Uncaught Declaration of MyCLabs\Enum\Enum::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed

So it looks like a "clash" between the Enum implementation in MyClabs\Enum and the new Enums in PHP 8.1, but with 8.1 now in its alpha release stages, I thought I'd better bring it to your attention

Well, thank you for bringing it to our attention. I think we'll move to enums from stdlib once 8.1 is released, as the MyClabs\Enum was just a polyfill until the PHP project implement them. It's also possible that MyClabs\Enum will be fixed to not clash with php 8.1 in future releases.

I'm closing this issue as there is no point yet for looking into it, let's see how it evolves, we need to give some time to the ecosystem ;)

Putting this link for us, not for you as you opened it ;)
myclabs/php-enum#144

Should now be resolved in the latest 1.8.1 release of MyClabs\Enum