cvs: ZendEngine2 / zend_exceptions.c

From: Date: Sun, 25 Jul 2004 07:05:48 +0000
Subject: cvs: ZendEngine2 / zend_exceptions.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2797@lists.php.net to get a copy of this message
helly Sun Jul 25 03:05:48 2004 EDT Modified files: /ZendEngine2 zend_exceptions.c Log: - Add optional parameters $filename and $lineno to ErrorException constructor to allow overwriting automatically retrieved information. # It may be reasonable to delete the trace in case that feature is used. http://cvs.php.net/diff.php/ZendEngine2/zend_exceptions.c?r1=1.68&r2=1.69&ty=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.68 ZendEngine2/zend_exceptions.c:1.69 --- ZendEngine2/zend_exceptions.c:1.68 Tue Jul 20 06:43:19 2004 +++ ZendEngine2/zend_exceptions.c Sun Jul 25 03:05:48 2004 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.68 2004/07/20 10:43:19 zeev Exp $ */ +/* $Id: zend_exceptions.c,v 1.69 2004/07/25 07:05:48 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -147,16 +147,16 @@ /* }}} */ -/* {{{ proto ErrorException::__construct(string message, int code, int severity) +/* {{{ proto ErrorException::__construct(string message, int code, int severity [, $filename [, $lineno]]) ErrorException constructor */ ZEND_METHOD(error_exception, __construct) { - char *message = NULL; - long code = 0, severity = E_ERROR; + char *message = NULL, *filename = NULL; + long code = 0, severity = E_ERROR, lineno; zval *object; - int argc = ZEND_NUM_ARGS(), message_len; + int argc = ZEND_NUM_ARGS(), message_len, filename_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sll", &message, &message_len, &code, &severity) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllsl", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno) == FAILURE) { zend_error(E_CORE_ERROR, "Wrong parameter count for exception([string $exception [, long $code ]])"); } @@ -171,6 +171,14 @@ } zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); + + if (argc >= 4) { + zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC); + if (argc < 5) { + lineno = 0; // invalidate lineno + } + zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC); + } } /* }}} */ @@ -532,10 +540,12 @@ }; static -ZEND_BEGIN_ARG_INFO(arginfo_error_exception___construct, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 3) ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, code) ZEND_ARG_INFO(0, severity) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, lineno) ZEND_END_ARG_INFO(); static zend_function_entry error_exception_functions[] = {

« previous php.zend-engine.cvs (#2797) next »