Re: cvs: php4 /pear PEAR.php.in
| From: | Jon Parise | Date: | Thu, 29 Mar 2001 20:33:59 +0000 |
| Subject: | Re: cvs: php4 /pear PEAR.php.in | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-136@lists.php.net to get a copy of this message | ||
On Thu, Mar 29, 2001 at 07:54:28PM -0000, Chuck Hagenbuch wrote:
> if ($mode === null) {
> - $mode = $this->_default_error_mode;
> + if (isset($this->_default_error_mode)) {
> + $mode = $this->_default_error_mode;
> + }
> if ($mode === null) {
> $mode = $GLOBALS['_PEAR_default_error_mode'];
> }
> }
Wouldn't that be better written as:
if ($mode === null) {
if (isset($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
} else {
$mode = $GLOBALS['_PEAR_default_error_mode'];
}
}
The same goes for:
> if ($mode == PEAR_ERROR_TRIGGER && $options === null) {
> - $options = $this->_default_error_options;
> + if (isset($this->_default_error_options)) {
> + $options = $this->_default_error_options;
> + }
> if ($options === null) {
> $options = $GLOBALS['_PEAR_default_error_options'];
> }
And here:
> if (!is_string($options) &&
> !(is_array($options) && sizeof($options) == 2 &&
> is_object($options[0]) && is_string($options[1]))) {
> - $options = $this->_default_error_callback;
> + if (isset($this->_default_error_callback)) {
> + $options = $this->_default_error_callback;
> + }
> if ($options === null) {
> $options = $GLOBALS['_PEAR_default_error_callback'];
> }
> }
And you appear to do what I suggest here:
> if ($options === null) {
> - $options = $this->_default_error_options;
> + if (isset($this->_default_error_options)) {
> + $options = $this->_default_error_options;
> + } else {
> + $options = $GLOBALS['_PEAR_default_error_options'];
> + }
> }
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House
Member