Skip to content
Snippets Groups Projects
Commit fa02b422 authored by Benni Mack's avatar Benni Mack
Browse files

[!!!][TASK] Cleanup global debug functions

The global "xdebug()" function is removed, as it is a stub for "debug" nowadays.
This function exists since SVN days,  and no comment or change why this is
available.

Additionally, the global "debug()" function had 6 parameters - the last three
were not evaluated and thus, were removed.

Resolves: #82640
Releases: master
Change-Id: I3e583c06282842e3dcb14f4b68589fd706be2519
Reviewed-on: https://review.typo3.org/54256


Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 65a24c2f
Branches
Tags
No related merge requests found
.. include:: ../../Includes.txt
======================================================
Breaking: #82640 - Re-arranging global debug functions
======================================================
See :issue:`82640`
Description
===========
The global function :php:`xdebug()` has been dropped in favor of using :php:`debug()`.
The global function :php:`debug()` now only takes a maximum of three function arguments.
Impact
======
Calling `xdebug()` globally will throw in a PHP fatal error.
Affected Installations
======================
Any TYPO3 installation in a development environment using the global functions in an old-fashioned way.
Migration
=========
Instead of `xdebug()` simply use `debug()` as an alias. Ensure that when calling `debug()` that a
maximum of three arguments are handed over to the function.
.. index:: PHP-API, FullyScanned
\ No newline at end of file
<?php
// Simple debug function which prints output immediately
function xdebug($var = '', $debugTitle = 'xdebug')
{
// If you wish to use the debug()-function, and it does not output something,
// please edit the IP mask in TYPO3_CONF_VARS
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
return;
}
\TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $debugTitle);
}
// Debug function
function debug($variable = '', $name = '*variable*', $line = '*line*', $file = '*file*', $recursiveDepth = 3, $debugLevel = E_DEBUG)
{
// If you wish to use the debug()-function, and it does not output something,
// please edit the IP mask in TYPO3_CONF_VARS
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
return;
}
$title = $name === '*variable*' ? '' : $name;
$group = $line === '*line*' ? null : $line;
\TYPO3\CMS\Core\Utility\DebugUtility::debug($variable, $title, $group);
// Short-hand debug function
// If you wish to use the debug()-function, and it does not output something,
// please edit the IP mask in TYPO3_CONF_VARS
function debug($variable = '', $title = null, $group = null)
{
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(
\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'),
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']
)
) {
return;
}
\TYPO3\CMS\Core\Utility\DebugUtility::debug($variable, $title, $group);
}
......@@ -15,4 +15,18 @@ return [
'Breaking-37180-RemovedExtDirectDebugAndGLOBALSerror.rst',
],
],
'xdebug' => [
'numberOfMandatoryArguments' => 0,
'maximumNumberOfArguments' => 0,
'restFiles' => [
'Breaking-82640-Re-arrangingGlobalDebugFunctions.rst',
],
],
'debug' => [
'numberOfMandatoryArguments' => 0,
'maximumNumberOfArguments' => 3,
'restFiles' => [
'Breaking-82640-Re-arrangingGlobalDebugFunctions.rst',
],
],
];
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