PEAR setErrorHandling bug
| From: | Jason Rust | Date: | Wed, 09 Apr 2003 18:52:53 +0000 |
| Subject: | PEAR setErrorHandling bug | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-15068@lists.php.net to get a copy of this message | ||
Found a bug in setErrorHandling method. Because of PHP's bug of making $this a global variable an error occurs if you try to set a new error mode within an instantiated object. Example
class Foo {
function Foo()
{
PEAR::setErrorHandling(PEAR_ERROR_TRIGGER);} } $foo =& new Foo(); Because setErrorHandling checks to see if $this is set to determine whether to make the error mode part of $GLOBALS or part of the object it mistakenly tries to make it part of the object if called from another instantiated object (like above). Easy fix would be to change: if (isset($this)) { to: if (isset($this) && isset($this->_default_error_mode)) { -Jason