[TYPO3-core] RFC #10497: Mark t3lib_div::makeInstanceClassName() as deprecated

Dmitry Dulepov dmitry at typo3.org
Mon Mar 2 13:52:23 CET 2009


Hi!

Dmitry Dulepov wrote:
> Hi!
> 
> Martin Kutschker wrote:
>> You can now use t3lib_div::makeInstance() with parameters.
> 
> How will it help avoid breaking extensions?

I mean that this is not really acceptable:

==============
if (version_compare(TYPO3_branch, '4.3', '>=')) {
	$instance = t3lib_div::makeInstance('tx_myext_class', $param);
}
else {
	$className = t3lib_div::makeInstanceClassName('tx_myext_class');
	$instance = new $className($param);
}
==============

There are extensions where the "else" code is used many times (20 or more times). Replacing them all with the code above only complicates the code. It does not provide any benefit. In addition reflection is slow in PHP. makeInstance() with parameters uses reflection. So it is a performance killer.

Only disadvantages than. "Phe" as Steve Jobs said once.

-- 
Dmitry Dulepov
TYPO3 core team
http://dmitry-dulepov.com/
"Sometimes they go bad. No one knows why" (Cameron, TSCC, "Dungeons&Dragons")


More information about the TYPO3-team-core mailing list