php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22296 PEAR::setErrorHandling() must return previous Error handling state
Submitted: 2003-02-19 05:08 UTC Modified: 2011-01-01 01:22 UTC
From: pbougrier at micropole-univers dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.0 OS: WIN2000
Private report: No CVE-ID: None
 [2003-02-19 05:08 UTC] 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);
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 01:22 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2011-01-01 01:22 UTC] jani@php.net
PEAR errors are reported at http://pear.php.net/bugs/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 20:01:30 2024 UTC