summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-11-10 02:09:26 +0000
committerStig Bakken <ssb@php.net>2002-11-10 02:09:26 +0000
commitcd72343bb39659f42e09547e90bcd06938e46449 (patch)
tree300a58b75b2027a1cf99339de242205c94876627 /main/main.c
parent60febe289017713dd4618ad3e2c5211c2520708c (diff)
downloadphp-git-cd72343bb39659f42e09547e90bcd06938e46449.tar.gz
* honor track_errors ini setting in php_verror()
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/main/main.c b/main/main.c
index 33e255e5f2..54b75b1d05 100644
--- a/main/main.c
+++ b/main/main.c
@@ -406,8 +406,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
char *buffer = NULL, *docref_buf = NULL, *ref = NULL, *target = NULL;
char *docref_target = "", *docref_root = "";
char *function, *p;
+ int buffer_len = 0;
- vspprintf(&buffer, 0, format, args);
+ buffer_len = vspprintf(&buffer, 0, format, args);
if (buffer) {
if (docref && docref[0] == '#') {
docref_target = strchr(docref, '#');
@@ -464,9 +465,19 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
docref = "Unknown";
php_error(type, "%s(%s): %s", docref, params, buffer);
}
+ if (PG(track_errors) && EG(active_symbol_table)) {
+ pval *tmp;
+ ALLOC_ZVAL(tmp);
+ INIT_PZVAL(tmp);
+ Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
+ Z_STRLEN_P(tmp) = buffer_len;
+ Z_TYPE_P(tmp) = IS_STRING;
+ zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
+ }
efree(buffer);
- if (docref_buf)
+ if (docref_buf) {
efree(docref_buf);
+ }
} else {
php_error(E_ERROR, "%s(%s): Out of memory", get_active_function_name(TSRMLS_C), params);
}