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 #1

Updated by Helmut Hummel almost 8 years ago

  • Status changed from New to Accepted

good point, thanks. final class name and class name handling should be fixed

Actions #2

Updated by Gerrit Code Review about 4 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63618

Actions #3

Updated by Gerrit Code Review about 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63618

Actions #4

Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63586

Actions #5

Updated by Benni Mack about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF