Today I came across the weirdest error ever in PHP, it is so weird it is not even code related, in fact it is completely COMMENT related and it stumped me for SEVERAL HOURS!
Okay so here is a snippet of code to demonstrate… (obviously the code I was working with originally was very complex and I spent hours coming to this test.):
echo "hello"; //passthru("/bin/cp $uploadfile $uploadfile2"); echo "goodbye";
You would expect “hellogoodbye” to appear on the screen, however instead I was getting “hello”, then it would jump out of the function it was in and continue execution as if I had run an “exit;”!!!
WHAT ON EARTH!!!
I removed the commented line, and everything was fine again…
Anyone got any insight into this bizarre occurrence?