I was debugging PHP and the error/warning messages did not concur with the source code. After a bit of sleuthing, I found out that I was stripping out comments when I was publishing the code. Turning off ‘Optimize HTML during publishing’ fixed the problem.
BTW, I was using Expression Web but this tip is applicable to most IDEs.