statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Call to a member function decrypt() on null #2472

Closed Thaars closed 4 years ago

Thaars commented 4 years ago

Describe the bug When I use the X-XSRF TOKEN header, the VerifyCsrfToken middleware needs the encrypter that is injected into the parent (Illuminate\Foundation\Http\Middleware\VerifyCsrfToken) constructor. It was overwritten by the Statamic\Http\Middleware\VerifyCsrfToken constructor, but the injection is missing.

Expected behavior The X-XSRF-TOKEN verification should work as expected. This works:

   /**
     * VerifyCsrfToken constructor.
     *
     * @param  \Illuminate\Contracts\Encryption\Encrypter  $encrypter
     */
    public function __construct(Encrypter $encrypter)
    {
        $this->except = Config::get('system.csrf_exclude', []);

        parent::__construct($encrypter);
    }

Environment details (please complete the following information):