Feature #86220

enhanced debug methods

Added by Franz Holzinger 10 months ago. Updated 10 months ago.

Should have
Target version:
Start date:
Due date:
% Done:


PHP Version:
Sprint Focus:


The debug function at typo3_src-9.3.3/typo3/sysext/core/Resources/PHP/GlobalDebugFunctions.php is not sufficient for big TYPO3 extensions. If you have more than 1000 debug entries then the generated debug output will be too much. And it takes too long time to search for anything in the debug output.

In TYPO3 before 9.3 there have been 2 useful debug functions:


They should be kept for compatibility reason or at least be substituted by a similar function.

debugBegin has been a starting control to turn the debug output on. debugEnd has been a stop marker for the debug output.

However a more sophisticated method would help for better debugging.

debugControl with an indefinite number of parameters.

There you can set attributes for the output like colors, text sizes, email adresses, extension keys of a person who needs to be notified with debug details if a special part of code has been entered. This could also make it possible to define in a debug extension, that only the output of extension news is generated. If a debugControl(START, EXT_KEY, 'news'); has been executed, then this signifies the start of the debug output for extension news. debugControl(END, EXT_KEY, 'news'); marks the end for news.

All these code functions needs not be implemented in TYPO3. However the empty functions and an extensibility by slots are needed.

And also a return value of debug should be given.
A negative value could mean that the program execution should be shorter than normal.

debug($a, 'variable $a');

The debug extension could determine that if $a == 'special' then the program execution should return. Even a user with a special front end user group or IP address could have less debug output than another user. E.g. you want to test a new PHP code which must only be executed by a special tester. Other persons should never run into the PHP code which is not stable enough. If an email address '' has been entered, then the following code should be executed, otherwise not.

Then the caller could run:

if (debug($a, 'variable $a') < 0) return;
if (debugControl(TEST_USER) < 0) return;

Maybe some constants for this could be defined with TYPO3.

Related issues

Related to TYPO3 Core - Feature #23899: add a control function for debugging New 2010-11-01


#1 Updated by Christian Kuhn 10 months ago

I don't think we should/will introduce new global functions again.

#2 Updated by Georg Ringer 10 months ago

  • Status changed from New to Rejected

this sounds like a lot of business logic which you can always add to your custom extension.

I reject that for the core.

#3 Updated by Franz Holzinger 10 months ago

Yes, I intend to add all the logic to the extension. I did not make any other proposal.

But I cannot define a global debug control function in my extension.

And the global ERROR variable has been removed in TYPO3 9 as well as the debugBegin and debugEnd methods. There have been good reasons that these did exist in the past.
Kasper Skårhøj and Renè Fritz had introduced this into TYPO3.

To better understand the needs, just look into the code of

function debugvar($var, $name = '', $level = 3, $recursive = false)

The debug function should add more variables at the end.

function debug($variable = '', $title = null, $group = null, ...$parameters) {

Reason: This gives most flexibility to extensions. E.g. the call can be:

debug($var, 'Variable $var', null, 'news', 'developer2', 'topic3', 'bug#11');

see https://www.codewars.com/kata/php-functions-splat-operator
Then the resulting debug files can be split depending on these parameters. A file debugNews.html, a file developer2.html, a file topic3.html and a file bug11.html can be generated during one debug execution process.
This would help a lot on big TYPO3 projects with many developers and more than thousand debug lines.

#4 Updated by Franz Holzinger 10 months ago

  • Related to Feature #23899: add a control function for debugging added

Also available in: Atom PDF