ID:               47887
 Updated by:       [email protected]
 Reported By:      aragon at phat dot za dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.2.9
 New Comment:

This isn't possible, as the whole error infrastructure, including all
logging components and therelike have to know the error levels which
might occur. You could use a global variable to transport your own error
code for example.


Previous Comments:
------------------------------------------------------------------------

[2009-04-03 14:29:27] aragon at phat dot za dot net

Description:
------------
It would be useful if trigger_error would accept custom error types. 
Although I can do this with Exceptions, I can't see a way of sending
variable context from where an exception is thrown to the exception
handler, and loosing variable context would be a deal breaker.


Reproduce code:
---------------
define('E_CUSTOM_1', -1);
define('E_CUSTOM_2', -2);
function error_handler ($errno, $errmsg, $scriptname, $scriptline,
$errcontext) {
   if ($errno == E_CUSTOM_1) die('custom error type');
}
set_error_handler('error_handler');
trigger_user('message', E_CUSTOM_1);


Expected result:
----------------
custom error type


Actual result:
--------------
PHP Warning:  Invalid error type specified in - on line 7



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47887&edit=1

Reply via email to