PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #3990

PEAR_Error PEAR_EXCEPTION broken

Details

Submitted2005-03-29 09:21 UTC
Frombugs at niluje dot net
Assignedcellog
StatusClosed
PackagePEAR
PHP Version5.0.3
OSlinux
Roadmaps(Not assigned)

Comments

[2005-03-29 09:21 UTC] bugs at niluje dot net

Description:
------------
line 863 : $e->PEAR_Error = $this;
causes segfault

$e->PEAR_Error = clone $this;
whould fix the problem, but $e->PEAR_Error would be empty anyway

We know Exception with PEAR_Exception is a nasty hack mainly because the Exception should be raised in the code where the error happends, however it's not necessary to print a warning every time.

here is the patch :

*** PEAR.php.orig 2005-03-29 10:38:55.119321377 +0200
--- PEAR.php 2005-03-29 11:16:25.025498559 +0200
***************
*** 859,866 ****
}
}
if ($this->mode & PEAR_ERROR_EXCEPTION) {
! trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING);
! eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);');
}
}

--- 859,865 ----
}
}
if ($this->mode & PEAR_ERROR_EXCEPTION) {
! eval('$e = new Exception($this->message." :: ".$this->userinfo, $this->code); throw($e);');
}
}

[2005-03-29 09:26 UTC] bugs at niluje dot net

the textarea cuts the patch, here are the lines :

861 if ($this->mode & PEAR_ERROR_EXCEPTION) {
862 eval('$e = new Exception($this->message." :: ".$this->userinfo, $this->code); throw($e);');
863 }
864 }

[2005-03-29 13:51 UTC] bugs at niluje dot net

since PEAR_ERROR_EXCEPTION is broken you might want to do more than just generate a warning. maybe remove the code and comment the correct way of doing it.