opis / closure

Serialize closures (anonymous functions)
https://opis.io/closure
MIT License
2.5k stars 81 forks source link

PHP Deprecated: Opis\Closure\SerializableClosure implements the Serializable interface, which is deprecated #124

Closed harryqt closed 1 year ago

harryqt commented 1 year ago

PHP 8.1

[31-Oct-2022 05:50:07 UTC] PHP Deprecated:  Opis\Closure\SerializableClosure implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /vendor/opis/closure/src/SerializableClosure.php on line 18
GrahamCampbell commented 1 year ago

Only the v4 beta supports PHP 8.1. ;)

GrahamCampbell commented 1 year ago

Alternatively, consider https://github.com/laravel/serializable-closure.

fuad4web commented 7 months ago

Error: C:\laragon\www\Laravel\brainiark_shop\vendor\opis\closure\src\SerializableClosure.php on line 18

I have the issue recently and it is caused by the Serializable interface not being use anymore in latest version of PHP.

You will find this on line 18 in this location on your project: vendor/opis/closure/src/SerializableCourse.php:

First Step (1): class SerializableClosure implements Serializable {}

change it to: class SerializableClosure {}

Second Step (2): public function serialize() {}

change it to: public function __serialize() {}

Third Step (3): public function serialize() {}

change it to: public function __serialize() {}

That's all, don't bother to thank me (smile)