cvs: php4 / php.ini-dist php.ini-recommended /main main.c php_globals.h

From: Date: Wed, 10 Apr 2002 01:27:45 +0000
Subject: cvs: php4 / php.ini-dist php.ini-recommended /main main.c php_globals.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10992@lists.php.net to get a copy of this message
helly Tue Apr 9 21:27:45 2002 EDT Modified files: /php4/main main.c php_globals.h /php4 php.ini-dist php.ini-recommended Log: new ini setting log_errors_max_len @-New ini setting log_errors_max_len controls maximum length for error @ messages. Set it to 0 for infinite. Default is 1024 (old behaviour) (Marcus) Index: php4/main/main.c diff -u php4/main/main.c:1.442 php4/main/main.c:1.443 --- php4/main/main.c:1.442 Mon Apr 8 03:58:47 2002 +++ php4/main/main.c Tue Apr 9 21:27:44 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.442 2002/04/08 07:58:47 sniper Exp $ */ +/* $Id: main.c,v 1.443 2002/04/10 01:27:44 helly Exp $ */ /* {{{ includes */ @@ -235,6 +235,7 @@ 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) + STD_PHP_INI_ENTRY("log_errors_max_len", "1024", PHP_INI_ALL, OnUpdateInt, log_errors_max_len, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_errors", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals) @@ -420,15 +421,11 @@ extended error handling function */ static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) { - char buffer[ERROR_BUF_LEN]; + char *buffer; int buffer_len, display; TSRMLS_FETCH(); - buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args); - buffer[sizeof(buffer)-1]=0; - if(buffer_len > sizeof(buffer) - 1 || buffer_len < 0) { - buffer_len = sizeof(buffer) - 1; - } + buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); if (PG(ignore_repeated_errors)) { if (strncmp(last_error.buf, buffer, sizeof(last_error.buf)) || (!PG(ignore_repeated_source) @@ -476,15 +473,16 @@ } if (!module_initialized || PG(log_errors)) { - char log_buffer[ERROR_BUF_LEN]; + char *log_buffer; #ifdef PHP_WIN32 if (type==E_CORE_ERROR || type==E_CORE_WARNING) { MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE); } #endif - snprintf(log_buffer, ERROR_BUF_LEN, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); + spprintf(&log_buffer, 0, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno); php_log_err(log_buffer TSRMLS_CC); + efree(log_buffer); } if (module_initialized && PG(display_errors) && (!PG(during_request_startup) || PG(display_startup_errors))) { @@ -547,13 +545,17 @@ case E_USER_ERROR: if (module_initialized) { zend_bailout(); + efree(buffer); return; } break; } /* Log if necessary */ - if (!display) return; + if (!display) { + efree(buffer); + return; + } if (PG(track_errors) && EG(active_symbol_table)) { pval *tmp; @@ -564,6 +566,7 @@ 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); } /* }}} */ Index: php4/main/php_globals.h diff -u php4/main/php_globals.h:1.76 php4/main/php_globals.h:1.77 --- php4/main/php_globals.h:1.76 Sat Apr 6 13:49:59 2002 +++ php4/main/php_globals.h Tue Apr 9 21:27:44 2002 @@ -76,6 +76,7 @@ zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; + int log_errors_max_len; zend_bool ignore_repeated_errors; zend_bool ignore_repeated_source; char *error_log; Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.119 php4/php.ini-dist:1.120 --- php4/php.ini-dist:1.119 Sun Apr 7 13:46:56 2002 +++ php4/php.ini-dist Tue Apr 9 21:27:44 2002 @@ -257,6 +257,10 @@ ; error displaying on production web sites. log_errors = Off +; Set maximum length of log_errors. In error_log information about the source is +; added. The default is 1024 and 0 allows to not apply any maximum length at all. +log_errors_max_len = 1024 + ; Do not log repeated messages. Repeated errors must occur in same file on same ; line until ignore_repeated_source is set true. ignore_repeated_errors = Off Index: php4/php.ini-recommended diff -u php4/php.ini-recommended:1.72 php4/php.ini-recommended:1.73 --- php4/php.ini-recommended:1.72 Sun Apr 7 13:46:57 2002 +++ php4/php.ini-recommended Tue Apr 9 21:27:44 2002 @@ -262,6 +262,10 @@ ; error displaying on production web sites. log_errors = On +; Set maximum length of log_errors. In error_log information about the source is +; added. The default is 1024 and 0 allows to not apply any maximum length at all. +log_errors_max_len = 1024 + ; Do not log repeated messages. Repeated errors must occur in same file on same ; line until ignore_repeated_source is set true. ignore_repeated_errors = Off

« previous php.cvs (#10992) next »