#47887 [NEW]: Permit custom error types with trigger_error()
| From: | aragon at phat dot za dot net | Date: | Fri, 03 Apr 2009 14:29:28 +0000 |
| Subject: | #47887 [NEW]: Permit custom error types with trigger_error() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-135524@lists.php.net to get a copy of this message | ||
From: aragon at phat dot za dot net
Operating system: FreeBSD
PHP version: 5.2.9
PHP Bug Type: Feature/Change Request
Bug description: Permit custom error types with trigger_error()
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 bug report at http://bugs.php.net/?id=47887&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47887&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47887&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47887&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47887&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47887&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47887&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47887&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47887&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47887&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47887&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47887&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47887&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47887&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47887&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47887&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47887&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47887&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47887&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47887&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47887&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47887&r=mysqlcfg