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

syntax error, unexpected token "list", expecting "(" #83

Closed
Wotuu opened this issue Mar 1, 2024 · 7 comments
Closed

syntax error, unexpected token "list", expecting "(" #83

Wotuu opened this issue Mar 1, 2024 · 7 comments

Comments

@Wotuu
Copy link

Wotuu commented Mar 1, 2024

Serializable Closure Version

1.3.3

PHP Version

8.2.15

Description

Recently I upgraded my Laravel app from 8.x to 10.x. Along with PHP from 7.4 to 8.2. Since doing this, I'm running into the following exception(s):

syntax error, unexpected token "list", expecting "("

On laravel-serializable-closure://function list(\Illuminate\Http\Request $request)
    {
        // Check if we're filtering based on team or not
        $teamPublicKey = $request->get('team_public_key', false);
        $userId        = (int)$request->get('user_id', 0);
        // Check if we should load the team's tags or the personal tags
        $tagCategoryName = $teamPublicKey ? \App\Models\Tags\TagCategory::DUNGEON_ROUTE_TEAM : \App\Models\Tags\TagCategory::DUNGEON_ROUTE_PERSONAL;
        $tagCategoryId   = \App\Models\Tags\TagCategory::ALL[$tagCategoryName];

        // Which relationship should be load?
        $tagsRelationshipName = $teamPublicKey ? 'tagsteam' : 'tagspersonal';

        $routes = \App\Models\DungeonRoute\DungeonRoute::with(['faction', 'specializations', 'classes', 'races', 'dungeon', 'affixes',
                                      'author', 'routeattributes', 'ratings', 'metricAggregations', $tagsRelationshipName])
            // Specific selection of dungeon columns; if we don't do it somehow the Affixes and Attributes of the result is cleared.
            // Probably selecting similar named columns leading Laravel to believe the relation is already satisfied.
            ->selectRaw('dungeon_routes.*, mapping_versions.enemy_forces_required_teeming, mapping_versions.enemy_forces_required, MAX(mapping_versions.id) as dungeon_latest_mapping_version_id')
            ->join('dungeons', 'dungeons.id', '=', 'dungeon_routes.dungeon_id')
            ->join('mapping_versions', 'mapping_versions.id', 'dungeon_routes.mapping_version_id')
            // Only non-try routes, combine both where() and whereNull(), there are inconsistencies where one or the
            // other may work, this covers all bases for both dev and live
            ->where(function (\Illuminate\Database\Eloquent\Builder $query) {
                $query->where('expires_at', 0);
                $query->orWhereNull('expires_at');
            })
            // required for the enemy forces calculation
            ->groupBy(['dungeon_routes.id', 'mapping_versions.dungeon_id']);

        /** @var User $user */
        $user = \Illuminate\Support\Facades\Auth::user();
        $mine = false;

        // If we're viewing a team's route this will be filled
        $team = null;

        $requirements = $request->get('requirements', []);

        // Enough enemy forces
        if (in_array('enough_enemy_forces', $requirements, true)) {
            // Clear group by
            $routes = $routes
                ->whereRaw('IF(dungeon_routes.teeming, dungeon_routes.enemy_forces >= mapping_versions.enemy_forces_required_teeming,
                                    dungeon_routes.enemy_forces >= mapping_versions.enemy_forces_required)');
        }

        $tags = $request->get('tags', []);

        // Must have these tags
        if (!empty($tags)) {
            $routes = $routes
                ->join('tags', 'dungeon_routes.id', '=', 'tags.model_id')
                ->where('tags.tag_category_id', $tagCategoryId)
                ->whereIn('tags.name', $tags)
                // https://stackoverflow.com/a/3267635/771270; this enables AND behaviour for multiple tags
                ->havingRaw(sprintf('COUNT(DISTINCT tags.name) >= %d', count($tags)));
        }

        // If logged in
        if ($user !== null) {
            $mine = $request->get('mine', false);

            // Filter by our own user if logged in
            if ($mine) {
                $routes = $routes->where('author_id', $user->id);
            }

            // Handle favorites
            if (in_array('favorite', $requirements, true) || $request->get('favorites', false)) {
                $routes = $routes->whereHas('favorites', function ($query) use (&$user) {
                    /** @var $query Builder */
                    $query->where('dungeon_route_favorites.user_id', $user->id);
                });
            }

            // Handle team if set
            if ($teamPublicKey) {
                // @TODO Policy?
                // You must be a member of this team to retrieve their routes
                $team = \App\Models\Team::where('public_key', $teamPublicKey)->firstOrFail();
                if (!$team->isUserMember($user)) {
                    abort(403, 'Unauthorized');
                }

                // If available, we need all routes which MAY be assigned to this team, so all routes where
                // team_id = null and the author is one of the team members
                $available = intval($request->get('available', 0));
                if ($available === 1) {
                    $routes = $routes->whereNull('team_id');
                    $routes = $routes->whereIn('author_id', $team->members->pluck(['id'])->toArray());
                } else {
                    // Where the route is part of the requested team
                    $routes = $routes->where('team_id', $team->id);
                }

                $routes = $routes->whereIn('published_state_id',
                    [\App\Models\PublishedState::ALL[\App\Models\PublishedState::TEAM], \App\Models\PublishedState::ALL[\App\Models\PublishedState::WORLD]]
                );
                //                $routes = $routes->whereHas('teams', function ($query) use (&$user, $teamId) {
                //                    /** @var $query Builder */
                //                    $query->where('team_dungeon_routes.team_id', $teamId);
                //                });
            }
        }

        // Add a filter for a specific user if the request called for it
        if ($userId > 0) {
            $routes = $routes->where('author_id', $userId);
        }

        // Only show routes that are visible to the world, unless we're viewing our own routes
        if ((!$mine && !$teamPublicKey) || $userId !== 0) {
            $routes = $routes->where('published_state_id', \App\Models\PublishedState::ALL[\App\Models\PublishedState::WORLD]);
        }

        // Visible here to allow proper usage of indexes
        if (!$mine) {
            $routes = $routes->visible();
        }

        $dtHandler = new \App\Logic\Datatables\DungeonRoutesDatatablesHandler($request);

        return $dtHandler->setBuilder($routes)->addColumnHandler([
            // Handles any searching/filtering based on dungeon
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\DungeonColumnHandler($dtHandler),
            // Handles any searching/filtering based on DR Affixes
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\DungeonRouteAffixesColumnHandler($dtHandler),
            // Sort by the amount of attributes
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\DungeonRouteAttributesColumnHandler($dtHandler),
            // Allow sorting by author name
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\AuthorNameColumnHandler($dtHandler),
            // Allow sorting by enemy forces
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\EnemyForcesColumnHandler($dtHandler),
            // Allow sorting by views
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\ViewsColumnHandler($dtHandler),
            // Allow sorting by rating
            new \App\Logic\Datatables\ColumnHandler\DungeonRoutes\RatingColumnHandler($dtHandler),
        ])->applyRequestToBuilder()->getResult();
    }:2 (code 0)
Stacktrace:
#0 [internal function]: Laravel\SerializableClosure\Serializers\Native->__unserialize()
#1 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(22): unserialize()
#2 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Route.php(537): Illuminate\Routing\RouteSignatureParameters::fromAction()
#3 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(80): Illuminate\Routing\Route->signatureParameters()
#4 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(28): Illuminate\Routing\ImplicitRouteBinding::resolveBackedEnumsForRoute()
#5 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(959): Illuminate\Routing\ImplicitRouteBinding::resolveForRoute()
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#7 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(961): call_user_func()
#8 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Router->substituteImplicitBindings()
#9 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#10 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#12 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#14 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#16 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle()
#17 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#19 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#20 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#21 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()
#23 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()
#24 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()
#25 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()
#26 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#27 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#28 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#29 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#30 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#31 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#33 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#34 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#36 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#37 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#38 /var/www/html/keystone.guru.staging/releases/19/vendor/beyondcode/laravel-server-timing/src/Middleware/ServerTimingMiddleware.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): BeyondCode\ServerTiming\Middleware\ServerTimingMiddleware->handle()
#40 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#42 /var/www/html/keystone.guru.staging/releases/19/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#43 /var/www/html/keystone.guru.staging/releases/19/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle()
#44 {main}

But also this one, which is much shorter:

syntax error, unexpected token "new", expecting "("

On laravel-serializable-closure://function new(): \Illuminate\View\View
    {
        return view('dungeonroute.new');
    }:2 (code 0)
Stacktrace:
#0 [internal function]: Laravel\SerializableClosure\Serializers\Native->__unserialize()
#1 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(22): unserialize()
#2 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Route.php(537): Illuminate\Routing\RouteSignatureParameters::fromAction()
#3 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(80): Illuminate\Routing\Route->signatureParameters()
#4 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(28): Illuminate\Routing\ImplicitRouteBinding::resolveBackedEnumsForRoute()
#5 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(959): Illuminate\Routing\ImplicitRouteBinding::resolveForRoute()
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#7 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(961): call_user_func()
#8 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Router->substituteImplicitBindings()
#9 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#10 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#12 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#14 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#16 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle()
#17 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#19 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#20 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#21 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()
#23 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()
#24 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()
#25 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()
#26 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#27 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#28 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#29 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#30 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#31 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#33 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#34 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#36 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#37 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#38 /var/www/html/keystone.guru.staging/releases/18/vendor/beyondcode/laravel-server-timing/src/Middleware/ServerTimingMiddleware.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): BeyondCode\ServerTiming\Middleware\ServerTimingMiddleware->handle()
#40 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#42 /var/www/html/keystone.guru.staging/releases/18/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#43 /var/www/html/keystone.guru.staging/releases/18/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle()
#44 {main}

I feel like something's not right in these files which causes the serializer to break. I've read a bunch in this Github issue tracker and the 2 issues I could find were both related to that. It's just that I have no idea where to possibly start looking.

I tried commenting all other code in the controller except those routes but to no avail, the issue persists. The strange thing is is that on my local environment using Docker this error doesn't come and everything works fine. No amount of clearing caches has resolved this either.

I'm hoping anyone here knows how to proceed since I'm effectively stuck with this one.

Steps To Reproduce

Two offending controllers:

https://github.com/Wotuu/keystone.guru/blob/development/app/Http/Controllers/Ajax/AjaxDungeonRouteController.php#L80
https://github.com/Wotuu/keystone.guru/blob/development/app/Http/Controllers/DungeonRouteController.php#L39

Accessing the routes associated with this function produces the linked error.

It seems that for both these files the first function is affected, but not the others. In other controllers all functions work fine.

See also https://staging.keystone.guru/new.

Sorry I do not have better reproduction steps. Again it works perfectly fine on localhost but not on my staging environment.

Copy link

github-actions bot commented Mar 4, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@Wotuu
Copy link
Author

Wotuu commented Mar 5, 2024

A different environment is now experiencing the same issue. The staging environment shows the same issue as well: https://staging.keystone.guru/explore.

syntax error, unexpected token "list", expecting "("

On laravel-serializable-closure://function list(\Illuminate\Http\Request $request): \Illuminate\View\View
    {
        return view('dungeon.explore.list');
    }:2 (code 0)
Stacktrace:
#0 [internal function]: Laravel\SerializableClosure\Serializers\Native->__unserialize()
#1 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(22): unserialize()
#2 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Route.php(537): Illuminate\Routing\RouteSignatureParameters::fromAction()
#3 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(80): Illuminate\Routing\Route->signatureParameters()
#4 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(28): Illuminate\Routing\ImplicitRouteBinding::resolveBackedEnumsForRoute()
#5 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(959): Illuminate\Routing\ImplicitRouteBinding::resolveForRoute()
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#7 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(961): call_user_func()
#8 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Router->substituteImplicitBindings()
#9 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#10 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#12 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#14 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#16 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle()
#17 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#19 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#20 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#21 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()
#23 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()
#24 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()
#25 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()
#26 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#27 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#28 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#29 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#30 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#31 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#33 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#34 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#36 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#37 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#38 /var/www/html/keystone.guru.mapping/releases/50/vendor/beyondcode/laravel-server-timing/src/Middleware/ServerTimingMiddleware.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): BeyondCode\ServerTiming\Middleware\ServerTimingMiddleware->handle()
#40 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#42 /var/www/html/keystone.guru.mapping/releases/50/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#43 /var/www/html/keystone.guru.mapping/releases/50/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle()
#44 {main}

@Wotuu
Copy link
Author

Wotuu commented Mar 5, 2024

This is actively blocking me still. Is there anyone out there who can help me out here? I'm not looking forward to diving into a serialization library to figure out why this happens, costing me hours :(. I'm kind of surprised I'm the only one running into such a major blocker? If it was really this broken this repo would be flooded but obviously it ain't so what am I doing wrong here?

Again any help would be much appreciated.

@Wotuu
Copy link
Author

Wotuu commented Mar 6, 2024

An update to this: running /usr/bin/php8.2 artisan route:clear now does seem to cause my pages to load. But running /usr/bin/php8.2 artisan route:cache causes the pages to start crashing again.

@Wotuu
Copy link
Author

Wotuu commented Mar 11, 2024

I'm sorry I keep writing here but it's still an issue. I don't expect this to be fixed at the drop of a hat but what's the status of getting this issue fixed? Not having a timeline is bad 😢. Right now I've deployed all my changes but I've had to disable route caching to make it work. It's not the end of the world but I'd still like to get it resolved.

I'm still fairly confident it's an issue on my side somewhere but without any pointers it's neigh impossible for me to figure out.

@deba12
Copy link

deba12 commented Mar 11, 2024

list is reserved keyword see https://www.php.net/manual/en/reserved.keywords.php

@Wotuu
Copy link
Author

Wotuu commented Mar 12, 2024

Ahh I knew it was something on my side! Thank you so much, that was the issue indeed. I never thought of this but it makes total sense. Thank you so much!!

@Wotuu Wotuu closed this as completed Mar 12, 2024
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

3 participants