homepage Welcome to WebmasterWorld Guest from 23.20.44.136
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP and error lines
ahmedtheking




msg:3213121
 10:58 am on Jan 9, 2007 (gmt 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!

 

jatar_k




msg:3213269
 1:02 pm on Jan 9, 2007 (gmt 0)

that should only happen if you are including, if it is all in the same file it should return the exact line

cmarshall




msg:3213315
 1:52 pm on Jan 9, 2007 (gmt 0)

I've never had a problem with inaccurate error lines. What am I doing right?

coopster




msg:3213755
 7:26 pm on Jan 9, 2007 (gmt 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?

CDNQuilter




msg:3214194
 3:01 am on Jan 10, 2007 (gmt 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

ahmedtheking




msg:3214853
 4:20 pm on Jan 10, 2007 (gmt 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.

alfaguru




msg:3215123
 7:26 pm on Jan 10, 2007 (gmt 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.

BarryStCyr




msg:3215175
 7:54 pm on Jan 10, 2007 (gmt 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.

justageek




msg:3215293
 9:43 pm on Jan 10, 2007 (gmt 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

StupidScript




msg:3215341
 10:21 pm on Jan 10, 2007 (gmt 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]

ahmedtheking




msg:3215417
 11:47 pm on Jan 10, 2007 (gmt 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!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved