summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-07-25 07:05:48 +0000
committerMarcus Boerger <helly@php.net>2004-07-25 07:05:48 +0000
commit2b9c90efd3bad80077e365ab2bfa28dc9b45c969 (patch)
treea6ecda9739427f6dc80491151a23f6cb4515aec3 /Zend/zend_exceptions.c
parentb9638a4a503b6355260980931ea0c480cb0c795d (diff)
downloadphp-git-2b9c90efd3bad80077e365ab2bfa28dc9b45c969.tar.gz
- 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.
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 8d218f722c..0ceba5fc84 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -147,16 +147,16 @@ ZEND_METHOD(exception, __construct)
/* }}} */
-/* {{{ 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_METHOD(error_exception, __construct)
}
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_function_entry default_exception_functions[] = {
};
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[] = {