Issue Bug Closed

#17944tslib_cObj uses deprecated function call_user_method

Ivan 12/20/07, 13:44 updated 05/14/08, 10:01

Description

tslib_cObj uses deprecated function call_user_method which should be updated to call_user_func_array. If Exceptions are envolved the disposal of deprecated function call_user_method causes a blank page.

Deprecated function call_user_method have problems with exceptions. It’s used in:

typo3/sysext/cms/tslib/class.tslib_content.php:5697:
$content = call_user_method($parts1, $classObj, $content, $conf);

I make several test and using recommended function call_user_func thrown exceptions show correctly fatal error message by following test don’t show it:

class test {

function foo()
  {
throw new Exception(‘bar’);
}
}

try {
$a = new test();

call_user_method(‘foo’,$a);

} catch (Exception $e) {
echo $e->getMessage();
}

//Expected result: bar

Result in web :

Warning: call_user_method() [function.call-user-method]: Unable to call
foo() in ….

Result in CLI :
Notice: call_user_method(): This function is deprecated, use the
call_user_func variety with the array(&$obj, “method”) syntax instead in
/home/igalia/igomez/TMP/TESTING_EXCEPTIONS/prueba1.php on line 16

bar

In CLI seems work but not in web.

A similar test, throwing exceptions in a plugin code do blank page, and refreshing the page show following warnings and next uncaught exception message:

Warning: call_user_method() [function.call-user-method]: Unable to call main() in [….]/typo3_src-4.1.2/typo3/sysext/cms/tslib/class.tslib_content.php on line 5712

Warning: call_user_method() [function.call-user-method]: Unable to call main_page() in [….]/typo3_src-4.1.2/typo3/sysext/cms/tslib/class.tslib_content.php on line 5712

I think call_user_func (in typo3/sysext/cms/tslib/class.tslib_content.php:5706:) is called when page is refreshing and then ucaugth message is showed
(issue imported from #M7029)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.