try, assert() instead of echo()ing error messages.

assert('is_object($obj)');

and write your error handler code or use mine :)
or am i missing something?

Papp Gyozo
- [EMAIL PROTECTED]

----- Original Message ----- 
From: "SafeV" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 22, 2001 4:15 PM
Subject: [PHP] error handling and __LINE__


| Hi,
| I wonder if there's a way to find the line number of the calling script 
| from a function, like the error messages PHP generates. An example:
| 
| In an included file I have a function and want to do something similar to:
| 
| function foo($obj) {
|     if (!is_object($obj)) {
|         echo "Error: supplied argument is not an object in ";
|         echo __FILE__ . " line " . __LINE__; 
|     }
|     ...
| }
| 
| But __FILE__ and __LINE__ refers to the current file, ie. the file with 
| the function in, and not the file where the function is called from.
| The first one I can solve by using $SCRIPT_NAME, but what about the line 
| number???
| 
| 
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
| To contact the list administrators, e-mail: [EMAIL PROTECTED]
| 


Reply via email to