Skip to content

Commit

Permalink
rename error_backtrace global to fatal_error_backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnorris committed Jan 13, 2025
1 parent 4db32ac commit ebe1983
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static ZEND_INI_MH(OnUpdateFiberStackSize) /* {{{ */

ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
STD_ZEND_INI_BOOLEAN("fatal_error_backtraces", "1", ZEND_INI_ALL, OnUpdateBool, fatal_error_backtraces, zend_executor_globals, executor_globals)
STD_ZEND_INI_BOOLEAN("fatal_error_backtraces", "1", ZEND_INI_ALL, OnUpdateBool, fatal_error_backtrace_on, zend_executor_globals, executor_globals)
STD_ZEND_INI_ENTRY("zend.assertions", "1", ZEND_INI_ALL, OnUpdateAssertions, assertions, zend_executor_globals, executor_globals)
ZEND_INI_ENTRY3_EX("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, NULL, NULL, NULL, zend_gc_enabled_displayer_cb)
STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals)
Expand Down Expand Up @@ -1465,8 +1465,8 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
}

// Always clear the last backtrace.
zval_ptr_dtor(&EG(error_backtrace));
ZVAL_UNDEF(&EG(error_backtrace));
zval_ptr_dtor(&EG(fatal_error_backtrace));
ZVAL_UNDEF(&EG(fatal_error_backtrace));

/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
Expand All @@ -1489,8 +1489,8 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
ex->opline = opline;
}
}
} else if (EG(fatal_error_backtraces) && (type & E_FATAL_ERRORS)) {
zend_fetch_debug_backtrace(&EG(error_backtrace), 0, EG(exception_ignore_args) ? DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
} else if (EG(fatal_error_backtrace_on) && (type & E_FATAL_ERRORS)) {
zend_fetch_debug_backtrace(&EG(fatal_error_backtrace), 0, EG(exception_ignore_args) ? DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
}

zend_observer_error_notify(type, error_filename, error_lineno, message);
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,8 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit
ce_exception = ex->ce;
EG(exception) = NULL;

zval_ptr_dtor(&EG(error_backtrace));
ZVAL_UNDEF(&EG(error_backtrace));
zval_ptr_dtor(&EG(fatal_error_backtrace));
ZVAL_UNDEF(&EG(fatal_error_backtrace));

if (ce_exception == zend_ce_parse_error || ce_exception == zend_ce_compile_error) {
zend_string *message = zval_get_string(GET_PROPERTY(&exception, ZEND_STR_MESSAGE));
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void init_executor(void) /* {{{ */
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
#endif

ZVAL_UNDEF(&EG(error_backtrace));
ZVAL_UNDEF(&EG(fatal_error_backtrace));

EG(symtable_cache_ptr) = EG(symtable_cache);
EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE;
Expand Down Expand Up @@ -309,8 +309,8 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
} ZEND_HASH_MAP_FOREACH_END_DEL();
}

zval_ptr_dtor(&EG(error_backtrace));
ZVAL_UNDEF(&EG(error_backtrace));
zval_ptr_dtor(&EG(fatal_error_backtrace));
ZVAL_UNDEF(&EG(fatal_error_backtrace));

/* Release static properties and static variables prior to the final GC run,
* as they may hold GC roots. */
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ struct _zend_executor_globals {

int error_reporting;

bool fatal_error_backtraces;
zval error_backtrace;
bool fatal_error_backtrace_on;
zval fatal_error_backtrace;

int exit_status;

Expand Down
8 changes: 4 additions & 4 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,8 @@ PHP_FUNCTION(error_get_last)
ZVAL_LONG(&tmp, PG(last_error_lineno));
zend_hash_update(Z_ARR_P(return_value), ZSTR_KNOWN(ZEND_STR_LINE), &tmp);

if (!Z_ISUNDEF(EG(error_backtrace))) {
ZVAL_COPY(&tmp, &EG(error_backtrace));
if (!Z_ISUNDEF(EG(fatal_error_backtrace))) {
ZVAL_COPY(&tmp, &EG(fatal_error_backtrace));
zend_hash_update(Z_ARR_P(return_value), ZSTR_KNOWN(ZEND_STR_TRACE), &tmp);
}
}
Expand All @@ -1463,8 +1463,8 @@ PHP_FUNCTION(error_clear_last)
}
}

zval_ptr_dtor(&EG(error_backtrace));
ZVAL_UNDEF(&EG(error_backtrace));
zval_ptr_dtor(&EG(fatal_error_backtrace));
ZVAL_UNDEF(&EG(fatal_error_backtrace));
}
/* }}} */

Expand Down
4 changes: 2 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,8 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c
}
}

if (!Z_ISUNDEF(EG(error_backtrace))) {
backtrace = zend_trace_to_string(Z_ARRVAL(EG(error_backtrace)), /* include_main */ true);
if (!Z_ISUNDEF(EG(fatal_error_backtrace))) {
backtrace = zend_trace_to_string(Z_ARRVAL(EG(fatal_error_backtrace)), /* include_main */ true);
}

/* store the error if it has changed */
Expand Down

0 comments on commit ebe1983

Please sign in to comment.