For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > July 2004 > cvs: ZendEngine2 / zend_exceptions.c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: ZendEngine2 / zend_exceptions.c
Marcus Boerger

2004-07-25, 3:55 am

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/ZendEng...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_PAR
AMS_QUIET, argc TSRMLS_CC, "|sll", &message, &message_len, &code, &severity) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PAR
AMS_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_except
ion_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+
+ if (argc >= 4) {
+ zend_update_property_string(default_exce
ption_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC);
+ if (argc < 5) {
+ lineno = 0; // invalidate lineno
+ }
+ zend_update_property_long(default_excep
tion_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
+ }
}
/* }}} */

@@ -532,10 +540,12 @@
};

static
- ZEND_BEGIN_ARG_INFO(arginfo_error_except
ion___construct, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_error_ex
ception___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[] = {
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com