Bug #17944
closedtslib_cObj uses deprecated function call_user_method
0%
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)
Files
Updated by Oliver Hader almost 17 years ago
Hm, which exact PHP version are you using and on which operating system?
Updated by Ivan almost 17 years ago
$ php --version
PHP 5.1.4-1.dotdeb.2 (cli) (built: Jun 2 2006 10:34:33)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ cat /proc/version
Linux version 2.6.20.3 (gcc version 3.3.5 (Debian 1:3.3.5-13))
Updated by Ivan Gomez almost 17 years ago
Updated by Oliver Hader almost 17 years ago
TYPO3 4.1 was designed with PHP 4.3 which didn't support the PHP Exception model. Furthmore there's no Exception Handler in class.tslib_content.php.
But I'm fine with updating the deprecated function call to 'call_user_method' to 'call_user_func_array'. Please see and test the attached new patch which should also solve the behaviour you mentioned with Exceptions.
Updated by Ivan Gomez almost 17 years ago
Hello,
We had develop a extension to manage exceptions in our portals and the deprecated function had problems with exceptions.
We think your proposed patch have exactly the same behaviour which have our one.Then you can select which you think was the best.
Regards
Updated by Oliver Hader almost 17 years ago
- TYPO3_4-1 (rev. 3051)
- Trunk (rev. 3052)