Project

General

Profile

Actions

Bug #43022

closed

debug function not found

Added by Franz Holzinger about 12 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2012-11-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

It does not work any more to insert a debug function in the CORE.

file GeneralUtility.php:

static public function requireOnce($requireFile) {
// Needed for require_once
global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
debug ($requireFile, 'requireOnce $requireFile');
require_once $requireFile;
}

PHP Fatal error: Call to undefined function TYPO3\\CMS\\Core\\Utility\\debug() in /var/www/mydomain/web/typo3_src-6.0.0rc1/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 4376

The TYPO3 debug feature is still needed in order to be able to backtrace an error case.

Actions #1

Updated by Patrick Broens about 12 years ago

  • Category set to Miscellaneous
  • Target version set to 6.0.0
  • Complexity set to easy
Actions #2

Updated by Nicole Cordes almost 12 years ago

Please use the function t3lib_utility_Debug::debug as the one in GeneralUtility (former t3lib_div) was marked as deprecated in 4.6

Actions #3

Updated by Helmut Hummel almost 12 years ago

  • Status changed from New to Needs Feedback

the global debug functions are still there: see GlobalDebugFunctions.php

But it may be that

static public function requireOnce($requireFile) {
// Needed for require_once
global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
debug ($requireFile, 'requireOnce $requireFile');
require_once $requireFile;
}

this fails requireOnce may be used before these functions are registered. In that case use t3lib_utility_Debug::debug as suggested

Actions #4

Updated by Franz Holzinger almost 12 years ago

My proposal is that the debug functions are included as the first ones. So I still could use the global ERROR object if the debug function is called.

line 4373 of file /typo3_src-6.0.0rc1/typo3/sysext/core/Classes/Utility/GeneralUtility.php:

static public function requireOnce($requireFile) {
// Needed for require_once
global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;

t3lib_utility_Debug::debug($requireFile, '$requireFile');
require_once $requireFile;
}

results in :

[Tue Nov 27 09:14:24 2012] [error] [client 87.79.227.155] PHP Fatal error: Class 'TYPO3\\CMS\\Core\\Utility\\t3lib_utility_Debug' not found in /var/www/mydomain/web/typo3_src-6.0.0rc1/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 4378

It also does not work if you insert this line:

\TYPO3\CMS\Core\Utility\DebugUtility::debug($requireFile, '$requireFile');

PHP Fatal error: Class 'TYPO3\\CMS\\Core\\Utility\\DebugUtility' not found in /var/www/mydomain/web/typo3_src-6.0.0rc1/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 4378

However a line for the normal debug function is still missing. And it is not usable to insert the complete path when debugging.

Actions #5

Updated by Franz Holzinger over 11 years ago

You will need the classes autoloaded before you can use them.

If I insert these lines:

----------
$existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
$backtrace = tx_fhdebug::getTraceArray();
error_log('TypoScriptTemplateConstantEditorModuleFunctionController::main backtrace: ' . print_r($backtrace, TRUE) . chr(13), 3, tx_fhdebug::getErrorLogFilename());


---------------
then I get:

------------------

Fatal error: Class 'TYPO3\CMS\TstemplateCeditor\Controller\tx_fhdebug' not found in /var/www/mydomain/typo3_src-6.0.6/typo3/sysext/tstemplate_ceditor/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php on line 90 
-----------------------

The autoload feature should work in all cases if you demand that the 'include_once' clauses must be removed.

Actions #6

Updated by Franz Holzinger over 11 years ago

I have tried to debug the file CacheFactory.php.

public function create($cacheIdentifier, $cacheObjectName, $backendObjectName, array $backendOptions = array()) {
t3lib_utility_Debug::debug ($backendObjectName, 'create $backendObjectName');

gives the error:
[Thu Jul 11 13:49:51 2013] [error] [client 89.0.244.233] PHP Fatal error:  Class 'TYPO3\\CMS\\Core\\Cache\\t3lib_utility_Debug' not found in /var/www/user/web/typo3_src-6.1.1/typo3/sysext/core/Classes/Cache/CacheFactory.php on line 82

Then I tried to use a new version of the extension fh_debug:

public function create($cacheIdentifier, $cacheObjectName, $backendObjectName, array $backendOptions = array()) {
 \JambageCom\Fhdebug\DebugFunctions::debug ($backendObjectName, 'create $backendObjectName');

gives the error:
[Thu Jul 11 13:52:49 2013] [error] [client 89.0.244.233] PHP Fatal error:  Class 'JambageCom\\Fhdebug\\DebugFunctions' not found in /var/www/user/web/typo3_src-6.1.1/typo3/sysext/core/Classes/Cache/CacheFactory.php on line 82
Actions #7

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to New
  • Target version deleted (6.0.0)
  • Is Regression set to No
Actions #8

Updated by Mathias Schreiber almost 10 years ago

  • Status changed from New to Resolved
DebugUtility::debug($cacheIdentifier, 'header', 'Group');
Actions #9

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF