Bug #48544

Extbase warnings in devLog

Added by Stefano Cecere over 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Extbase
Target version:
Start date:
2013-05-26
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

if you install devlog (patching it because it hangs 6.1) the devlog gets filled with these warnings wherever you open an extbase module (like the new Backedn Users or EM).. making it useless

    Called from     Page     User     Extra data 
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder" needs a prototype in "injectEnvironmentService". This is often a bad code smell; often you rather want to inject a singleton.    Container.php, line 243        stefano.cecere    
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder" needs a prototype in "injectEnvironmentService". This is often a bad code smell; often you rather want to inject a singleton.    Container.php, line 243        stefano.cecere    
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend" needs a prototype in "injectEnvironmentService". This is often a bad code smell; often you rather want to inject a singleton.    Container.php, line 243        stefano.cecere    
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager" needs a prototype in "injectEnvironmentService". This is often a bad code smell; often you rather want to inject a singleton.    Container.php, line 243        stefano.cecere    
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager" needs a prototype in "injectQueryGenerator". This is often a bad code smell; often you rather want to inject a singleton.    Container.php, line 243        stefano.cecere    
26-05-13 16:56:47         extbase    The singleton "TYPO3\CMS\Extbase\Configuration\ConfigurationManager" needs a prototype in "injectEnvironmentService". This is often a bad code smell; often you rather want to inject a singleton.

Related issues

Related to TYPO3 Core - Bug #57518: Make Extbase EnvironmentService a Singleton Closed 2014-04-01

Associated revisions

Revision aeda613a (diff)
Added by Markus Klein over 2 years ago

[BUGFIX] Do not inject non-singleton class into singleton

BackendConfigurationManager must not inject an instance of
QueryGenerator as the latter is not a singleton.
Instead create a local instance of QueryGenerator when it is needed.

Releases: master
Resolves: #48544
Change-Id: If58f3a5c9c6a1003a0301bd2d68622ee8ccba843
Reviewed-on: https://review.typo3.org/50033
Tested-by: TYPO3com <>
Reviewed-by: Thomas Hohn <>
Reviewed-by: Joerg Boesche <>
Reviewed-by: Daniel Goerz <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>
Reviewed-by: Jigal van Hemert <>
Tested-by: Jigal van Hemert <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

Revision 1e241298 (diff)
Added by Markus Klein over 2 years ago

[BUGFIX] Do not devlog bad code smells of core classes

Releases: 7.6, 6.2
Resolves: #48544
Change-Id: If58f3a5c9c6a1003a0301bd2d68622ee8ccba843
Reviewed-on: https://review.typo3.org/52054
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Reviewed-by: Thomas Hohn <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Mathias Bruckmoser <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 5d266a70 (diff)
Added by Markus Klein over 2 years ago

[BUGFIX] Do not devlog bad code smells of core classes

Releases: 7.6, 6.2
Resolves: #48544
Change-Id: If58f3a5c9c6a1003a0301bd2d68622ee8ccba843
Reviewed-on: https://review.typo3.org/52347
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 7c45dc50 (diff)
Added by Markus Klein over 2 years ago

[FOLLOWUP][BUGFIX] Do not devlog bad code smells of core classes

Fix casing of "false" to match CGL.

Releases: 7.6, 6.2
Resolves: #48544
Change-Id: I5b8c9ffd4e23c32efbbf72d2249cc7a6052be6bf
Reviewed-on: https://review.typo3.org/52348
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

History

#1 Updated by Ernesto Baschny over 6 years ago

  • Target version deleted (2338)

#2 Updated by Christian Kuhn about 6 years ago

  • Is Regression set to No

This issue is another proof that singletons are an anti-pattern. We have to solve this issues somehow, but I currently have no good idea on how to do that. There are 4 options:

  • Implement SingletonInterface in injected dependencies like EnvironmentService
  • Do not use dependency injection in the singleton class but get the instance with objectManager->get()
  • Remove SingletonInterface from RequestBuilder and Widget class and so on (if possible)
  • Drop the log message

We should discuss on how to systematically solve this issue.

#3 Updated by Stefano Cecere about 6 years ago

just checked with new 6.2alpha3 and we have the same warning flood!

#4 Updated by Markus Klein about 6 years ago

@Christian: Why not making them static?

#5 Updated by Christian Kuhn about 6 years ago

  • class EnvironmentService should implement SingletonInterface
  • BackendConfigurationManager should either not use QueryGenerator at all, or should not inject but objectManager->get() the instance at the point where it is used.

#6 Updated by Frank Naegler over 5 years ago

last update was 9 months ago, and nothing happens? The devlog grows up only with this messages. is it possible to filter this messages out?

#7 Updated by Florian Seirer over 4 years ago

You can use filters in the devlog if you select "All entries".

#8 Updated by Stephan GroƟberndt over 3 years ago

  • Subject changed from devlog fileld with extbase warnings! to Extbase warnings in devLog
  • Status changed from New to Needs Feedback
  • TYPO3 Version changed from 6.1 to 6.2
  • PHP Version deleted (5.3)

EnvironmentService is a Singleton since https://review.typo3.org/29042

Are there still warnings in devLog?

#9 Updated by Jan Bartels about 3 years ago

With Typo3 6.2.27 I still get messages like The singleton "TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager" needs a prototype in "queryGenerator". This is often a bad code smell; often you rather want to inject a singleton. Container.php, Zeile 260

#10 Updated by Gerrit Code Review about 3 years ago

  • Status changed from Needs Feedback 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/50033

#11 Updated by Gerrit Code Review about 3 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/50033

#12 Updated by Gerrit Code Review about 3 years ago

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

#13 Updated by Markus Klein about 3 years ago

  • Status changed from Under Review to New

This is a risky patch, which could break extension extending the class in question.
Therefore this may not be fixed for 7.6 and below.
A fix for master could be done, but is not on the timeline for now.

#14 Updated by Michael Stucki almost 3 years ago

Agree that this must not break stable versions.
However, this issue is about the warning in devLog, which should still be changed or removed.

#15 Updated by Kurt Ludikovsky almost 3 years ago

  • TYPO3 Version changed from 6.2 to 7
  • PHP Version set to 5.6

Is there any solution in sight for 7.6?

7.6 is considered a LTS release and shall still be maintained till end of 2020.
In addition many of the extensions are currently ported and available for 7.6 (apart from 6.2), which make T3 valuable over other CMS.
If this support and stability breaks, and a there are a lot of issues like this, which is now unsresolved for nearly four yours, the support for T3 will drop.

#16 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

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

#17 Updated by Markus Klein almost 3 years ago

@Kurt: See new patch version. I gave it another try, lets see if we manage to "solve" it this time.
Please also read the comment history of the review for details.

#18 Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52054

#19 Updated by Gerrit Code Review almost 3 years ago

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

#20 Updated by Markus Klein almost 3 years ago

  • Category set to Extbase
  • Assignee set to Markus Klein
  • Target version set to next-patchlevel
  • Complexity set to easy

I kindly ask all watchers of this ticket to test the solutions and to vote for the patches on Gerrit.

Patch for 8: https://review.typo3.org/50033
Patch for 7: https://review.typo3.org/52054
(Backport to 6.2 is planned)

#21 Updated by Kurt Ludikovsky almost 3 years ago

Please check the base for the modifications.
The patch sets seems to have a different base for 7.6 as the base does not match my source, and also the patched file crashed my 7.6 T3-BE (with 7.6.15 and 7.6.16).

#22 Updated by Markus Klein almost 3 years ago

Please use the Reply button on Gerrit to comment on patches. Thanks.

#23 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52054

#25 Updated by Gerrit Code Review over 2 years ago

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/52319

#26 Updated by Markus Klein over 2 years ago

@Bruckmoser: Please vote on Gerrit for the patch!!!

https://review.typo3.org/52054

Login with your typo3.org username and password and use the reply button at the top.

#27 Updated by Gerrit Code Review over 2 years ago

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

#28 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52347

#29 Updated by Markus Klein over 2 years ago

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

#30 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52348

#31 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52348

#32 Updated by Markus Klein over 2 years ago

  • Status changed from Under Review to Resolved

#33 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF