a50802e93b71e6bae029e20f03f2df1bdfb92d99
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Resources / PHP / GlobalDebugFunctions.php
1 <?php
2 // Simple debug function which prints output immediately
3 function xdebug($var = '', $debugTitle = 'xdebug')
4 {
5 // If you wish to use the debug()-function, and it does not output something,
6 // please edit the IP mask in TYPO3_CONF_VARS
7 if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
8 return;
9 }
10 \TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $debugTitle);
11 }
12
13 // Debug function which calls $GLOBALS['error'] error handler if available
14 function debug($variable = '', $name = '*variable*', $line = '*line*', $file = '*file*', $recursiveDepth = 3, $debugLevel = E_DEBUG)
15 {
16 // If you wish to use the debug()-function, and it does not output something,
17 // please edit the IP mask in TYPO3_CONF_VARS
18 if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
19 return;
20 }
21 if (is_object($GLOBALS['error']) && @is_callable([$GLOBALS['error'], 'debug'])) {
22 $GLOBALS['error']->debug($variable, $name, $line, $file, $recursiveDepth, $debugLevel);
23 } else {
24 $title = $name === '*variable*' ? '' : $name;
25 $group = $line === '*line*' ? null : $line;
26 \TYPO3\CMS\Core\Utility\DebugUtility::debug($variable, $title, $group);
27 }
28 }
29
30 function debugBegin()
31 {
32 if (is_object($GLOBALS['error']) && @is_callable([$GLOBALS['error'], 'debugBegin'])) {
33 $GLOBALS['error']->debugBegin();
34 }
35 }
36
37 function debugEnd()
38 {
39 if (is_object($GLOBALS['error']) && @is_callable([$GLOBALS['error'], 'debugEnd'])) {
40 $GLOBALS['error']->debugEnd();
41 }
42 }