diff options
Diffstat (limited to 'main/main.c')
-rw-r--r-- | main/main.c | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/main/main.c b/main/main.c index 5c81ea046d..d24021a1fd 100644 --- a/main/main.c +++ b/main/main.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -731,7 +729,7 @@ PHP_INI_BEGIN() PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode) - STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("display_startup_errors", "1", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, 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_ENTRY("docref_root", "", PHP_INI_ALL, OnUpdateString, docref_root, php_core_globals, core_globals) @@ -753,7 +751,6 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals) - STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals) @@ -1117,18 +1114,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ efree(docref_buf); } - if (PG(track_errors) && module_initialized && EG(active) && - (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) { - zval tmp; - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } if (replace_buffer) { zend_string_free(replace_buffer); } else { @@ -1207,10 +1192,11 @@ PHPAPI void php_html_puts(const char *str, size_t size) /* {{{ php_error_cb extended error handling function */ -static ZEND_COLD void php_error_cb(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) +static ZEND_COLD void php_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) { char *buffer; int buffer_len, display; + int type = orig_type & E_ALL; buffer_len = (int)vspprintf(&buffer, PG(log_errors_max_len), format, args); @@ -1418,7 +1404,7 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u sapi_header_op(SAPI_HEADER_REPLACE, &ctr); } /* the parser would return 1 (failure), we can bail out nicely */ - if (type != E_PARSE) { + if (!(orig_type & E_DONT_BAIL)) { /* restore memory limit */ zend_set_memory_limit(PG(memory_limit)); efree(buffer); @@ -1430,25 +1416,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u break; } - /* Log if necessary */ - if (!display) { - efree(buffer); - return; - } - - if (PG(track_errors) && module_initialized && EG(active)) { - zval tmp; - - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } - efree(buffer); } /* }}} */ @@ -2365,13 +2332,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod struct { const long error_level; const char *phrase; - const char *directives[17]; /* Remember to change this if the number of directives change */ + const char *directives[18]; /* Remember to change this if the number of directives change */ } directives[2] = { { E_DEPRECATED, "Directive '%s' is deprecated", { - "track_errors", "allow_url_include", NULL } @@ -2396,6 +2362,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod "safe_mode_allowed_env_vars", "safe_mode_protected_env_vars", "zend.ze1_compatibility_mode", + "track_errors", NULL } } |