简体   繁体   中英

FatalErrorException (Laravel)

I find something error in in VerifyCsrfToken.php (line 156), How to fix, thanks

    protected function addCookieToResponse($request, $response)
{
    $config = config('session');

    $response->headers->setCookie(
        new Cookie(
            'XSRF-TOKEN', $request->session()->token(), Carbon::now()->getTimestamp() + 60 * $config['lifetime'],
            $config['path'], $config['domain'], $config['secure'], false
        )
    );

    return $response;
}

Problem is in some your middleware.

Middleware handle method must return Response object, but looks like some your middleware(s) return non-response object.

VerifyCsrfToken middleware by calling addCookieToResponse method pass $next($request) as argument. So, next middleware call return wrong result.

Please, check all your middlewares, and fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM