Re: idea: letting the line number and file name be set via user_error
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)