You can understand it—with xdebug
Drupal is getting more and more powerful, but also more complex. We developers often struggle to fix problems. We'll try searching the web, adding dpm statements, copying code from the issue tracker… but when none of those work, we get stuck. We feel like we just don't understand Drupal well enough.
We're not bad developers—we just need better tools. And by far the most important tool for me is a debugger. With a debugger, instead of trying one potential solution after another, I can build my own understanding instead. This gets my problems solved much faster, and also teaches me more about Drupal, so the next bug is even easier to fix.
Nevertheless, debuggers intimidate a lot of developers. Old-school PHP programmers are used to doing without; self-taught programmers might not even know they exist. Setting them up can be complex, and buying an IDE can cost a lot of money. So I want to demystify using a debugger with Drupal.
I'll cover:
- How to setup a debugger using only free software
- How to start debugging a problem
- Using conditional breakpoints
- Debugging gotchas to avoid
- Dealing with caching
Time permitting, I'll also cover some of the major problems people have with xdebug and Drupal:
- How to debug Drush
- How to debug when you use VMs or Docker