[TASK] Enable output of file names in DebugUtility::debugTrail 45/47545/4
authorDaniel Goerz <ervaude@gmail.com>
Fri, 8 Apr 2016 09:19:33 +0000 (11:19 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 13 Apr 2016 08:09:13 +0000 (10:09 +0200)
Change-Id: Ib6593d02955c1313ae16f9cef5fad683cb4738c5
Resolves: #19262
Releases: master
Reviewed-on: https://review.typo3.org/47545
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/core/Classes/Utility/DebugUtility.php

index eea7db9..b85ee47 100644 (file)
@@ -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']);