Web lists-archives.com

Re: [PHP] Caller/called graph




Thank you.

That (debug_backtrace?) requires executing the code being analyzed, right? I want something that can be used without executing it. For one thing, executions usually don't execute all possible paths.

I will look at PhpStorm, Blackfire.io, phpCallGraph and others later.

Narcis Garcia <mailto:informatica@xxxxxxxxx>
Thursday, September 29, 2016 12:31 AM
I use this:


function DebugBackTraceHtml()

// Returns an HTML string with calls and subcalls until the current execution.

{

$HtmlValue = '';

$HtmlValue = $HtmlValue.'<p>DEBUG backtrace:</p>'."\n";

$StepNr = 1;

while (isset(debug_backtrace()[$StepNr])) {

$HtmlValue = $HtmlValue.'<p>['.$StepNr.'] File '.debug_backtrace()[$StepNr]['file'].' at line '.debug_backtrace()[$StepNr]['line'].' executing: <strong>'.debug_backtrace()[$StepNr]['function'].'</strong></p>'."\n";

$StepNr = $StepNr + 1;

}

return $HtmlValue;

}






Sam Hobbs <mailto:Sam@xxxxxxxxxxxxxxxxxx>
Wednesday, September 28, 2016 8:32 PM
If I am using an editor such as Eclipse to analyze a large PHP system and I want to find the file that a function is declared in then I can search for it. I think that the (right-click) context menu for the function sometimes has an item to open the declaration but that does not always work. The same for an include statement; even if I don't know what the path will be during execution and even if the source is in multiple folders, I can search for the file. For large systems however all that can take time (my time).

Is there a tool that can process thousands (at least a couple thousand) files and produce data of what file that a called function exists in and where a function is called from? In other words, caller/called data. I understand the technical challenges. In PHP includes are processed during execution so I know it might not be possible but I am asking if there is anything that can do it as much as possible.

I searched the mailing list for "caller called" and found nothing, I apologize if this has been asked before.