File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / lang / 038.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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>