View Full Version : Unexpected T_STRING errors

09-13-2009, 04:13 AM
My code's been working virtually flawlessly for over a month, and I suddenly got hit with all these syntax errors - and they make absolutely no sense.
For example, it'll throw me this:
"Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/test.php on line 228"
and line 228 looks like this:

$cm_test_id = $row['cm_test_id'];

This is only one of the errors, all the other ones seem to be that it suddenly hates single quotes, it threw a syntax error at every GET variable (they looked like this $_GET['test']).

This is the most random group of errors I've ever seen, it's worth mentioning that I restarted Apache before this but hadn't changed the php.ini settings. In case the php.ini file was changed by someone else are there any particular settings worth looking at (for quotes, concatenate, anything syntax etc.)?

09-13-2009, 04:18 AM
need to see all the code

09-13-2009, 04:25 AM
Usually these errors are one line before, you may be missing a semicolon or a quote or something of that matter.

09-13-2009, 04:29 AM
need to see all the code

I can't really post the 400 line code, it wouldn't help anyways. Basically as soon as I temporarily fix one syntax error it finds another one lower down the code. I know I haven't actually mistyped anything (something stupid like forgetting ';') because this code has been working for over a month with no problem. I just had to do a short Apache restart on Ubuntu server (since like 3 months) and there are countless syntax errors - probably spanning 10 php files which have always worked before. So I don't think there's anything wrong with the actual code, more so the php.ini file or some configuration got changed during that time and went into effect as soon as I restarted.

TBH I don't even understand it myself, it's the usual typical T_STRING errors. Here's one that didn't work:

cm_sess_write('cm_rss', "".$cm_manga."/".$cm_purge_chapter_array[count($cm_purge_chapter_array)-1]."/");
The error said it was expecting the ']' but received a '(', so I changed it to this and it worked:

$cm_purge_chapter_array_count = count($cm_purge_chapter_array)-1;
cm_sess_write('cm_rss', "".$cm_manga."/".$cm_purge_chapter_array[$cm_purge_chapter_array_count]."/");
It's as if my PHP parser suddenly got really stupid.