cvs: pear-core /PEAR ErrorStack5.php

From: Date: Sat, 23 Oct 2004 17:14:45 +0000
Subject: cvs: pear-core /PEAR ErrorStack5.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-1131@lists.php.net to get a copy of this message
cellog Sat Oct 23 13:14:45 2004 EDT Modified files: /pear-core/PEAR ErrorStack5.php Log: remove exception instantiation, it's too generic http://cvs.php.net/diff.php/pear-core/PEAR/ErrorStack5.php?r1=1.3&r2=1.4&ty=u Index: pear-core/PEAR/ErrorStack5.php diff -u pear-core/PEAR/ErrorStack5.php:1.3 pear-core/PEAR/ErrorStack5.php:1.4 --- pear-core/PEAR/ErrorStack5.php:1.3 Fri Sep 3 23:45:30 2004 +++ pear-core/PEAR/ErrorStack5.php Sat Oct 23 13:14:45 2004 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: ErrorStack5.php,v 1.3 2004/09/04 03:45:30 cellog Exp $ +// $Id: ErrorStack5.php,v 1.4 2004/10/23 17:14:45 cellog Exp $ /** * Error Stack Implementation - E_STRICT compliant @@ -218,12 +218,6 @@ protected $_logger = false; /** - * Class name to use for a PHP 5 exception that will be returned - * @var string - */ - protected $_exceptionClass = 'PEAR_Exception'; - - /** * Error messages - designed to be overridden * @var array * @abstract @@ -238,20 +232,14 @@ * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error (ignored) - * @param string $exceptionClass exception class to instantiate if - * in PHP 5 */ public function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false, - $throwPEAR_Error = false, $exceptionClass = null) + $throwPEAR_Error = false) { $this->_package = $package; $this->setMessageCallback($msgCallback); $this->setContextCallback($contextCallback); $this->_compat = false; - // this allows child classes to simply redefine $this->_exceptionClass - if (!is_null($exceptionClass)) { - $this->_exceptionClass = $exceptionClass; - } } /** @@ -271,8 +259,7 @@ * @return PEAR_ErrorStack */ static public function singleton($package, $msgCallback = false, $contextCallback = false, - $throwPEAR_Error = false, $exceptionClass = null, - $stackClass = 'PEAR_ErrorStack') + $throwPEAR_Error = false, $stackClass = 'PEAR_ErrorStack') { if (isset(self::$singleton[$package])) { return self::$singleton[$package]; @@ -284,8 +271,7 @@ false, $trace); } return self::$singleton[$package] = - new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error, - $exceptionClass); + new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error); } @@ -466,7 +452,7 @@ */ public function promoteWarning($warning, $exceptionclass = 'PEAR_Exception') { - return new PEAR_Exception($warning['message'], + return new $exceptionclass($warning['message'], array($warning), $warning['code']); } @@ -598,15 +584,6 @@ $this->_log($err); } } - if (class_exists($this->_exceptionClass)) { - $exception = $this->_exceptionClass; - if (is_string($msg) && is_numeric($code)) { - $code = $code + 0; - } - $ret = new $exception($msg, $code); - $ret->errorData = $err; - return $ret; - } return $err; }

« previous php.pear.core (#1131) next »