Re: Colored + readable error messages - corrected patch
| From: | Stefan Walk | Date: | Sat, 12 Jul 2003 10:59:56 +0000 |
| Subject: | Re: Colored + readable error messages - corrected patch | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3381@lists.php.net to get a copy of this message | ||
Hi!
There were some whitespace errors in the patch i sent, i corrected those
and made the error messages more readable.
Stefan
--
Regards,
Stefan Walk
<swalk@prp0.prp.physik.tu-darmstadt.de>
Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.560 diff -u -r1.560 main.c --- main/main.c 17 Jun 2003 17:15:02 -0000 1.560 +++ main/main.c 12 Jul 2003 10:54:46 -0000 @@ -659,6 +659,7 @@ if (display && (EG(error_reporting) & type || (type & E_CORE)) && (PG(log_errors) || PG(display_errors) || (!module_initialized))) { char *error_type_str; + char *error_color_str; switch (type) { case E_ERROR: @@ -666,22 +667,27 @@ case E_COMPILE_ERROR: case E_USER_ERROR: error_type_str = "Fatal error"; + error_color_str = "#fbb"; break; case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: error_type_str = "Warning"; + error_color_str = "#bbf"; break; case E_PARSE: error_type_str = "Parse error"; + error_color_str = "#fff"; break; case E_NOTICE: case E_USER_NOTICE: error_type_str = "Notice"; + error_color_str = "#bfb"; break; default: error_type_str = "Unknown error"; + error_color_str = "#fff"; break; } @@ -705,10 +711,13 @@ } else { char *prepend_string = INI_STR("error_prepend_string"); char *append_string = INI_STR("error_append_string"); - char *error_format = PG(html_errors) ? - "%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s" - : "%s\n%s: %s in %s on line %d\n%s"; - php_printf(error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + if (PG(html_errors)) { + char *error_format = "%s\n<div style='border:1px solid black;background-color:%s;color:#000;margin:2px;padding:2px;font-family:verdana,arial,helvetica,sans-serif;font-size:12px;'><b>%s</b>: %s in <b>%s</b> on line <b>%d</b></div>\n%s"; + php_printf(error_format, STR_PRINT(prepend_string), error_color_str, error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + } else { + char *error_format = "%s\n%s: %s in %s on line %d\n%s"; + php_printf(error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + } } } #if ZEND_DEBUG
Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.560 diff -u -r1.560 main.c --- main/main.c 17 Jun 2003 17:15:02 -0000 1.560 +++ main/main.c 12 Jul 2003 10:54:46 -0000 @@ -659,6 +659,7 @@ if (display && (EG(error_reporting) & type || (type & E_CORE)) && (PG(log_errors) || PG(display_errors) || (!module_initialized))) { char *error_type_str; + char *error_color_str; switch (type) { case E_ERROR: @@ -666,22 +667,27 @@ case E_COMPILE_ERROR: case E_USER_ERROR: error_type_str = "Fatal error"; + error_color_str = "#fbb"; break; case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: error_type_str = "Warning"; + error_color_str = "#bbf"; break; case E_PARSE: error_type_str = "Parse error"; + error_color_str = "#fff"; break; case E_NOTICE: case E_USER_NOTICE: error_type_str = "Notice"; + error_color_str = "#bfb"; break; default: error_type_str = "Unknown error"; + error_color_str = "#fff"; break; } @@ -705,10 +711,13 @@ } else { char *prepend_string = INI_STR("error_prepend_string"); char *append_string = INI_STR("error_append_string"); - char *error_format = PG(html_errors) ? - "%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s" - : "%s\n%s: %s in %s on line %d\n%s"; - php_printf(error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + if (PG(html_errors)) { + char *error_format = "%s\n<div style='border:1px solid black;background-color:%s;color:#000;margin:2px;padding:2px;font-family:verdana,arial,helvetica,sans-serif;font-size:12px;'><b>%s</b>: %s in <b>%s</b> on line <b>%d</b></div>\n%s"; + php_printf(error_format, STR_PRINT(prepend_string), error_color_str, error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + } else { + char *error_format = "%s\n%s: %s in %s on line %d\n%s"; + php_printf(error_format, STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); + } } } #if ZEND_DEBUG