php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #11651 Need something like a __LINE__ constant to show the line in *main* file.
Submitted: 2001-06-25 04:34 UTC Modified: 2003-04-21 23:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dron007 at yahoo dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.0.5 OS: Linux RedHat 5.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dron007 at yahoo dot com
New email:
PHP Version: OS:

 

 [2001-06-25 04:34 UTC] dron007 at yahoo dot com
When some error happens in function within included file it is sometimes very hard to find from which line in the main script (containing include function) this function was called. It would be much better if there were a way to get the number of the line within the main script file which is being parsed.

file1:

include ("file2");
some_function();


file2:

function some_function() {
...
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-21 23:59 UTC] pollita@php.net
This functionality already exists, after a fashion, by using the debug_backtrace() function.  Essentially, you want to retrieve the backtrace data using debug_backtrace, then look at the second to last element's 'line' member.

Refer to the manual page for debug_backtrace() for more information.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC