Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.4

Bug #6574 Translation2_Container::raiseError does not honor global PEAR error settings
Submitted: 2006-01-25 01:03 UTC
From: jrossiter at pheedo dot com Assigned: quipo
Status: Closed Package: Translation2
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-01-25 01:03 UTC] jrossiter at pheedo dot com
Description: ------------ Translation2 2.0.0b8 Translation2_Container::raiseError does not honor the global PEAR error settings (PEAR_ERROR_RETURN, etc.) because its function definition is as such: function raiseError($msg, $code, $mode=PEAR_ERROR_TRIGGER, $option=E_USER_WARNING) If no mode is specified it defaults to TRIGGER and is not overridable by the developer. Expected result: ---------------- Class should store and honor the global PEAR preference either by properly extending the PEAR class so that setErrorHandling() can be used, or by using $GLOBALS['_PEAR_default_error_mode'] if it's set.

Comments

 [2006-01-26 11:02 UTC] quipo
would this definition work for you? ============================================== function raiseError($msg, $code, $mode=null, $option=null) { if (is_null($mode)) { $mode = $GLOBALS['_PEAR_default_error_mode']; } if (is_null($option)) { $option = $GLOBALS['_PEAR_default_error_options'] } if ($mode == PEAR_ERROR_RETURN) { return PEAR::raiseError($msg, $code, $mode, $option); } else { PEAR::raiseError($msg, $code, $mode, $option); } } ==============================================
 [2006-01-26 18:18 UTC] jrossiter at pheedo dot com
Actually, what might be the best, compatibility speaking, is to keep the definition the way it is, but add if (isset($GLOBALS['_PEAR_default_error_mode'])) { $mode = $GLOBALS['_PEAR_default_error_mode']; } at the top. That way it would work if users didn't have it set, and would continue to use the TRIGGER default, but would accept an override if present.
 [2006-02-11 18:30 UTC] quipo
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.