Project

General

Profile

Actions

Bug #37609

closed

t3lib_div::callUserFunction causes PHP warnings

Added by Anonymous over 12 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
Start date:
2012-05-30
Due date:
% Done:

100%

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

Description

line 4595 of t3lib/class.t3lib_div.php from the current trunk causes php warnings due to lack of conditions:

4591         public static function callUserFunction($funcName, &$params, &$ref, $checkPrefix = 'user_', $errorMode = 0) {
4592                 $content = FALSE;
4593
4594                         // Check persistent object and if found, call directly and exit.
4595                 if (is_array($GLOBALS['T3_VAR']['callUserFunction'][$funcName])) {
4596                         return call_user_func_array(
4597                                 array(&$GLOBALS['T3_VAR']['callUserFunction'][$funcName]['obj'],
4598                                         $GLOBALS['T3_VAR']['callUserFunction'][$funcName]['method']),
4599                                 array(&$params, &$ref)
4600                         );
4601                 }

in case $funcName is an existing key of the array $GLOBALS['T3_VAR']['callUserFunction'] everything works fine.
in case it isn't, it produces warnings like this:
Core: Error handler (FE): PHP Warning: Illegal offset type in /opt/typo3/typo3_src-4.5/t3lib/class.t3lib_div.php line 4595

so i guess adding two extra conditions to the if statement like this
4595                 if (array_key_exists('callUserFunction', $GLOBALS['T3_VAR']) && array_key_exists($funcName, $GLOBALS['T3_VAR']['callUserFunction']) && is_array($GLOBALS['T3_VAR']['callUserFunction'][$funcName])) {

fixes that, right?

Actions

Also available in: Atom PDF