Welcome Guest, Not a member yet? Register   Sign In
PHP Bug or Sever Specific: Wrong Line Number for PHP Errors with Single Comments and not with multiline comments - comme
#1

[eluser]Henry Weismann[/eluser]
Hey CI coders,

I have a problem with my php errors:

Code:
<?php

//minus one line
//minus one line
//minus one line
//minus one line
//minus one line
//minus one line

error line 4 because line 3 through 8 compiler does not count so line 9 is 3 and line 10 where this error is...is line 4...delete this entire line to see the next error
function hello()
{
//minus one line
//minus one line
echo "hello world";
error line 8 because line 3 - 8  and 13 - 14 compiler does not count so lines 9-12 are lines 3-6 and line 15 is 7
}

?>

It seems my compiler is not calculating error line numbers correctly when I have single line comments. If I change them to /* multiline */ comments I don't have the problem.

I have tried two php servers so far with the same results PHP Version 5.2.8 and 5.2.9. I thought maybe it was because of the encoding of the file or maybe the text editor I use (notepad++), a server setting, a php setting or something. It may also depend on how php is installed and running such as a CGI process.

Can anyone replicate this on their servers?

If others can replicate it...it must be a bug. If it were a bug I would think someone would have noticed this by now so I cant imagine it is a bug that has gone unnoticed.

Searching google was just endless pages about missing brackets and obvious answers to the wrong line number problem.

Anyone have any idea whats up?
#2

[eluser]Henry Weismann[/eluser]
Ok I tried creating the file in plain old windows notepad and I dont have the problem. So what about my notepad++ is causing the problem?
#3

[eluser]Unknown[/eluser]
Henry, just in case you'll read this sometimes... i have just fought the same bug Big Grin

In fact it was a Notepad++ Edit -> EOL Conversion problem, if you have set it UNIX, it saves it wrong in my machine (Windows) and uploads the whole file in a single line, so the coment line breaks from its line to the end of the file.

And it always say "line 1" because... there is only one line ! as there are no EOL on it !

Hope it helps : )




Theme © iAndrew 2016 - Forum software by © MyBB