[TYPO3-core] RFC #8985: Enable USER object to become USER_INT on the fly
    Dmitry Dulepov [typo3] 
    dmitry at typo3.org
       
    Thu Jul 17 13:04:59 CEST 2008
    
    
  
Hi!
Ingo Renner wrote:
> Well, could tslib_cObj work as an adapter to 
> t3lib_div::callUserFunction() ?
That's what I tried to do... It does not work. Firsts, t3lib_div::callUserFunction has this declaration:
function callUserFunction($funcName,&$params,&$ref,$checkPrefix='user_',$silent=0)
For tslib_cObj we have:
function callUserFunction($funcName,$conf,$content)
So the obvios solution seems to be:
function callUserFunction($funcName,$conf,$content) {
	return t3lib_div::callUserFunction($funcName, $content, $conf,
		$GLOBALS['TSFE']->TYPO3_CONF_VARS['FE']['userFuncClassPrefix']);
}
It looks ok if you do not notice that $conf passed to $ref parameter.
But there is a worse thing :( tslib_cObj::calluserFunc also sets $createdObj->cObj=$this. This is what t3lib_div::callUserFunction() does not do. So obvious implementation fails with the first called USER object... Same failure for typolink callbacks, etc.
>> And cObj's version does not accept EXT:-like syntax. Of course, code 
>> can copied from t3lib_div but we all know that duplication code is bad.
> 
> yeah, and as this is needed quite often I'd propose a new method 
> t3lib_div::resolveExtPrefixToPath() (or similar) and make all places 
> where this is needed use the new method.
+1! Good idea!
>> We could also avoid the problem adding delayedIncludeLibs. Keys could 
>> be plugin titles and values are file paths. cObj's callUserFunction 
>> could include file from delayedIncludeLibs when necessary. This is a 
>> quick and dirty solution.
> 
> sounds similar to the idea I have concerning autoload
> delayed -> lazy (that's a more common term "lazy loading")
Yes, this can be interesting. May be autoload is even better! Let PHP care for the classes it needs...
-- 
Dmitry Dulepov
TYPO3 Core team
More about TYPO3: http://typo3bloke.net/
Subscribe: http://typo3bloke.net/rss.xml
Latest article: http://typo3bloke.net/post-details/how_to_fill_realurl_cache/
    
    
More information about the TYPO3-team-core
mailing list