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

From: Date: Tue, 07 May 2013 16:09:01 +0000
Subject: idea: letting the line number and file name be set via user_error
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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).

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.


Thread (20 messages)

« previous php.internals (#67333) next »