Commit 6085501b944 for php
commit 6085501b9444ffdd7e06abd702d6c892cf2852fc
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Wed Nov 25 20:54:12 2026 -0800
`zend_fetch_debug_backtrace`: use `bool` for `skip_last` (#25685)
diff --git a/Zend/zend.c b/Zend/zend.c
index 560a365318d..3b68f63674b 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 2f37007f4be..f570c809528 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 018d0cdb1c1..8dfa330485c 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 b5ccb74d7df..d39e58542ba 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 bbe805a8147..e6023bdbcf6 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 fdab924638e..3e1dc6e38d6 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;