Closed FeBe95 closed 1 month ago
Hey, thanks for the detailed report.
Unfortunately I think this is a sort-of limitation of how dump works. Looks like dump immediately sends the output to the browser, this means headers are also sent at the point when you call dump.
Clockwork headers are set at the end of the request processing, but since at that point headers were already sent, this has no effect. The web UI still works, since it does not use the Clockwork headers at all and instead polls the Clockwork api for new requests.
Hello and thanks for your reply. Would it technically be possible to set the necessary clockwork headers at the start of each request, so a dump()
call wouldn't interfere with them?
Yeah, it is technically possible, there is no nice Laravel way to set the headers at the right time, but you could just use the underlying header
php function at the start of a global middleware:
header('X-Clockwork-Id: ' . $this->app['clockwork']->request()->id);
header('X-Clockwork-Version: ' . \Clockwork\Clockwork::VERSION);
I don't think this is something we want to do in Clockwork though.
Description
Whenever I use a
dump()
statement in my PHP code, nothing is logged in the embedded clockwork console in my browser devtools panel. The web-interface in myapp.localhost/clockwork works perfectly fine though.Using the network tab of my browser's devtools, I can see that the X-Clockwork headers and response cookies are missing whenever I am using a
dump()
call.Example code
routes/web.php:
app/Http/Controllers/TestController.php:
Expected Result
Dumping data with
dump()
should not interfere with the logging behavior of the browser extension. The necessary data does get generated and saved, as it is available in the standalone web-interface. I understand if it doesn't work with Laravel'sdd()
function, as this function callexit(1)
and thus ends the PHP process directly.Is there something I need to configure in Laravel or Clockwork to get this working?
Actual Result
Browser:
Browser Extension (DevTools Panel):
Web-Interface: