#15523 [Opn->Csd]: Line Number

From: Date: Sat, 18 Jan 2003 20:43:06 +0000
Subject: #15523 [Opn->Csd]: Line Number
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30512@lists.php.net to get a copy of this message
ID: 15523 Updated by: moriyoshi@php.net Reported By: blanke@ddd.de -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.1.1 New Comment: Try debug_backtrace(). <?php function test() { var_dump(debug_backtrace()); } test(); ?> Previous Comments: ------------------------------------------------------------------------ [2002-06-08 10:44:35] bigredlinux@yahoo.com What would be nice is if line() and file() were functions and they returned an array of line numbers and files...Hence, for each level of depth you proceed, it would array_push the line and file and then when you exited it would pop them. That way, you could get the whole hierarchy, and without and punishment. I realize that php is going towards stack tracing, but this would be HUGE. PEAR_Error would actually be helpful in cases that used this functionality. ------------------------------------------------------------------------ [2002-02-12 10:53:00] jan@php.net reopening, this is a serious request ;) ------------------------------------------------------------------------ [2002-02-12 10:51:37] blanke@ddd.de That would work of course. The problem is, that our company has written a set of php functions, which are used by one of our clients. The functions include some error-handling like wrong arguments or something like that, and I'd like to tell them the linenumber. I think its not very useful that they have to put __LINE__ into every function call :) ------------------------------------------------------------------------ [2002-02-12 10:47:52] jan@php.net what about function foo($line) { echo 'the function was called in line: '.$line } foo(__LINE__); ? ------------------------------------------------------------------------ [2002-02-12 10:45:32] blanke@ddd.de Hi there! That's correct, that __LINE__ contains the !current! Line-Number. But I what to know from which line a function has been called. > > > > 1 function blah() > > 2 { > > 3 echo("Function blah has been called from line 6"); > > 4 } > > 5 > > 6 blah(); > > In line 3, i don't want to know the CURRENT line Number. I'd like to know the Line-Number from which that Function has been called. mfg, Nico Blanke. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15523 -- Edit this bug report at http://bugs.php.net/?id=15523&edit=1

« previous php.bugs (#30512) next »