summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-05-11 15:03:47 +0000
committerFelipe Pena <felipe@php.net>2009-05-11 15:03:47 +0000
commit4f068cc23b1dfe3ccea3cbec2a845aee849c853f (patch)
treeb76c5aef6a76984c0ac98be6742a524b5ce15053 /Zend/zend_exceptions.c
parent85bcfa89ad54a2ad0fcff7d45a5b2402f2647c78 (diff)
downloadphp-git-4f068cc23b1dfe3ccea3cbec2a845aee849c853f.tar.gz
- MFH: Fix code && new test
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 9304dd55bc..84724bce10 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -487,10 +487,13 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
ZEND_METHOD(exception, getTraceAsString)
{
zval *trace;
- char *res = estrdup(""), **str = &res, *s_tmp;
+ char *res, **str, *s_tmp;
int res_len = 0, *len = &res_len, num = 0;
DEFAULT_0_PARAMS;
+
+ res = estrdup("");
+ str = &res;
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
@@ -534,12 +537,14 @@ int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */
ZEND_METHOD(exception, __toString)
{
zval message, file, line, *trace, *exception;
- char *str = estrndup("", 0), *prev_str;
+ char *str, *prev_str;
int len = 0;
zend_fcall_info fci;
zval fname;
DEFAULT_0_PARAMS;
+
+ str = estrndup("", 0);
exception = getThis();
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);