Let me start with the canned response issue. Noted it as well and if I figured it out correctly, it shall insert the canned response after the cursor, so was your cursor in the footer etc. these times or somewhere else? Just try to move it next time to the left or the right to get its position when it happens again ;)
Regarding PHP or HTML code I have to admit that I never put it inside an response field / box, so I have no clue as of now. But maybe I find the time to test it tomorrow ;)