Skip to content
Snippets Groups Projects
Commit a21f7f38 authored by Daniel Goerz's avatar Daniel Goerz Committed by Frank Naegler
Browse files

[TASK] Enable output of file names in DebugUtility::debugTrail

Change-Id: Ib6593d02955c1313ae16f9cef5fad683cb4738c5
Resolves: #19262
Releases: master
Reviewed-on: https://review.typo3.org/47545


Reviewed-by: default avatarSusanne Moog <typo3@susannemoog.de>
Tested-by: default avatarSusanne Moog <typo3@susannemoog.de>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent f862c3ff
Branches
Tags
No related merge requests found
......@@ -128,16 +128,18 @@ class DebugUtility
/**
* Displays the "path" of the function call stack in a string, using debug_backtrace
*
* @param bool $prependFileNames If set to true file names are added to the output
* @return string
*/
public static function debugTrail()
public static function debugTrail($prependFileNames = false)
{
$trail = debug_backtrace(0);
$trail = array_reverse($trail);
array_pop($trail);
$path = array();
foreach ($trail as $dat) {
$pathFragment = $dat['class'] . $dat['type'] . $dat['function'];
$fileInformation = $prependFileNames && !empty($dat['file']) ? $dat['file'] . ':' : '';
$pathFragment = $fileInformation . $dat['class'] . $dat['type'] . $dat['function'];
// add the path of the included file
if (in_array($dat['function'], array('require', 'include', 'require_once', 'include_once'))) {
$pathFragment .= '(' . PathUtility::stripPathSitePrefix($dat['args'][0]) . '),' . PathUtility::stripPathSitePrefix($dat['file']);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment