Skip to content

Commit b85b31f

Browse files
committed
Merge branch 'xdebug_3_4'
2 parents a1aac79 + ab284c7 commit b85b31f

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

src/develop/stack.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -760,16 +760,14 @@ void xdebug_append_printable_stack(xdebug_str *str, int html)
760760
xdebug_str_add_literal(str, "...");
761761
}
762762

763-
if (fse->var[j].name) {
764-
if (html) {
765-
xdebug_str_add_literal(str, "<span>$");
766-
xdebug_str_add_zstr(str, fse->var[j].name);
767-
xdebug_str_add_literal(str, " = </span>");
768-
} else {
769-
xdebug_str_add_literal(str, "$");
770-
xdebug_str_add_zstr(str, fse->var[j].name);
771-
xdebug_str_add_literal(str, " = ");
772-
}
763+
if (fse->user_defined == XDEBUG_BUILT_IN && (fse->op_array->fn_flags & ZEND_ACC_USER_ARG_INFO) && fse->op_array->arg_info[j].name) {
764+
xdebug_str_add_const(str, html ? "<span>$" : "$");
765+
xdebug_str_add_zstr(str, fse->op_array->arg_info[j].name);
766+
xdebug_str_add_const(str, html ? " = </span>" : " = ");
767+
} else if (fse->var[j].name) {
768+
xdebug_str_add_const(str, html ? "<span>$" : "$");
769+
xdebug_str_add_zstr(str, fse->var[j].name);
770+
xdebug_str_add_const(str, html ? " = </span>" : " = ");
773771
}
774772

775773
if (!variadic_opened && fse->var[j].is_variadic && Z_ISUNDEF(fse->var[j].data)) {

tests/develop/bug02354.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Test for bug #2354: The __invoke frame in call stacks don't have the argument name in the trace (< PHP 8.2)
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../utils.inc';
6+
check_reqs('PHP < 8.1');
7+
?>
8+
--INI--
9+
xdebug.mode=develop
10+
--FILE--
11+
<?php
12+
class RedisProxy {
13+
function __construct(public Closure $c)
14+
{
15+
}
16+
17+
function __call($method, $args)
18+
{
19+
$this->c->__invoke($args);
20+
}
21+
}
22+
23+
$c = function(array $args)
24+
{
25+
throw new Exception();
26+
};
27+
28+
$rp = new RedisProxy($c);
29+
$rp->isConnected();
30+
?>
31+
--EXPECTF--
32+
%A
33+
%w%f %w%d %d. Closure->__invoke($args = []) %sbug02354.php:9
34+
%A

0 commit comments

Comments
 (0)