You are here

function PEAR::staticPopErrorHandling in Calendar Systems 5

File

calendar/lib/PEAR.php, line 635

Class

PEAR
Base class for other PEAR classes. Provides rudimentary emulation of destructors.

Code

function staticPopErrorHandling() {
  $stack =& $GLOBALS['_PEAR_error_handler_stack'];
  $setmode =& $GLOBALS['_PEAR_default_error_mode'];
  $setoptions =& $GLOBALS['_PEAR_default_error_options'];
  array_pop($stack);
  list($mode, $options) = $stack[sizeof($stack) - 1];
  array_pop($stack);
  switch ($mode) {
    case PEAR_ERROR_EXCEPTION:
    case PEAR_ERROR_RETURN:
    case PEAR_ERROR_PRINT:
    case PEAR_ERROR_TRIGGER:
    case PEAR_ERROR_DIE:
    case null:
      $setmode = $mode;
      $setoptions = $options;
      break;
    case PEAR_ERROR_CALLBACK:
      $setmode = $mode;

      // class/object method callback
      if (is_callable($options)) {
        $setoptions = $options;
      }
      else {
        trigger_error("invalid error callback", E_USER_WARNING);
      }
      break;
    default:
      trigger_error("invalid error mode", E_USER_WARNING);
      break;
  }
  return true;
}