[ create a new paste ] login | about

Link: http://codepad.org/hwbsYcRF    [ raw code | output | fork ]

PHP, pasted on May 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) {
   throw new Exception("this was an error;");
}

function exceptionHandler($e) {
   echo 'exceptionHandler';
}

set_error_handler('errorHandler');
set_exception_handler('exceptionHandler');

try {
    file_get_contents('foo');
} catch (Exception $e) {
    echo $e->getMessage(); // exceptionHandler() not called
}

file_get_contents('foo');  // exceptionHandler() is called


Output:
1
this was an error;exceptionHandler


Create a new paste based on this one


Comments: