NEWBIE: error line numbers...are they always correct?

NEWBIE: error line numbers...are they always correct?

am 02.09.2007 01:54:04 von skim1114

I am getting a parse error...but the line that the code is in...is a
comment that is surely a comment. Other times I know the code syntax
is correct in that line...is this always precise?

Thanks

Re: NEWBIE: error line numbers...are they always correct?

am 02.09.2007 02:02:26 von luiheidsgoeroe

On Sun, 02 Sep 2007 01:54:04 +0200, skim1114 wrote:

> I am getting a parse error...but the line that the code is in...is a
> comment that is surely a comment.

Impossible to say what's wrong without the offending code :)

> Other times I know the code syntax
> is correct in that line...is this always precise?

Well, the line it's in is usually correct. It could however happen the
parser encounters an error there due to a mistake made earlier:

echo 'foo'
/* we forgot the ending semicolon */
echo 'bar';
?>

Now it will complain about an error on line 4, because you forgot to add a
semicolon on line 2. Up till then the code was totally valid though.
--
Rik Wasmus

Re: NEWBIE: error line numbers...are they always correct?

am 02.09.2007 02:21:47 von skim1114

On Sep 1, 8:02 pm, "Rik Wasmus" wrote:
> On Sun, 02 Sep 2007 01:54:04 +0200, skim1114 wrote:
> > I am getting a parse error...but the line that the code is in...is a
> > comment that is surely a comment.
>
> Impossible to say what's wrong without the offending code :)
>
> > Other times I know the code syntax
> > is correct in that line...is this always precise?
>
> Well, the line it's in is usually correct. It could however happen the
> parser encounters an error there due to a mistake made earlier:
>
> > echo 'foo'
> /* we forgot the ending semicolon */
> echo 'bar';
> ?>
>
> Now it will complain about an error on line 4, because you forgot to add a
> semicolon on line 2. Up till then the code was totally valid though.
> --
> Rik Wasmus

Thank you...that makes some sense...I'm trying to learn this...it's
not easy, so having these groups is very helpful.

Re: NEWBIE: error line numbers...are they always correct?

am 02.09.2007 02:43:00 von Andy Hassall

On Sat, 01 Sep 2007 23:54:04 -0000, skim1114 wrote:

>I am getting a parse error...but the line that the code is in...is a
>comment that is surely a comment. Other times I know the code syntax
>is correct in that line...is this always precise?

There was a bug in several versions of PHP 5 where the line numbers went off
by one each time you used a heredoc (the "<<
Can't remember off the top of my head where it was fixed, but it was annoying
for a while.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Re: NEWBIE: error line numbers...are they always correct?

am 02.09.2007 15:51:59 von Larry Anderson

On Sep 1, 5:02 pm, "Rik Wasmus" wrote:
> Well, the line it's in is usually correct. It could however happen the
> parser encounters an error there due to a mistake made earlier:
>
> > echo 'foo'
> /* we forgot the ending semicolon */
> echo 'bar';
> ?>

Also line number may be off if you have the wrong type of variable,
etc. Look at that the line is doing if the quotes and all are in
order it may be related to your data assignments in previous parts.

Re: NEWBIE: error line numbers...are they always correct?

am 02.09.2007 17:20:32 von Aaron Saray

On Sep 2, 8:51 am, la...@portcommodore.com wrote:
> On Sep 1, 5:02 pm, "Rik Wasmus" wrote:
>
> > Well, the line it's in is usually correct. It could however happen the
> > parser encounters an error there due to a mistake made earlier:
>
> > > > echo 'foo'
> > /* we forgot the ending semicolon */
> > echo 'bar';
> > ?>
>
> Also line number may be off if you have the wrong type of variable,
> etc. Look at that the line is doing if the quotes and all are in
> order it may be related to your data assignments in previous parts.

You can also have a line number of 0 when fatal errors or say...
exceptions are thrown in destructors.