95768[TASK] Add caller file and line to DebugUtility::debug()
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Radostin Milenov +1
-
Verified V +2 Done
- Garvin Hicking +2
- Radostin Milenov +1
- core-ci +1 CI
Issues 1
Files 2
Review log 2736
Show 711 earlier messages
-
Alexander Hofbauer uploaded patch set 1 09/11/26, 10:24
-
core-ci voted on patch set 1 V +1 09/11/26, 10:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108293
-
Garvin Hicking commented on patch set 1 09/11/26, 11:14
I like this, thanks! We might even want to backport this to v14, and it would help to easier remove stray debugs left in code. However: 1. We should remove the minor breaking change, and not change the signature of debug(). 2. I talked to this with Tobias Gülzow and he recommended a nice idea out of the problem "how else do we append the file location then": We could just append the file name to any header output always: ``` public static function debug(mixed $var = '', string header = 'Debug'): void { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); $caller = $backtrace[0] ?? null; if ($caller !== null) { $header .= ' @ ' . ($caller['file'] ?? 'unknown') . ':' . ($caller['line'] ?? '?'); } ``` What do you think? -
Alexander Hofbauer commented on patch set 1 09/11/26, 11:27
I think it might get a little cluttered then, but I like the idea in general. Is there a way to resolve the absolute filesystem path from @$caller['file']@ to a path relative to the typo3 root path? That would shorten the filepath and be equally helpful when working with multiple debug statements. I thought about this before creating the patch, but wanted to keep the debug method as dependency free as possible to keep it as robust as possible. But shortening the path would probably not reduce stability. What do you think? -
Garvin Hicking commented on patch set 1 09/11/26, 11:36
Reply
I thought about that too but think a debugging output will probably already clutter something? But if that is worrysome we could only append this in case the title is "Debug" (the default string). You can fetch the base directory from `TYPO3\CMS\Core\Core\Environment::getProjectPath()` and then do some substring replace magic at the beginning of the string if you want to shorten... -
Alexander Hofbauer uploaded patch set 2
V +109/11/26, 12:03 -
Alexander Hofbauer uploaded patch set 3 09/11/26, 12:04
-
core-ci voted on patch set 2 V -1 09/11/26, 12:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108295
-
core-ci voted on patch set 3 V -1 09/11/26, 12:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108296
-
Alexander Hofbauer uploaded patch set 4
V -109/11/26, 12:19 -
core-ci voted on patch set 4 V +1 09/11/26, 12:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108297
-
Garvin Hicking commented on patch set 4 09/11/26, 12:36
DebugUtility.php:43I think this string replacement logic could be buggy. If a PHP file is outside the project path (could happen) then the path would be cut seemingly random. Instead I would do a `substr_replace` logic with `0, strlen(...)` of the project path to be safe, so thhat a "/tmp/file.php" would really return "/tmp/file.php" instead of "e.php" for example -
Alexander Hofbauer uploaded patch set 5
V +109/11/26, 13:13 -
core-ci voted on patch set 5 V -1 09/11/26, 13:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108300
-
Alexander Hofbauer uploaded patch set 6
V -109/11/26, 14:20 -
core-ci voted on patch set 6 V -1 09/11/26, 14:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108302
-
Alexander Hofbauer uploaded patch set 7
V -109/11/26, 14:56 -
core-ci voted on patch set 7 V +1 09/11/26, 15:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108303
-
Garvin Hicking commented on patch set 7 V +1 09/11/26, 21:56
Reply
DoneReply
DoneDebugUtility.php:43ReplyThanks for adapting! Could you uodate the commit message to reflect the current variant and let's add 14.3 as a scope for the "Releases" line, Id be happy to have that in 14.3 as an improvement already. -
Radostin Milenov updated the commit message in patch set 8
V +109/13/26, 13:48 -
Radostin Milenov commented on patch set 8 CR +1 V +1 09/13/26, 13:49
DebugUtility.php:43ReplyDone -
core-ci voted on patch set 8 V +1 09/13/26, 13:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108452
-
Garvin Hicking commented on patch set 8 09/13/26, 19:56
DebugUtility.php:43ReplyThe commit message does not yet reflect the actual change -
Radostin Milenov updated the commit message in patch set 9
CR +1V +109/14/26, 02:56 -
Radostin Milenov commented on patch set 9 09/14/26, 02:57
DebugUtility.php:43ReplyIndeed missed that. Is it clear enought now ? -
core-ci voted on patch set 9 V +1 09/14/26, 03:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108471
-
Garvin Hicking commented on patch set 9 CR +1 V +1 09/14/26, 07:27
DebugUtility.php:43ReplyGreat, thanks! -
Alexander Hofbauer commented on patch set 9 09/14/26, 15:52
Reply
DoneReply
Done@r.milenov@icloud.com Thanks for handling the commit message update!DebugUtility.php:43ReplyDone -
Radostin Milenov commented on patch set 9 09/14/26, 16:05
Reply
My pleasure, now we just need need another core developer to approve it. -
Garvin Hicking commented on patch set 9 09/14/26, 17:41
Reply
Actually I just need a vote from you, @r.milenov@icloud.com :-D -
Radostin Milenov commented on patch set 9 CR +1 09/14/26, 18:17
Reply
Well in that case... -
Radostin Milenov voted on patch set 9 V +1 09/14/26, 18:18
-
Radostin Milenov voted on patch set 9 CR 0 09/14/26, 18:19
-
Radostin Milenov voted on patch set 9 CR +1 09/14/26, 18:19
-
Garvin Hicking voted on patch set 9 CR +2 V +2 09/14/26, 18:43
-
Garvin Hicking merged patch set 10 09/15/26, 05:02