in file1.php:

```
set_error_handler('my_error_handler');
set_exception_handler('my_exception_handler');

function my_error_handler($errNo, $errStr, $errFile, $errLine, $whatever = null){
  // here ErrFile and $errLine are correct only for native funcs...
  throw New ErrorException($errStr, 0, $errNo, $errFile, $errLine);
}

function my_exception_handler($exception){
  print $exception->getLine(); // correct only for native functions
  print $exception->getFile(); // correct only for native functions
}

```

in file2.php, an example function definition:

```
function foo($requiredArg){

}

```

and in file3.php, calling foo:

```
  foo();

```

produces:

> 
> Missing argument 1 for foo(), called in file3.php on line 2 and
>  defined...
> 
> 
> 

The messsage is correct, but when I try to get the file and line with `$exception->getFile()` and `$exception->getLine()` (in my exception handler), I get the file and line where foo() was defined, not where it was called...

But with native PHP functions I get the file and line where the function was called (and this is what I want).