note 110013 deleted from class.errorexception by googleguy

From: Date: Wed, 12 Sep 2012 03:33:12 +0000
Subject: note 110013 deleted from class.errorexception by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190631@lists.php.net to get a copy of this message
Note Submitter: xianrenb at gmail dot com ---- I believe the example code before vog at notjusthosting dot com commented on 2 may 2011 should be: <?php function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler("exception_error_handler"); /* Trigger exception */ strpos(); ?> And the one suggested by vog should be incorrect with the following reasons. As in the manual page of set_error_handler(), "the first parameter, errno, contains the level of the error raised, as an integer". This should be the same meaning as the severity of ErrorException. Meanwhile, severity is the only property that added to ErrorException, making it different from Exception. It only makes sense if severity is set for any ErrorException. And the default value for severity is one but not zero. Others had used other variable names in comments, but the parameter sequence is different from vog.

« previous php.notes (#190631) next »