#60174Singleton instance w/ GeneralUtility::makeInstance
Description
You cannot always get a “unique” singleton class with “GeneralUtility::makeInstance”.
The static method doesn’t check for an existing backslash at the beginning of “className”.
use TYPO3\CMS\Core\Utility\GeneralUtility;
$singleton1 = GeneralUtility::makeInstance('TYPO3\CMS\Core\Page\PageRenderer');
@$singleton2 = GeneralUtility::makeInstance(‘\TYPO3\CMS\Core\Page\PageRenderer’);@
$hash1 = spl_object_hash($singleton1);
@$hash2 = spl_object_hash($singleton2);@
var_dump( ($hash1 === $hash2) );
The result is FALSE. This shouldn’t happen!