|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21938 Wrong error line numbers
Submitted: 2003-01-29 05:48 UTC Modified: 2003-02-20 08:04 UTC
Avg. Score:4.7 ± 0.5
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:2 (28.6%)
From: arne dot brachhold at co4 dot de Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.1-dev OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: arne dot brachhold at co4 dot de
New email:
PHP Version: OS:


 [2003-01-29 05:48 UTC] arne dot brachhold at co4 dot de
The error will be displayed at a wrong line.

Undefined variable: foo in foo.php on line 39 

$foo is only used in line 113. This also happends with wrong functions and other errors. This makes it really hard to find errors.

I'm using the windows binary with default configuration. (php.ini-dist).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-29 06:02 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-01-29 06:17 UTC] arne dot brachhold at co4 dot de
What I did:

Made a script like this:




What should happen?
This error:

Fatal error: Call to undefined function: blubb() in foo.php on line 3

What happend?
This error:

Fatal error: Call to undefined function: blubb() in foo.php on line 2

As you see the line number is incorrect. It should be 3 instead of 2. As longer the script is as longer are the differences betweeen the correct and displayed line number.
This happens with all errors, warnings ans so on.

this happends since the upgrade of PHP to PHP 4.3.

System: Windows 2000 Server / Apache/1.3.24
Version: PHP 4.3 Windows Binary with unmodified php.ini-dist
 [2003-01-29 07:04 UTC]
Please try using this CVS snapshot:
For Windows:

Ilia fixed something like this just few days ago, iirc.

 [2003-01-30 05:41 UTC] arne dot brachhold at co4 dot de
Sorry, this doesn't really help. The numbers are nearer to the right position now, but not correct.

Displayed: Line 125
Correct Position: 138
 [2003-02-04 18:19 UTC]
Using PHP 4.3.1-dev and running this script:




What line is the error reported on? (using PHP CLI binary)
And what about with PHP CGI binary ?

For me, it says the error is on line 3, which is correct.
 [2003-02-05 03:45 UTC] arne dot brachhold at co4 dot de
It shows the correct line on short scripts like yours.
But when I create a script, write 20 times

if(isset($blubb)) {


ans then blubb(); which is now on line 88, it tells me the error is on line 66. As longer the script is as higher is the difference.

Sorry at the moment i don't have the time to test this with the CGI Binary. But i can do this on weekend.
 [2003-02-13 02:21 UTC]
What was the result when testing with CGI binary?
(on command line!)

I can't reproduce this with even over 1000 lines of code..

 [2003-02-20 08:04 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2011-08-23 10:25 UTC] noemail at noemail dot com
This problem occurs when the line breaks are in different format.
Change the line break style to Dos (CR+LF) or Unix (LF) and the problem will 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 00:03:40 2023 UTC