-1

Yes, I've searched around. I'd rather not use short tags, at all, so don't suggest it. I've had the strange issue of my Apache server claiming that PHP has reached an unexpected EOF even when the contents of the file are commented out. I've tried syntax checkers and they see nothing wrong. I'm absolutely confused as to why it'd be complaining, considering I can't have a missing } because I don't even have a {.

http://pastebin.com/7DmSFbJD http://pastebin.com/xW3ckhD5 (I forgot to comment out the contents using /* */)

  • I don't get it. You say that the files are all commented out but you show us two files with nothing commented out. Note that you shouldn't put the trailing `?>` when there's nothing that comes after it for many reasons including this type of problem and security reasons. – Julie Pelletier May 09 '16 at 05:59
  • The second one was supposed to be commented out and why exactly shouldn't I have a tailing ?> – Evrything Multimedia May 10 '16 at 00:03
  • I told you, to avoid having trailing garbage and for security. Many hacker scripts will try to append ` to your files but if you leave out the closing tag, it will issue an error. – Julie Pelletier May 10 '16 at 03:43

1 Answers1

1

In second file you're missing an additional } at the end. Your current last } is for if clause, not for function.

Gynteniuxas
  • 7,035
  • 18
  • 38
  • 54
  • Absolutely? Then why wouldn't it work if I comment out the contents of the ? – Evrything Multimedia May 09 '16 at 06:07
  • 2
    @EvrythingMultimedia - Maybe you should copy/paste the code when it's commented out, then? Btw.. you should really learn how to format your code to make it more readable. – M. Eriksson May 09 '16 at 06:09
  • Serously? I've stared at this thing for so long, counted my brackets carefully, especially the last one, and I've missed a closing bracket... Consider this another repost. How did you spot it? – Evrything Multimedia May 09 '16 at 06:09
  • I noticed this with copy-paste into Notepad++. I made that when I press on any special symbol (like `}`) I would see the starting symbol. In your case, pressing on the last `}` would show for if clause, not for function. And pressing on `{` near function would show in white, meaning it has no ending. – Gynteniuxas May 09 '16 at 06:12