From:             tom dot polak at post dot cz
Operating system: Windows, but all
PHP version:      4.2.3
PHP Bug Type:     Feature/Change Request
Bug description:  __FILE__, __LINE__ as default parameter value

Hello,
First, I have found similar request as #13944, 
but there is NO SOLUTION EXPLAINED, only closed.
If this request is solved, then my request is solved too, 
but how was #13944 solved?

I am trying to write error handler function as follows:

function ErrorHandler($msg,$file=__FILE__,$line=__LINE__){
  print("Error {$msg} in file {$file} on line {$line}\n");
}

which can be called from any php script when error occurs:

...
if($somethingwrong){
 ErrorHandler("something wrong");
}

I can to see the $file and $line pointing to the place, 
from which is ErrorHanlder function called.
But currently I see allwys the same file and line 
of the ErrorHandler function itself.

This request is based on big amount of php script files, 
where is not so simple to found, where the error condition 
occurs. Because the $msg itself is often not enough to 
explain the point in source code.

Secondary, I need to have own errorhandler, because 
using some features when the error appears in SQL command, 
there is more additional information displayed (not 
showed in example above, because is not relevant to this request). I am
logging errors by its type to several 
locations, conditionally email it to response admin
and other things.

Because of hunderts calls of ErrorHandler, using __FILE__
and __LINE__ is very time and place consuming.

With hope, that this description is understandable, 
even my poor english knowledge.

Best regards,
Tomas Polak
[EMAIL PROTECTED]
-- 
Edit bug report at http://bugs.php.net/?id=22393&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22393&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22393&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22393&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22393&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22393&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22393&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22393&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22393&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22393&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22393&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22393&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22393&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22393&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22393&r=gnused

Reply via email to