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

After upgrading from version 10.20.0 to 10.37.1, an error occurs with route::cache. #49357

Closed
silie666 opened this issue Dec 13, 2023 · 3 comments

Comments

@silie666
Copy link

silie666 commented Dec 13, 2023

Laravel Version

10.37.1

PHP Version

8.1.21

Database Driver & Version

No response

Description

After running php artisan route:cache, it directly throws an exception.

 Exception 

  Serialization of 'WeakMap' is not allowed

  at vendor/laravel/framework/src/Illuminate/Routing/Route.php:1344
    1340▕     public function prepareForSerialization()
    1341▕     {
    1342▕         if ($this->action['uses'] instanceof Closure) {
    1343▕             $this->action['uses'] = serialize(
  ➜ 1344▕                 SerializableClosure::unsigned($this->action['uses'])
    1345▕             );
    1346▕         }
    1347▕
    1348▕         if (isset($this->action['missing']) && $this->action['missing'] instanceof Closure) {

      +14 vendor frames 

  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

image
image

Steps To Reproduce

My route file is web.php. Here is a snippet of my code.

use Illuminate\Support\Facades\Route;

$log = app('log');
Route::any('/{all}', function () use ($log) {

})->where(['all' => '.*']);
@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@silie666
Copy link
Author

@crynobone repository

@crynobone
Copy link
Member

Such usage is not supported unfortunately, you should however can change it to the following:

use Psr\Log\LoggerInterface;

Route::any('/{all}', function (LoggerInterface $log) {

})->where(['all' => '.*']);

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

No branches or pull requests

2 participants