Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    75
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Unexpected T_STRING errors

    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:
    PHP Code:
    $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.)?

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    need to see all the code

  • #3
    New Coder
    Join Date
    Apr 2006
    Location
    Planet Earth
    Posts
    59
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Usually these errors are one line before, you may be missing a semicolon or a quote or something of that matter.

  • #4
    New Coder
    Join Date
    May 2009
    Posts
    75
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Quote Originally Posted by seco View Post
    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:
    PHP Code:
    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:
    PHP Code:
    $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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •