[php-src] master: `zend_fetch_debug_backtrace`: use `bool` for `skip_last` (#25685)
| From: | Daniel Scherzer via GitHub | Date: | Thu, 26 Nov 2026 04:54:16 +0000 |
| Subject: | [php-src] master: `zend_fetch_debug_backtrace`: use `bool` for `skip_last` (#25685) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144199@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Committer: GitHub (web-flow)
Pusher: DanielEScherzer
Date: 2026-11-25T20:54:12-08:00
Commit: https://github.com/php/php-src/commit/6085501b9444ffdd7e06abd702d6c892cf2852fc
Raw diff: https://github.com/php/php-src/commit/6085501b9444ffdd7e06abd702d6c892cf2852fc.diff
zend_fetch_debug_backtrace: use bool for skip_last (#25685)
Changed paths:
M Zend/zend.c
M Zend/zend_builtin_functions.c
M Zend/zend_builtin_functions.h
M Zend/zend_exceptions.c
M ext/reflection/php_reflection.c
M sapi/phpdbg/phpdbg_frame.c
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index 560a365318de..3b68f63674bb 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1543,7 +1543,7 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
// EG(last_fatal_error_backtrace) is useless when the executor is
// inactive, and setting it at this point would leak.
if (EG(active)) {
- zend_fetch_debug_backtrace(&EG(last_fatal_error_backtrace), 0, EG(exception_ignore_args) ?
DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
+ zend_fetch_debug_backtrace(&EG(last_fatal_error_backtrace), false, EG(exception_ignore_args)
? DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
}
}
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 2f37007f4be4..f570c8095280 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1904,7 +1904,7 @@ ZEND_FUNCTION(debug_print_backtrace)
RETURN_THROWS();
}
- zend_fetch_debug_backtrace(&backtrace, 1, options, limit);
+ zend_fetch_debug_backtrace(&backtrace, true, options, limit);
ZEND_ASSERT(Z_TYPE(backtrace) == IS_ARRAY);
zend_string *str = zend_trace_to_string(Z_ARRVAL(backtrace), /* include_main */ false);
@@ -1915,7 +1915,7 @@ ZEND_FUNCTION(debug_print_backtrace)
/* }}} */
-ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit)
/* {{{ */
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value, bool skip_last, int options, int
limit) /* {{{ */
{
zend_execute_data *call, *last_call = NULL;
zend_object *object;
@@ -2257,7 +2257,7 @@ ZEND_FUNCTION(debug_backtrace)
RETURN_THROWS();
}
- zend_fetch_debug_backtrace(return_value, 1, options, limit);
+ zend_fetch_debug_backtrace(return_value, true, options, limit);
}
/* }}} */
diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h
index 018d0cdb1c1d..8dfa330485cd 100644
--- a/Zend/zend_builtin_functions.h
+++ b/Zend/zend_builtin_functions.h
@@ -26,7 +26,7 @@ typedef struct _zval_struct zval;
zend_result zend_startup_builtin_functions(void);
BEGIN_EXTERN_C()
-ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int
limit);
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value, bool skip_last, int options, int
limit);
END_EXTERN_C()
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index b5ccb74d7df7..d39e58542ba9 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -268,7 +268,7 @@ static zend_object *zend_default_exception_new(zend_class_entry *class_type) /*
if (EG(current_execute_data)) {
zend_fetch_debug_backtrace(&trace,
- 0,
+ false,
EG(exception_ignore_args) ? DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
} else {
ZVAL_EMPTY_ARRAY(&trace);
@@ -656,7 +656,7 @@ ZEND_API zend_string *zend_trace_current_function_args_string(void) {
/* get a backtrace to snarf function args */
zval backtrace;
- zend_fetch_debug_backtrace(&backtrace, /* skip_last */ 0, /* options */ 0, /* limit */ 1);
+ zend_fetch_debug_backtrace(&backtrace, /* skip_last */ false, /* options */ 0, /* limit */ 1);
/* can fail esp if low memory condition */
if (Z_TYPE(backtrace) == IS_ARRAY) {
zval *first_frame = zend_hash_index_find(Z_ARRVAL(backtrace), 0);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index bbe805a81479..e6023bdbcf6b 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2297,7 +2297,7 @@ ZEND_METHOD(ReflectionGenerator, getTrace)
}
EG(current_execute_data) = root_generator->execute_data;
- zend_fetch_debug_backtrace(return_value, 0, options, 0);
+ zend_fetch_debug_backtrace(return_value, false, options, 0);
EG(current_execute_data) = ex_backup;
root_generator->execute_data->prev_execute_data = root_prev;
@@ -7878,7 +7878,7 @@ ZEND_METHOD(ReflectionFiber, getTrace)
EG(current_execute_data) = fiber->execute_data;
}
- zend_fetch_debug_backtrace(return_value, 0, options, 0);
+ zend_fetch_debug_backtrace(return_value, false, options, 0);
EG(current_execute_data) = execute_data; // Restore original execute data.
fiber->stack_bottom->prev_execute_data = prev_execute_data; // Restore prev execute data on
fiber stack.
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index fdab924638ea..3e1dc6e38d63 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.c
@@ -259,7 +259,7 @@ void phpdbg_dump_backtrace(size_t num) /* {{{ */
}
phpdbg_try_access {
- zend_fetch_debug_backtrace(&zbacktrace, 0, 0, limit);
+ zend_fetch_debug_backtrace(&zbacktrace, false, 0, limit);
} phpdbg_catch_access {
phpdbg_error("Couldn't fetch backtrace, invalid data source");
return;