Project

General

Profile

Actions

Bug #73671

closed

Singleton makeInstance and XClass problem (setSingletonInstance)

Added by David Frerich about 8 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2016-02-25
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

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"

Actions

Also available in: Atom PDF