I have strange error and not sure how to tackle it without wasting too much time. I have a method in my controller which should return xml using:
header("Content-type: text/xml");
header("Content-Disposition: attachment; filename=output.xml");
header("Pragma: no-cache");
header("Expires: 0");
the thing is that the output is not valid xml because of empty line and I have no idea from where it comes, do you have an idea how to fix this? maybe ignore this empty line or something? I do not want to debug the whole framework… I tried to use var_dump(debug_backtrace()) but I get one big mess probably because of doctrine.
Almost always, there will be an empty line before or after your
<?php ?>tags. If not in your main file, look at your includes.Also, a little tip… if your file is pure PHP, just start it with
<?phpand never close the PHP tag. Closing it isn’t necessary, and then you avoid blank lines at the end causing you trouble.