symfony: WebProfiler JS error when updating request in kernel.event_controller
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 4.0.4 |
Hi,
For some reasons, i use the onKernelController method to initiate some stuff, but when i want to alterate the request (updating one parameter), i got a JS error in my console and the debug toolbar doesn’t appear :
Uncaught TypeError: Cannot read property 'nodeValue' of null
at Sfjs.load.maxTries (login:867)
at login:867
at XMLHttpRequest.xhr.onreadystatechange (login:867)
This is my code :
public function onKernelController(FilterControllerEvent $event) {
if(null === $user) {
// These 2 lines provide the JS error !
$event->getRequest()->attributes->set('_controller', 'App\CommonBundle\Controller\SecurityController::login');
$event->getRequest()->attributes->set('_route', '/login');
// If this is alone, i have no error
$event->setController($this->resolver->getController($event->getRequest()));
}
}
Thanks for your help !
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (20 by maintainers)
the probleme is that the option only_exception in profiler doest not set to true ,so to fix that go to config/package/web-profiler and set the value of only_exception to true it look like this profiler: {only_exception:true}