I am using trigger_error to "throw" errors in a custom class. My problem is that trigger_error prints out the line number where trigger_error was called. For example, given the following code:
01 <?php
02 class Test {
03 function doAction() {
04 $this->doSubAction();
05 }
06
07 function doSubAction() {
08 if(true)
09 trigger_error('Custom error', E_USER_WARNING);
10 }
11 }
12
13 $var = new Test();
14 $var->doAction();
15 ?>
PHP will print out the following:
Warning: Custom error in test.php on line 9
How would you make PHP return the line where the doAction() function was called (the method called outside the class, ignoring all calls made internally) as follows?
Warning: Custom error in test.php on line 14
Edit: Modified my example to be something a bit closer to what I'm trying to achieve.