Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GaryC's avatar
Level 6

Token Mismatch Exception after upgrade to 5.4.

Has anyone else experienced this or know of a fix?

After upgrading to 5.4 I'm now getting a TokenMismatchException when I run my tests, mainly from my json() calls.

Any help appreciated, Gary

0 likes
5 replies
GaryC's avatar
Level 6

All that is in place. It is the upgrade which has broken it.

GaryC's avatar
Level 6

Yes...looks like something similar. I only get it in my tests though when I try to hit routes with get(), post(), json()

GaryC's avatar
Level 6

I can confirm that it is definitely just $this->json() which is causing the issue. Every time I make this call from my tests, a TokenMismatchException is thrown. I've upgraded two projects to L5.4 and it is happening in both.

Please or to participate in this conversation.