PHP Debugging

Kieran Andrews
1 min readDec 1, 2018

--

Recently while working on a particular project we had some strange errors that came up. In the usual php like way, the error messages where not very helpful and didn’t allude to what the actual problem was. Have you seen an error like this before?

**Headers Already Sent on line 392

**

Invalid argument supplied for foreach()

Well, this handy functionality that I discovered in php made my life easier.

var_dump(debug_backtrace()); die;

I placed this right before the code that was complaining, and it allowed me to see where this function was being called from. I was then quickly able to fix the problem and be on my merry way.

Originally published at kieranandrews.com.au.

--

--

Kieran Andrews

I enjoy building software, making web applications, surfing, snowboarding and cooking!