
November 19th, 2005
02:30 PM
Neverside Newbie
Status: Offline!
strange error: unexpected T_STRING
I'm having some very strange errors in my php file.
While the file is working ok, if I make a small change to an echo string for example, such as add another $_GET variable to a query string - all in perfectly valid php with correct quotes and escapes in the right places it gives me this message.
The line it gives the error for usually has nothing to do with the one I've been editing - and it also looks like there are no errors in it.
The file is quite big (500+ lines), but I don't know if this has anything to do with it.

November 19th, 2005
03:17 PM
Neversidian
Status: Offline!
Could be something to do with a missing ; at the end of a line. Or maybe even a missing }

November 19th, 2005
03:42 PM
Neverside Newbie
Status: Offline!
Nope.
Usually it would say "expecting ..." but it doesn't.
Its very strange, if I delete a couple of empty lines with no actual changes to the script format it works ok again. Most confusing.

November 19th, 2005
07:16 PM
Neversidian
Status: Offline!
how about showing the code 
___________________
-Developer
-Forum Leader
-NeverNET

November 19th, 2005
08:17 PM
Neverside Newbie
Status: Offline!
The code is fine. And too much to add here.
For instance: It was working fine, then I just added a commented out line on line 5 - a reminder for something. Uploaded the script, refreshed and it said I had an 'unexpected T_STRING on line 255???
Removed the line and it worked fine.
Is it possible that my text editor or ftp app could be corrupting the file?
I did notice the other day that, while echo-ing an input html line that the output html source had split the word 'type' onto a new line, so it looked something like this (and broke in the browser):
<input ty
pe="text" name="blah" value="blahblah" />
The php code that printed it was fine, but I wonder whether something is happening like this to produce these strange errors.
Last edited by reregistered, November 19th, 2005 08:19 PM (Edited 2 times)

November 19th, 2005
08:51 PM
Neversidian
Status: Offline!
we're all playing the guessing game if nothing is shown. pastebin.com?
___________________
-Developer
-Forum Leader
-NeverNET

November 19th, 2005
10:09 PM
Neverside Newbie
Status: Offline!
Sorry. I thought I had just explained.
It worked.
Then I added (ONLY) (notice comments):
// list($wide,$high) = getimagesize("images/product/large/".$data->photo);
Then it didn't.
So I took it out.
Then it worked.

November 20th, 2005
04:48 AM
Lost in Berkeley, CA
Status: Offline!
Try this style: /*comment*/
___________________
There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.

November 20th, 2005
09:29 PM
Neverside Newbie
Status: Offline!
It's not the comment style, the above was just an example.
I would also get errors just by changing a query string ie adding something like &p=1 into the middle of an existing string, it then throws up an error 200-300 lines down.
When I remove what was added and do an error_repotting(E_ALL) nothing shows up.
While not an expert in php, I am confident enough, after using it for three years, to know that my syntax is correct.
Could it be something to do with the script size? (currently 500+ lines - around 20kb)

November 21st, 2005
01:38 AM
with Mr. Jones
Status: Offline!
Heres a novel concept; if your code is throwing a parse level error (syntax / T_STRING / T_UNENCAPSED_WHITESPACE / etc), your code is quite obviously not functional. Bite your pride and prove an exact error with the code.
___________________
http://www.philbrodeur.com - Expert PHP Development and Tutorials