diff options
author | Marcus Boerger <helly@php.net> | 2003-09-01 22:55:40 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-09-01 22:55:40 +0000 |
commit | 4e049f9fc95910e30b1fda4b35e46c9dec5461cd (patch) | |
tree | 82b2f2fd870addd00f27281c27fa141ca3363064 /main/main.c | |
parent | 29664d9322b8cf20675043b08d19a883a5c06d65 (diff) | |
download | php-git-4e049f9fc95910e30b1fda4b35e46c9dec5461cd.tar.gz |
Error message clean up part I: always show 'Unknown' instead of empty names.
Diffstat (limited to 'main/main.c')
-rw-r--r-- | main/main.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/main/main.c b/main/main.c index 6294c64f85..9ee9b680d6 100644 --- a/main/main.c +++ b/main/main.c @@ -447,11 +447,15 @@ 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; + char *p; int buffer_len = 0; char *space; char *class_name = get_active_class_name(&space TSRMLS_CC); - + char *function = get_active_function_name(TSRMLS_C); + + if (!function || !strlen(function)) { + function = "Unknown"; + } buffer_len = vspprintf(&buffer, 0, format, args); if (buffer) { if (PG(html_errors)) { @@ -467,7 +471,6 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c docref = NULL; } if (!docref) { - function = get_active_function_name(TSRMLS_C); if (function) { spprintf(&docref_buf, 0, "function.%s", function); if (docref_buf) { @@ -506,20 +509,17 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c } if (!PG(html_errors) || !strlen(PG(docref_root))) { /* no docref and no html errors -> do not point to any documentation (e.g. production boxes) */ - php_error(type, "%s%s%s(%s): %s", class_name, space, get_active_function_name(TSRMLS_C), params, buffer); + php_error(type, "%s%s%s(%s): %s", class_name, space, function, params, buffer); } else if (PG(html_errors)) { - php_error(type, "%s%s%s(%s) [<a href='%s%s%s'>%s</a>]: %s", class_name, space, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, docref, buffer); + php_error(type, "%s%s%s(%s) [<a href='%s%s%s'>%s</a>]: %s", class_name, space, function, params, docref_root, docref, docref_target, docref, buffer); } else { - php_error(type, "%s%s%s(%s) [%s%s%s]: %s", class_name, space, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, buffer); + php_error(type, "%s%s%s(%s) [%s%s%s]: %s", class_name, space, function, params, docref_root, docref, docref_target, buffer); } if (target) { efree(target); } } else { - docref = get_active_function_name(TSRMLS_C); - if (!docref) - docref = "Unknown"; - php_error(type, "%s%s%s(%s): %s ", class_name, space, docref, params, buffer); + php_error(type, "%s%s%s(%s): %s ", class_name, space, function, params, buffer); } if (PG(track_errors) && EG(active_symbol_table)) { @@ -536,7 +536,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c efree(docref_buf); } } else { - php_error(E_ERROR, "%s%s%s(%s): Out of memory", class_name, space, get_active_function_name(TSRMLS_C), params); + php_error(E_ERROR, "%s%s%s(%s): Out of memory", class_name, space, function, params); } } /* }}} */ @@ -576,8 +576,9 @@ PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, va_start(args, format); php_verror(docref, params ? params : "...", type, format, args TSRMLS_CC); va_end(args); - if (params) + if (params) { efree(params); + } } /* }}} */ |