Laravel 5 with Xdebug always throws "Payload is invalid."

I configured Xdebug on VScode to debug my laravel application. But, when I start debugging, laravel always throws this error:Exception has occurred. Illuminate\Contracts\Encryption\DecryptException: The payload is invalid.

I already tried to run php artisan optimize.

Has anyone here already encountered this problem? I am using Laravel 5.5

Ps. I tried to debug the Laravel 4 application. It worked without any problems. So, I think this might be something special for Laravel 5.

+7
source share
5 answers

By default, Laravel will encrypt and then decrypt all cookies on request.

Xdebug cookie "XDEBUG_SESSION". cookie , , , Laravel, , .

- cookie "XDEBUG_SESSION" App\Http\Middleware\EncryptCookies App\Http\Middleware\EncryptCookies.

/**
 * The names of the cookies that should not be encrypted.
 *
 * @var array
 */
protected $except = [
    'XDEBUG_SESSION'
];
+10

@ceejayoz . php artisan otimize cookie , .

+1

, " " , .

0

. VsCode xdebug (launch.json)

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "log":true,
        "pathMappings": {

           // "serverSourceRoot": "/var/www/html",
            //"localSourceRoot": "${workspaceRoot}"
            "/var/www/html":"/Users/{username}/sites/{mysitefolder}"

        },
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9000
    }
]

}

0
source

Temporarily commented out \ App \ Http \ Middleware \ EncryptCookies :: class, which is located inside the web middleware of the Application Group / Http / Kernel. Solved my problem with this. Need to remember, turn it back though. Are there any better solutions from anyone? I tried the above methods, no one worked for me, unfortunately.

0
source

Source: https://habr.com/ru/post/1689465/


All Articles