#22296 [NEW]: PEAR::setErrorHandling() must return previous Error handling state
| From: | pbougrier at micropole-univers dot com | Date: | Wed, 19 Feb 2003 11:08:20 +0000 |
| Subject: | #22296 [NEW]: PEAR::setErrorHandling() must return previous Error handling state | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-33551@lists.php.net to get a copy of this message | ||
From: pbougrier at micropole-univers dot com
Operating system: WIN2000
PHP version: 4.3.0
PHP Bug Type: Feature/Change Request
Bug description: PEAR::setErrorHandling() must return previous Error handling state
Say we have a global inherited PEAR object (e.g. "$foo"), created in
another script with a ErrorHandling state we don't know.
In our script, we have a critical section where this object must die if an
error occurs :
<?
// begin of critical section
$foo->setErrorHandling(PEAR_ERROR_DIE);
// ... doing critical things
// end of critical section. previous error handler must be reactivated,
but, hey, who is it ?
$foo->setErrorHandling(?);
?>
Solution : setErrorHandling() must return a "thing" which handle the
previous error handling state.
<?
// begin of critical section
$previousErrorHandlingState = $foo->setErrorHandling(PEAR_ERROR_DIE);
// ... doing critical things
// end of critical section. previous error handler must be reactivated,
and we know it.
$foo->setErrorHandling($previousErrorHandlingState);
?>
--
Edit bug report at http://bugs.php.net/?id=22296&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22296&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22296&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22296&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22296&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22296&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22296&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22296&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22296&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22296&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22296&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22296&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22296&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22296&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22296&r=gnused