fork download
  1. <?php
  2. function myErrorHandler($errno, $errstr, $errfile, $errline) {
  3. if ( E_RECOVERABLE_ERROR===$errno ) {
  4. echo "handled catchable fatal error\n";
  5. //throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
  6. }
  7. //return false;
  8. return true;
  9. }
  10. set_error_handler('myErrorHandler');
  11.  
  12. class ClassA {
  13. public function method_a (ClassB $b) {
  14. echo "Inside of method_a()\n";
  15. }
  16. }
  17.  
  18. class ClassWrong{}
  19.  
  20. try{
  21. $a = new ClassA;
  22. $a->method_a(new ClassWrong);
  23. }
  24. catch(Exception $ex) {
  25. echo "catched Exception\n";
  26. }
  27. echo "done.";
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
handled catchable fatal error
Inside of method_a()
done.