Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP and error lines

     
10:58 am on Jan 9, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts:789
votes: 0


Is there a var in the php.ini file that allows PHP to count HTML lines as well as the PHP lines when returning the line at which an error has occurred? I'm getting bored of having to search for the line when PHP says there's an error at X when it's actually at X+300!
1:02 pm on Jan 9, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15755
votes: 0


that should only happen if you are including, if it is all in the same file it should return the exact line
1:52 pm on Jan 9, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
posts: 1526
votes: 0


I've never had a problem with inaccurate error lines. What am I doing right?
7:26 pm on Jan 9, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


Me too. I mean, I agree. Even in an included file the line number of the error is reported accurately as the line number in the included file. It's not sinking into my thick skull for some reason and I must be missing something ... can you offer more detail?
3:01 am on Jan 10, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 18, 2004
posts:53
votes: 0


When your error is 300 lines away it is usually because you have forgotten a quote or some such and the parser just keeps chugging until it cannot to any further -- sometimes it is amazing how far it goes.

I try to make a few changes and test and so on so that it is easy to back out a change or to see what is happening.

Hope this helps
jean

4:20 pm on Jan 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0


Well it's not like I've forgotten a quote at line 4 and it's picked it up at line 300 where the quotation ends, it's like this

<somehtml>
<? if (empty($e)) {

php stuff, you know

}?>
<somemorehtml>
<? if (avar) { some more php?>

Now I've forgotton the dollar in front of avar, but it'll tell me the error's about 7-10 lines above. I've been a bit specific by saying 7-10, but it's always above, and not like 1 or 2 lines. This doesn't happen on pages that have just php code.

7:26 pm on Jan 10, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:July 18, 2006
posts:60
votes: 0


Are you using an editor with word wrapping on? Some editors count wrapped lines, which will mean a discrepancy in the line count. Try turning word wrapping off.
7:54 pm on Jan 10, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 2, 2005
posts:112
votes: 0


I have the same problem. I can use FrontPage or Notepad with word wrap turned off and I get the same line problem. In Notepad I have to manually count the lines of course, but the line count is still off.
9:43 pm on Jan 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 21, 2003
posts:1069
votes: 0


This doesn't happen on pages that have just php code.

So it sounds like it is ignoring the html code and not counting those lines at all. My guess is that if you added the lines of html code to the error line number you'll have the editor line number. Not saying that is a solution to your problem but may explain the discrepency.

JAG

10:21 pm on Jan 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 20, 2004
posts:1475
votes: 0


Well it's not like I've forgotten a quote at line 4 and it's picked it up at line 300 where the quotation ends
When this condition occurs, I've usually seen that it is irrelevant where the quotation ends. Here's an example:
01 <?
02 $somevar = "string variable;
03?>
04-15 <somehtml>
16 <?
17 $somevar2 = "another string variable";
18?>

The error will be reported on line 17 even though the real error is on line 02.

In the case of a missing dollar sign, unless there is an earlier error, that's the error line reported. I really haven't noticed misleading line number reporting. Confusing, sometimes, but when I trace the error back to its source (line 02, above) it all makes sense.

[edited by: StupidScript at 10:24 pm (utc) on Jan. 10, 2007]

11:47 pm on Jan 10, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2004
posts: 789
votes: 0


My editor has wrapping on, but displays the line numbers. Is there anything in the PHP.ini I can change? Or am I just being dumb? When the next error occurs, I'll post it!