Opis\Closure\SerializableClosure - Error afer PHP 8.1 Update
Asked Answered
R

5

5

I have updated my system to PHP 8.1 (XAMPP). Now I have the problem that when I enter the command "php artisan serve" I get the following error message:

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).

Can you help me what I can do to make it work again?

Rosiorosita answered 11/1, 2022 at 14:14 Comment(2)
That isn't (or shouldn't be) a fatal error, just advance notice that something will be removed in a future version.Fasciculus
But now I have the problem that the software can no longer be started and this error always occurs, no matter what php artisan command I enter...Rosiorosita
A
17

You need to update laravel dependencies. Simply go to your project root directory and use composer to update dependencies using command prompt.

Command should be:

composer update
Advowson answered 12/1, 2022 at 23:22 Comment(0)
G
0

composer upgrade laravel/framework --with-all-dependencies

You would need to update laravel/framework with it's dependencies. Instead of running composer upgrade which upgrades all packages, you could just run composer upgrade laravel/framework --with-all-dependencies, shorthand is -W.

From the composer command help -W Update also dependencies of packages in the argument list, including those which are root requirements.

Grozny answered 31/7, 2022 at 14:46 Comment(0)
G
0

I had the same error with my version of laravel (8.54) after updating my PHP version to version 8.1 So what I did is to downgrade my PHP version to version 8.0. Then it worked again. PS: make sure to have framework/sessions, framework/views and framework/cache in the storage folder

Graveyard answered 8/7, 2023 at 18:12 Comment(0)
A
0

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)

Anatropous answered 18/2, 2024 at 9:13 Comment(1)
Changing files in the vendor/-folder is very much not recommended as you will lose them next time you run composer updateEatage
P
-1

Just delete composer.lock.json, with me resolve and after run composer install

Phonetist answered 27/5, 2022 at 16:11 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Pinchhit

© 2022 - 2025 — McMap. All rights reserved.