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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pbougrier at micropole-univers dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC