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ʇ&Ѓo']CElH"о.ݺ-f~ eEOըyd ۔!aop\𼌥wdȽmO4F$bv}; 翙q(OiG`v|$0;''9zȏ*._!.SDk-#DqXzLuc0\/i7|Vr6kEi:C %K^CEOU4˹\'vߔQ9Lًy/ \MJK6|3uc?ɠ{ (`BGHC r'նY/O 4$|A*ʡJͥSQ;#cj]ȂC$NosǙ~!")ٔ9b"|DCnDvp2Q/BQ/Oj/rriV.Udb-{8kTm5wu[,Iƫvv iN) .仿7Vx[<J\:}WKB<3AwgFN5K]OaR(7WSɵBhYn^gN@wX m]>t3҃;}Ouki6h[U OPvTM\RCZfj碶XuSB 3]#/xe5me wgFN5K]O/icr \8>xgv_QʍP!`<-MN,t&Zݐti;9o2x9\ư 3{ͽ?v_6R(X۾`/mF#c0VN DpjٶPcEu2ƲFݨs]ՀEg}̟.:Q/9 Z3p}!iTp23vyZ| !C n ڎj1PTKޯ%Y{.燁2y&α SuBkvݦG~sXzsSlXY[ '-+r??Ĥb~kwr8;jo[V_zg}ĜcOmNfX1vVr'7c j[+?. 1V׊ . 'array, or PEAR_Error' ); } } $code = $p3; if (is_array($p2) && isset($p2['message'])) { // fix potential problem of passing in a single warning $p2 = array($p2); } $this->cause = $p2; } else { $code = null; $this->cause = null; } parent::__construct($message, (int) $code); $this->signal(); } /** * Add an exception observer * * @param mixed $callback - A valid php callback, see php func is_callable() * - A PEAR_Exception::OBSERVER_* constant * - An array(const PEAR_Exception::OBSERVER_*, * mixed $options) * @param string $label The name of the observer. Use this if you want * to remove it later with removeObserver() * * @return void */ public static function addObserver($callback, $label = 'default') { self::$_observers[$label] = $callback; } /** * Remove an exception observer * * @param string $label Name of the observer * * @return void */ public static function removeObserver($label = 'default') { unset(self::$_observers[$label]); } /** * Generate a unique ID for an observer * * @return int unique identifier for an observer */ public static function getUniqueId() { return self::$_uniqueid++; } /** * Send a signal to all observers * * @return void */ protected function signal() { 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); } } } /** * Return specific error information that can be used for more detailed * error messages or translation. * * This method may be overridden in child exception classes in order * to add functionality not present in PEAR_Exception and is a placeholder * to define API * * The returned array must be an associative array of parameter => value like so: *
     * array('name' => $name, 'context' => array(...))
     * 
* * @return array */ public function getErrorData() { return array(); } /** * Returns the exception that caused this exception to be thrown * * @return Exception|array The context of the exception */ public function getCause() { return $this->cause; } /** * Function must be public to call on caused exceptions * * @param array $causes Array that gets filled. * * @return void */ public function getCauseMessage(&$causes) { $trace = $this->getTraceSafe(); $cause = array('class' => get_class($this), 'message' => $this->message, 'file' => 'unknown', 'line' => 'unknown'); if (isset($trace[0])) { if (isset($trace[0]['file'])) { $cause['file'] = $trace[0]['file']; $cause['line'] = $trace[0]['line']; } } $causes[] = $cause; if ($this->cause instanceof PEAR_Exception) { $this->cause->getCauseMessage($causes); } elseif ($this->cause instanceof Exception) { $causes[] = array('class' => get_class($this->cause), 'message' => $this->cause->getMessage(), 'file' => $this->cause->getFile(), 'line' => $this->cause->getLine()); } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) { $causes[] = array('class' => get_class($this->cause), 'message' => $this->cause->getMessage(), 'file' => 'unknown', 'line' => 'unknown'); } elseif (is_array($this->cause)) { foreach ($this->cause as $cause) { if ($cause instanceof PEAR_Exception) { $cause->getCauseMessage($causes); } elseif ($cause instanceof Exception) { $causes[] = array('class' => get_class($cause), 'message' => $cause->getMessage(), 'file' => $cause->getFile(), 'line' => $cause->getLine()); } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error ) { $causes[] = array('class' => get_class($cause), 'message' => $cause->getMessage(), 'file' => 'unknown', 'line' => 'unknown'); } elseif (is_array($cause) && isset($cause['message'])) { // PEAR_ErrorStack warning $causes[] = array( 'class' => $cause['package'], 'message' => $cause['message'], 'file' => isset($cause['context']['file']) ? $cause['context']['file'] : 'unknown', 'line' => isset($cause['context']['line']) ? $cause['context']['line'] : 'unknown', ); } } } } /** * Build a backtrace and return it * * @return array Backtrace */ public function getTraceSafe() { if (!isset($this->_trace)) { $this->_trace = $this->getTrace(); if (empty($this->_trace)) { $backtrace = debug_backtrace(); $this->_trace = array($backtrace[count($backtrace)-1]); } } return $this->_trace; } /** * Gets the first class of the backtrace * * @return string Class name */ public function getErrorClass() { $trace = $this->getTraceSafe(); return $trace[0]['class']; } /** * Gets the first method of the backtrace * * @return string Method/function name */ public function getErrorMethod() { $trace = $this->getTraceSafe(); return $trace[0]['function']; } /** * Converts the exception to a string (HTML or plain text) * * @return string String representation * * @see toHtml() * @see toText() */ public function __toString() { if (isset($_SERVER['REQUEST_URI'])) { return $this->toHtml(); } return $this->toText(); } /** * Generates a HTML representation of the exception * * @return string HTML code */ public function toHtml() { $trace = $this->getTraceSafe(); $causes = array(); $this->getCauseMessage($causes); $html = '' . "\n"; foreach ($causes as $i => $cause) { $html .= '\n"; } $html .= '' . "\n" . '' . '' . '' . "\n"; foreach ($trace as $k => $v) { $html .= '' . '' . '' . "\n"; } $html .= '' . '' . '' . "\n" . '
' . str_repeat('-', $i) . ' ' . $cause['class'] . ': ' . htmlspecialchars($cause['message']) . ' in ' . $cause['file'] . ' ' . 'on line ' . $cause['line'] . '' . "
Exception trace
#FunctionLocation
' . $k . ''; if (!empty($v['class'])) { $html .= $v['class'] . $v['type']; } $html .= $v['function']; $args = array(); if (!empty($v['args'])) { foreach ($v['args'] as $arg) { if (is_null($arg)) { $args[] = 'null'; } else if (is_array($arg)) { $args[] = 'Array'; } else if (is_object($arg)) { $args[] = 'Object('.get_class($arg).')'; } else if (is_bool($arg)) { $args[] = $arg ? 'true' : 'false'; } else if (is_int($arg) || is_double($arg)) { $args[] = $arg; } else { $arg = (string)$arg; $str = htmlspecialchars(substr($arg, 0, 16)); if (strlen($arg) > 16) { $str .= '…'; } $args[] = "'" . $str . "'"; } } } $html .= '(' . implode(', ', $args) . ')' . '' . (isset($v['file']) ? $v['file'] : 'unknown') . ':' . (isset($v['line']) ? $v['line'] : 'unknown') . '
' . ($k+1) . '{main} 
'; return $html; } /** * Generates text representation of the exception and stack trace * * @return string */ public function toText() { $causes = array(); $this->getCauseMessage($causes); $causeMsg = ''; foreach ($causes as $i => $cause) { $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': ' . $cause['message'] . ' in ' . $cause['file'] . ' on line ' . $cause['line'] . "\n"; } return $causeMsg . $this->getTraceAsString(); } } ?>