Download & Extend

subdomains in path causes incorrect link URL

Project:Visualize Backtrace
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:needs review

Issue Summary

first of all, awesome module. Thanks for creating it.

The issue is that if the path to the drupal installation is of a subdomain and it exists in the full path then this causes visual backtrace to select the wrong $current_trace_number for the menu link "Generate Backtrace Data for this Page Load"

if the full path to the drupal installation is
/var/www/vhosts/username/module.mysite.com/httpdocs/

and the trace.12345647.xt files are stored at:
/var/www/vhosts/username/module.mysite.com/logs/xdebug/trace/trace.1234567.xt

then inside the function visualize_backtrace_block (module visualize_backtrace.module line 148) the system for detecting the location of the link
[code] // Get the trace log number by striping out number from /tmp/trace.####.xt file.
$current_trace_number = explode('.', xdebug_get_tracefile_name());
$current_trace_number = $current_trace_number[1];[/code]

the $current_trace_number[1] causes the link to pick the name of the site 'mysite' instead of the timestamp '1234567' as the link location.

This causes the link to fail.

Suggestion for the code:
[code] // Get the trace log number by striping out number from /tmp/trace.####.xt file.
$_file_name = explode('/', xdebug_get_tracefile_name());
$_file_name = array_pop($_file_name);
$current_trace_number = explode('.', $_file_name);
$current_trace_number = $current_trace_number[1];[/code]

get the filename by its location at the end of the path first to avoid this issue.