Annotation of embedaddon/php/tests/lang/038.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Convert warnings to exceptions
3: --FILE--
4: <?php
5:
6: class MyException extends Exception
7: {
8: function __construct($errstr, $errno=0, $errfile='', $errline='')
9: {
10: parent::__construct($errstr, $errno);
11: $this->file = $errfile;
12: $this->line = $errline;
13: }
14: }
15:
16: function Error2Exception($errno, $errstr, $errfile, $errline)
17: {
18: throw new MyException($errstr, $errno);//, $errfile, $errline);
19: }
20:
21: $err_msg = 'no exception';
22: set_error_handler('Error2Exception');
23:
24: try
25: {
26: $con = fopen("/tmp/a_file_that_does_not_exist",'r');
27: }
28: catch (Exception $e)
29: {
30: $trace = $e->getTrace();
31: var_dump($trace[0]['function']);
32: var_dump($trace[1]['function']);
33: }
34:
35: ?>
36: ===DONE===
37: <?php exit(0); ?>
38: --EXPECTF--
39: string(15) "Error2Exception"
40: string(5) "fopen"
41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>