]> granicus.if.org Git - php/commitdiff
Added "html_errors" directive to optionally disable HTML formatting of error
authorStig Bakken <ssb@php.net>
Tue, 4 Jul 2000 09:15:06 +0000 (09:15 +0000)
committerStig Bakken <ssb@php.net>
Tue, 4 Jul 2000 09:15:06 +0000 (09:15 +0000)
messages.  The default is on. (Stig)

main/main.c
main/php_globals.h

index 2cc9dcfac8129cce83860c4cd32c160877c93cbf..cf43c3e6c2a2910e8743f6ea6dc703e5bcba0c2e 100644 (file)
@@ -212,6 +212,7 @@ PHP_INI_BEGIN()
        STD_PHP_INI_BOOLEAN("error_append_string",      NULL,           PHP_INI_ALL,            OnUpdateString,                 error_append_string,    php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("error_prepend_string",     NULL,           PHP_INI_ALL,            OnUpdateString,                 error_prepend_string,   php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("expose_php",                       "1",            PHP_INI_SYSTEM,         OnUpdateBool,                   expose_php,                             php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("html_errors",                      "1",            PHP_INI_SYSTEM,         OnUpdateBool,                   html_errors,                    php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("ignore_user_abort",        "0",            PHP_INI_ALL,            OnUpdateBool,                   ignore_user_abort,              php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("implicit_flush",           "0",            PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool,     implicit_flush,                 php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("log_errors",                       "0",            PHP_INI_ALL,            OnUpdateBool,                   log_errors,                             php_core_globals,       core_globals)
@@ -334,7 +335,6 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
        ELS_FETCH();
        PLS_FETCH();
 
-               
        if (EG(error_reporting) & type || (type & E_CORE)) {
                char *error_type_str;
 
@@ -386,11 +386,17 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
                        if (module_initialized && PG(display_errors)) {
                                char *prepend_string = INI_STR("error_prepend_string");
                                char *append_string = INI_STR("error_append_string");
+                               char *error_format;
+
+                               error_format = PG(html_errors) ?
+                                       "<br>\n<b>%s</b>:  %s in <b>%s</b> on line <b>%d</b><br>\n"
+                                       : "\n%s: %s in %s on line %d\n";
 
                                if (prepend_string) {
                                        PUTS(prepend_string);
                                }
-                               php_printf("<br>\n<b>%s</b>:  %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno);
+                               php_printf(error_format, error_type_str, buffer,
+                                                  error_filename, error_lineno);
                                if (append_string) {
                                        PUTS(append_string);
                                }
index ea0e3e511ba62395dbcc0ca1a9b358d6a28e8b87..2b3032ba334e4d8776a3fc637a4a4e10aacfa8b2 100644 (file)
@@ -111,6 +111,8 @@ struct _php_core_globals {
 
        zend_bool y2k_compliance;
 
+       zend_bool html_errors;
+
        zend_bool modules_activated;
 };