lavacharts icon indicating copy to clipboard operation
lavacharts copied to clipboard

Fix compatibility issues under PHP 8.1, which may cause opcache compilation errors

Open jackwh opened this issue 2 years ago • 1 comments

The JavascriptDate class included in this package has an incompatible constructor with its parent class, Carbon.

This won't cause issues prior to PHP 8.1 — and is unlikely to even affect those using 8.1 anyway, as the JavascriptDate class doesn't actually seem to be called anywhere in the package :)

However... If you try to pre-compile your application scripts with the PHP opcache, an E_COMPILE_ERROR is thrown, which can randomly cause your entire autoloader to break 🧨 (as I found out the hard way...). This is due to a PHP bug, which has only recently been fixed (https://github.com/php/php-src/issues/8164)

A new release tagged as 3.1.15 would be great. Thank you!

jackwh avatar May 17 '22 19:05 jackwh

Would you consider to also add this in the PR as it is also PHP 8 related?

Return type of Khill\Lavacharts\Support\Contracts\Jsonable::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

I think for BC of this package the attribute would be the more senisble way.

MisatoTremor avatar Jul 12 '22 17:07 MisatoTremor