Call to a member function getAction() on null
vincent-tarrit opened this issue · comments
Hello, I have issue that my $request->route() is null in the file Middleware/Detectors/ RouteActionDetector.php:36
Could you help me ?
Thank you very much !
To add details, the Route::localized is not recognized by PhpStorm...
Hello,
Thanks for reporting the issue.
This is probably caused by this line of code.
However, I can't reproduce the issue in a test.
Does it fail on a specific route?
Edit: When hitting a regular or fallback route, there should always be a Route
instance in the request as far as I know.
Only when a 404 is thrown will there be no Route
instance , because no route is registered for the URL.
But middleware wil not run on a 404, so I don't know how this can happen.
To add details, the Route::localized is not recognized by PhpStorm...
PhpStorm should autocomplete this if you use https://github.com/barryvdh/laravel-ide-helper.
![Schermafbeelding 2023-05-18 om 12 51 13](https://private-user-images.githubusercontent.com/3598622/239214660-f4e15625-f221-4a47-bb68-4763d9b859b2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyMzM2OTUsIm5iZiI6MTcyMjIzMzM5NSwicGF0aCI6Ii8zNTk4NjIyLzIzOTIxNDY2MC1mNGUxNTYyNS1mMjIxLTRhNDctYmI2OC00NzYzZDliODU5YjIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjlUMDYwOTU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmExMDNmM2FmYTg0Y2U2NjMzYTcyYjA1YzFiYzJkYjQ1MDExYzk4ODIyY2NiZTBiNWVjOTBlMzM3ZmYwN2VlMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.UP75B1jc41gRA3nAoUmnz8OQfii0DRp4PDV67YIdwaw)
I have this in my scripts
section of composer.json
:
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
]
Hello, sorry ... I was not very wake up... I put the middleware in wrong array oups... everything works perfectly! Thank you !
No worries, glad it works :)