[TYPO3-dev] Problems with a deprecated php function

Ivan Gomez Rodriguez igomez at igalia.com
Thu Dec 20 11:24:20 CET 2007


Does someboby know if it's possible use call_user_function instead
call_user_method function in TYPO3 core (v.4.12)?,

This change will be rather dangerous or not

Following is the only one place where call_user_func is called in my
intallation

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

I wish to use exceptions and i can't do that because call_user_method is
deprecated and it have well-known bugs related with exceptions.

A solution could be change this function for any of recommended
functions call_user_func or call_user_func _array

http://es.php.net/manual/en/function.call-user-method.php


Does somebody know if it's possible do that?
Is it the best solution or i could find other problems?

BTH, How do you handle errors in FE?

I think that to print an error message (with echo) when an error happens
 , as in typo3_db is an mistake.

In PHP exists error handlers and to use error handler is much better
than only print an error.

Thanks in advance

------------------------
Iván Gómez Rodríguez
Computer Science Engineer
mailto:igomez at igalia.com



Ivan Gomez Rodriguez wrote:
> > I'm trying to use exceptions in my extensions for several reasons and
> > uncaugth exceptions have a bad behaviour, generating blank pages instead
> >   normal fatal error message.
> >
> > I think this problem is derived from use of deprecated function
> > call_user_method  in class.tslib_content.php
> >
> > Following code is not succesful :
> >
> > 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.
> >
> > Does know somebody what can i do for resolv that? Some php configuration
> > change ?
> >
> > I think the best could be use another callbacking function like
> > call_user_func or call_user_func_array but i don't like to make this
> > important change in TYPO3 core .
> >
> > ------------------------
> > Iván Gómez Rodríguez
> > Computer Science Engineer
> > mailto:igomez at igalia.com
> > _______________________________________________
> > TYPO3-english mailing list
> > TYPO3-english at lists.netfielders.de
> > http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english




More information about the TYPO3-dev mailing list