MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001391XdebugDocumentationpublic2017-01-17 17:582017-12-02 16:19
Reportergaryamort 
Assigned Toderick 
PrioritylowSeveritytextReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version2.5.1Fixed in Version2.6.0alpha1 
Summary0001391: Add backtrack for xdebug_call_class and related functions
Descriptionxdebug_call_class, xdebug_call_file, and xdebug_call_function could be improved by allowing for an arguement to skip back a few steps.

IE instead of having to add calls at every point in every file where you want the caller info such as
  $callFile = xdebug_call_file();
  $callLine = xdebug_call_line();
  $callClass = xdebug_call_class();

An easier option would be to declare a single function:
function dumpCaller($i = 0) {
  $callFile = xdebug_call_file($i);
  $callLine = xdebug_call_line($i);
  echo "Called from $callLine in $callFile";
}


Allowing for multiple steps would allow using it in a code profiler, such as the common:

if {$profileFlag) {
  ProfileClass::start();
}

Then if the start method, a call to dumpCaller with an argument of 2 would allow a backstep into the actual callee to find the actual caller.
TagsNo tags attached.
Operating System
PHP Version7.1.0-7.1.4
Attached Files

- Relationships

-  Notes
(0004186)
derick (administrator)
2017-01-19 15:58

These three functions already support this argument, it looks like it's just not documented: https://github.com/xdebug/xdebug/blob/master/xdebug_stack.c#L917 [^]
(0004196)
derick (administrator)
2017-01-31 18:06

Fixed in the docs, with some code changes coming in 2.6.0dev as the implementation was mostly broken.

- Issue History
Date Modified Username Field Change
2017-01-17 17:58 garyamort New Issue
2017-01-19 15:58 derick Note Added: 0004186
2017-01-19 15:58 derick Severity minor => text
2017-01-19 15:58 derick Status new => confirmed
2017-01-19 15:58 derick Category Feature/Change request => Documentation
2017-01-19 15:58 derick Target Version => 2.5.1
2017-01-31 18:06 derick Note Added: 0004196
2017-01-31 18:06 derick Status confirmed => closed
2017-01-31 18:06 derick Assigned To => derick
2017-01-31 18:06 derick Resolution open => fixed
2017-01-31 18:06 derick Fixed in Version => 2.6.0dev
2017-12-02 16:19 derick Fixed in Version 2.6.0dev => 2.6.0alpha1


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker