Project

General

Profile

Actions

Bug #17944

closed

tslib_cObj uses deprecated function call_user_method

Added by Ivan over 16 years ago. Updated about 16 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Communication
Target version:
-
Start date:
2007-12-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
5.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

bug_0007029.patch (664 Bytes) bug_0007029.patch Administrator Admin, 2008-02-04 11:43
0007029.patch (674 Bytes) 0007029.patch Administrator Admin, 2008-02-04 12:59
Actions #1

Updated by Oliver Hader over 16 years ago

Hm, which exact PHP version are you using and on which operating system?

Actions #2

Updated by Ivan over 16 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))

Actions #3

Updated by Ivan Gomez over 16 years ago

Added a patch which change

- call_user_method($parts1, $classObj, $content, $conf);
+ $content = $classObj->$parts1($content, $conf);

This do the same without deprecated functions

Actions #4

Updated by Oliver Hader over 16 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.

Actions #5

Updated by Ivan Gomez over 16 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

Actions #6

Updated by Oliver Hader over 16 years ago

Committed to SVN:
  • TYPO3_4-1 (rev. 3051)
  • Trunk (rev. 3052)
Actions

Also available in: Atom PDF