3 ms·
Why is using var_dump debugging bad practice? Or is he insinuating that using var_dump while testing on a live site is bad practice?
by BadDev 12y ago
Why is using var_dump debugging bad practice? Or is he insinuating that using var_dump while testing on a live site is bad practice?
- brianzelip 12y agoHe is saying using `var_dump` on a live server is a bad practice.
- davis 12y agoYeah, I'm pretty certain that he means using var_dump on a live server (especially of $_SERVER) is incredibly dumb.
- wcummings 12y agoIt's definitely bad practice on a live server, and frankly its a pretty painful way to debug PHP, at least without xdebug.
- girvo 12y agoWith XDebug and proper breakpoints (or HHVM's debugger) I don't see any need to do var_dump debugging these days. Far more powerful to have an XDebug client like Codebug drop you into a REPL at your breakpoint so you can explore what's gone wrong.
- cookiecaper 12y agoI think he infers that both are bad practice, but for the record I don't think there's anything wrong with var_dump debugging. Sure, a real interactive debugger is nicer, but it can be a pain to set up with PHP (I know, having set these up several times). Print-based debugging is fine as long as you don't expose sensitive information to end users.
- girvo 12y agoDifficult to set up? I disagree, Xdebug with connectback is amazingly easy to set up in a Linux VM! On windows, yes, it's hard, but Linux and OS X its very simple nowadays. I should write blog post on how to do it (having done it dozens of times over the past 6 months)
- RenierZA 12y agoI'm also pretty sure that was print_r not var_dump.