07.
Finishing with kernel.response and kernel.exception
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
4 Comments
$event = new GetResponseEvent($this, $request, $type);
dump($event);die;
I get empty page! What about you?
Oh no! That is weird - the dump() should dump something. If you change this to dump($event);die('test') - do you see the word "test"? Also, check that php.ini is setup to show syntax errors. You can do this by running the following command at the command line:
If this says "No" or "Off" or something like that, it could be a problem :). You can fix it by editing your php.ini file and changing this setting. To find where your php.ini file is, use:
And look for "Loaded Configuration File".
Let me know what you find out!
Yes, I see "test".
$ php -i | grep display_errors
display_errors => STDOUT => STDOUT
Options in php.ini:
display_errors=On
display_startup_errors=On
error_reporting=E_ALL
html_errors=On
log_errors=On
were commented out before . Recheck for sure I set up values on them(see above), save, and then restart Appache. Nevertheless still empty page.
If I check:
$event = new FilterControllerEvent($this, $controller, $request, $type);
dump($event);die('test2');
That woks fine, I get object:
test2
HttpKernel.php on line 151:
FilterControllerEvent {#107 ▼
-controller: array:2 [▶]
-kernel: HttpKernel {#246 ▶}
-request: Request {#7 ▶}
-requestType: 1
-propagationStopped: false
}
Tell me, Ryan, please, did you try to check:
$event = new GetResponseEvent($this, $request, $type);
dump($event);die;
on your computer?
What did you get in browser ?
Hi Andrew!
You stumbled upon a *really* interesting thing :). In Symfony, the dump() function relies on a listener on kernel.request - called DumpListener - to "initialize" itself. If you try to use dump() before kernel.request is dispatched, it won't work. I honestly never knew that - I had never used dump() this early in the process :).
Cheers!
"Houston: no signs of life"
Start the conversation!