svn: /pear2/Exception/trunk/src/ Exception.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Mon, 22 Feb 2010 00:22:17 +0000 |
| Subject: | svn: /pear2/Exception/trunk/src/ Exception.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9188@lists.php.net to get a copy of this message | ||
dufuz Mon, 22 Feb 2010 00:22:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295341
Log:
Removed the built in outputs of the observer functions. Those where the class constants
OBSERVER_PRINT, OBSERVER_TRIGGER, OBSERVER_DIE
This can be achieved by writing a custom callback function, using the appropriate printf(),
trigger_error and die() to achieve the same result.
Changed paths:
U pear2/Exception/trunk/src/Exception.php
Modified: pear2/Exception/trunk/src/Exception.php
===================================================================
--- pear2/Exception/trunk/src/Exception.php 2010-02-22 00:05:02 UTC (rev 295340)
+++ pear2/Exception/trunk/src/Exception.php 2010-02-22 00:22:17 UTC (rev 295341)
@@ -72,9 +72,7 @@
namespace pear2;
abstract class Exception extends \Exception
{
- const OBSERVER_PRINT = -2;
- const OBSERVER_TRIGGER = -4;
- const OBSERVER_DIE = -8;
+ static $htmlError = false;
private static $_observers = array();
private $_trace;
@@ -135,26 +133,7 @@
foreach (self::$_observers as $func) {
if (is_callable($func)) {
call_user_func($func, $this);
- continue;
}
-
- settype($func, 'array');
- switch ($func[0]) {
- case self::OBSERVER_PRINT :
- $f = (isset($func[1])) ? $func[1] : '%s';
- printf($f, $this->getMessage());
- break;
- case self::OBSERVER_TRIGGER :
- $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
- trigger_error($this->getMessage(), $f);
- break;
- case self::OBSERVER_DIE :
- $f = (isset($func[1])) ? $func[1] : '%s';
- die(printf($f, $this->getMessage()));
- break;
- default:
- trigger_error('invalid observer type', E_USER_WARNING);
- }
}
}
@@ -162,7 +141,7 @@
* Function must be public to call on caused exceptions
* @param array
*/
- public function getCauseMessage(&$causes)
+ public function getCauseMessage(array &$causes)
{
$trace = $this->getTraceSafe();
$cause = array(