An old question but this happened to me along with the csrf not working and I had no idea why... until I reinstalled the symfony/dotenv package and both started working... I HAVE NO IDEA WHY, my .env file is empty...