wclarke Posted May 22, 2020 Share Posted May 22, 2020 The issue is there seems to be NO syntax error. 1. There is no relevant code before or after this line. 2. Yes, one would think a ! should be there as did I (I didn't write the code), however, even with the ! it still gives the same error. if (function_exists('gzcompress')) die(FUNCTION_NOT_FOUND); is giving me a syntax error, unexpected 'if', expecting 'function' or 'const' I am updating this code from PHP5.3 to PHP7.4 and I can't figure out what the syntax problem is since PHP allows this. I am using Eclipse PHP to do the conversion. Quote Link to comment Share on other sites More sharing options...
requinix Posted May 22, 2020 Share Posted May 22, 2020 How about posting the rest of the code instead of just that one line? Quote Link to comment Share on other sites More sharing options...
gw1500se Posted May 22, 2020 Share Posted May 22, 2020 You are getting that error because the syntax of something previous is wrong. Quote Link to comment Share on other sites More sharing options...
benanamen Posted May 22, 2020 Share Posted May 22, 2020 Is FUNCTION_NOT_FOUND actually a defined constant? The logic makes no sense. If the function exists, it is "Not found"? Quote Link to comment Share on other sites More sharing options...
gw1500se Posted May 22, 2020 Share Posted May 22, 2020 I don't think that would cause a syntax error. We need to see the preceding code. Quote Link to comment Share on other sites More sharing options...
kicken Posted May 22, 2020 Share Posted May 22, 2020 PHP saying there is a syntax error on line X doesn't necessarily mean that the error is actually on line X. It could in fact be anywhere from line 1 through X. The line PHP reports is just where PHP finally realized there is a problem. With issues such as missing quotation marks or missing closing braces PHP will be able to continue parsing the source for quite a while before realizing something is amiss. Most of the time, the line number reported gets you close, but if nothing appears wrong there you need to start back tracking until you figure it out. Quote Link to comment Share on other sites More sharing options...
benanamen Posted May 22, 2020 Share Posted May 22, 2020 1 hour ago, gw1500se said: I don't think that would cause a syntax error. We need to see the preceding code. I know. That was just an "in addition to the problem". I agree the problem is the preceding code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.