View Issue Details

IDProjectCategoryView StatusLast Update
0001571XdebugUncategorizedpublic2019-01-22 21:58
Reporterderick Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.6.1 
Target Version2.7.0rc1Fixed in Version2.7.0rc1 
Summary0001571: File/line information is not shown for closures in namespaces
Description

When making stack traces and for code coverage, we try to add the file/line numbers to the name of the "closure" so that's a bit more like a useful function name. When a closure is created in a namespace, the check fails, as we do an equivalence check of the name "{closure}", where we should check whether the function name ends with "{closure}. This is done in both xdebug_code_coverage.c and xdebug_stack.c

Steps To Reproduce

derick@singlemalt:~ $ php -dxdebug.overload_var_dump=0 -d display_errors=1 -d display_startup_errors=1 -d error_reporting=E_ALL -d xdebug.auto_trace=1 -d xdebug.trace_format=0 -d xdebug.trace_options=0 -d xdebug.collect_params=1 -d xdebug.collect_return=1 -d xdebug.trace_output_dir=/tmp -d xdebug.trace_output_name=trace /tmp/518-ns.php

<pre>
derick@singlemalt:~ $ cat /tmp/trace.xt
TRACE START [2018-08-14 10:17:03]
0.0002 425552 -> {main}() /tmp/518-ns.php:0
0.0002 425936 -> call_user_func:{/tmp/518-ns.php:8}(class Closure, long, class Closure) /tmp/518-ns.php:8
0.0002 425936 -> A{closure}(long, class Closure) /tmp/518-ns.php:8
0.0002 425936 >=> NULL
0.0002 425936 >=> NULL
0.0003 50032
TRACE END [2018-08-14 10:17:03]
</pre>

<pre>
derick@singlemalt:~ $ cat /tmp/518-ns.php
<?php

namespace A;

$a = function(){

};
call_user_func($a, 1, $a);
</pre>

TagsNo tags attached.
Operating System
PHP Version7.2.0-7.2.4

Activities

derick

2018-09-20 07:41

administrator   ~0004699

There is a branch already.

derick

2018-10-18 23:53

administrator   ~0004706

Fixed for Xdebug 2.7.0beta2.

Issue History

Date Modified Username Field Change
2018-08-14 10:18 derick New Issue
2018-08-14 10:18 derick Status new => assigned
2018-08-14 10:18 derick Assigned To => derick
2018-08-14 20:16 derick Steps to Reproduce Updated
2018-09-20 07:41 derick Note Added: 0004699
2018-09-20 07:41 derick Target Version 2.6.2 => 2.7.0dev
2018-10-18 23:43 derick Summary Stack traces don't show file/line for closures in namespaces => File/line information is not shown for closures in namespaces
2018-10-18 23:53 derick Note Added: 0004706
2018-10-18 23:53 derick Status assigned => closed
2018-10-18 23:53 derick Resolution open => fixed
2018-10-18 23:53 derick Fixed in Version => 2.7.0dev
2019-01-22 21:54 derick Fixed in Version 2.7.0dev => 2.7.0rc1
2019-01-22 21:58 derick Target Version 2.7.0dev => 2.7.0rc1
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized