Weird PHP Error that irritated me for several hours! :@

There is a Mobile Optimized version of this page (AMP). Open Mobile Version.

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?

Facebooktwitterredditpinterestlinkedinmail
Author: Dean WilliamsI'm a Web Developer, Graphics Designer and Gamer, this is my personal site which provides PHP programming advice, hints and tips

Post Tags:
,
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments