Edit report at http://bugs.php.net/bug.php?id=22296&edit=1

 ID:                 22296
 Updated by:         [email protected]
 Reported by:        pbougrier at micropole-univers dot com
 Summary:            PEAR::setErrorHandling() must return previous Error
                     handling state
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   WIN2000
 PHP Version:        4.3.0
 Block user comment: N
 Private report:     N

 New Comment:

PEAR errors are reported at http://pear.php.net/bugs/


Previous Comments:
------------------------------------------------------------------------
[2003-02-19 05:08:20] pbougrier at micropole-univers dot com

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 this bug report at http://bugs.php.net/bug.php?id=22296&edit=1

Reply via email to