<?php
require_once("PEAR.php");

class Instigator extends PEAR
{
   function doSomething() {
      PEAR::setErrorHandling(PEAR_ERROR_DIE); // won't work
      Killer::doSomething();
   }
}

class Killer
{
   function doSomething() {
      $victim = & new Victim();
      $victim->doSomething();
      print "He's still alive!";
   }
}

class Victim extends PEAR
{
   function doSomething() {
      return $this->raiseError("I'm dead!", 0);
   }
}

PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$instigator = new Instigator();
print "<br>first try: ";
$instigator->doSomething();
PEAR::setErrorHandling(PEAR_ERROR_DIE); // works
print "<br>second try: ";
$instigator->doSomething();

?>
