I just took your code, commented: echo("image/gif\nimage/png\ntext/html"); and removed comment for the line echo($returnMT . "\n"); (absolutely no other modifications were done), and test 1, 2 and 4 are success.
If I reset the code and replace the default echo with yours, it works for me… I’m not sure how we can reproduce, can you send us your code to coders [at] codingame.com?
That’s interesting. It’s not a bug because that’s how php works, but maybe we should remove the blank lines before and after the php tags in order to avoid that kind of issue? What do you think?