Bug #73671
closedSingleton makeInstance and XClass problem (setSingletonInstance)
100%
Description
There is a big problem with XClasses of a Class that implements the singleton interface in combination of manually setting a new singleton instance.
When creating an instances of a class, the xclass is created, but the singleton checks is always made for the xclass, never the original class.
If you set an Singleton class manually, this object will never be returned.
My specific problem lies with \TYPO3\CMS\Core\Page\PageRenderer.
When i create an xclass for this class, the new class is used. For caching purposes (?) the class gets serialized and in the TypoScriptFrontendController->INTincScript the class gehts unserialized.
Afterwards the class gets sets as the new singletoninstance: GeneralUtility::setSingletonInstance(PageRenderer::class, $pageRenderer);
But the GeneralUtility:makeInstance(PageRenderer::class) still returns the old object, not the new one.
In \TYPO3\CMS\Rsaauth\RsaEncryptionEncoder the addJsFile method is called for the old object, and therefore the Javascript is not outputted into the frontend.
This problem took a lot of analysing, and i think the error lies within the GeneralUtility::setSingletonInstance call, because there is assignment for the "$finalClassNameCache"