How about
abort(419, ['Status'=>'Token Mismatch OR page has expired due to inactivity.']);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When I try to POST with X-Requested-With='XMLHttpRequest' without CSRF-TOKEN I receive null message in response.
I add this code to App\Exceptions\Handler:
public function render($request, Exception $exception)
{
if($exception instanceof TokenMismatchException) {
abort(419, 'Token Mismatch OR page has expired due to inactivity.');
}
return parent::render($request, $exception);
}
Now I have Token Mismatch OR page has expired due to inactivity. message in response, but status text is: unknown status.
How can I set status text?
Please or to participate in this conversation.