Re: idea: letting the line number and file name be set via user_error

From: Date: Tue, 07 May 2013 19:04:59 +0000
Subject: Re: idea: letting the line number and file name be set via user_error
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
2013/5/7 Thomas Anderson <[email protected]>

> If you do user_error('whatever') it'll show, as the line number for that
> error, the line number on which that user_error() call is made.  It'd be
> nice if you could control the line number and file name that was displayed.
> eg.
>
> <?php
> function test() {
>     user_error('whatever');
> }
>
> test();
> ?>
>
> That'll say "Notice: whatever in ... on line 4" (ie. the line that the
> user_error is on) instead of "Notice: whatever in ... on line 7" (ie. the
> line that the call to the test() function is made).
>

Something I don't understand: You call test() in line 7 and line triggers
the error, so in fact it is _really_ line 3, that causes the message. So
why should it display "line 7", when it is obvious the wrong line?


>
> If the displayed line numbers could be controlled by user_error then
> debug_backtrace could be used to get the desired line number / file name to
> display.
>



-- 
github.com/KingCrunch


Thread (20 messages)

« previous php.internals (#67346) next »