Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot instantiate interface ConfigurationManagerInterface #3622

Closed
chroenmeister opened this issue May 3, 2023 · 11 comments · Fixed by #3626
Closed

[BUG] Cannot instantiate interface ConfigurationManagerInterface #3622

chroenmeister opened this issue May 3, 2023 · 11 comments · Fixed by #3626
Labels
more-information-needed Will close an Issue for lack of response for 28 days.

Comments

@chroenmeister
Copy link

Describe the bug
Using the latest 11.2.2 release getting this exception while opening plugin instance:

Cannot instantiate interface TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface

To Reproduce

  1. Open Plugin Search: Form, Result, Additional Components

Screenshots

grafik

Used versions (please complete the following information):

  • TYPO3 Version: 10.4.37
  • EXT:solr Version: 11.2.2
  • PHP Version: 7.4.11
@brandung-sjorek
Copy link
Contributor

brandung-sjorek commented May 3, 2023

The same error appears also in:

  • TYPO3 Version: 11.5.26
  • EXT:solr Version: 11.5.2
  • PHP Version: 7.4.11

@dkd-kaehm dkd-kaehm added the more-information-needed Will close an Issue for lack of response for 28 days. label May 5, 2023
@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented May 5, 2023

We can not reproduce the issue.

@lfehr, @chroenmeister, @brandung-sjorek
Please provide the installed extension list, or better those, which implementing the interface
TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface.

Most probably, there is some extension which implements this interface and therefore the DI can not resolve the class.

@brandung-sjorek
Copy link
Contributor

brandung-sjorek commented May 8, 2023

@dkd-kaehm We'll (@chroenmeister and me) look into it, and give you Feedback within the next 2 weeks (our sprint). Please keep the issue open in the case we find the root-cause in the TYPO3 Solr-Extension itself.

Thanks for your reply …

@rr-it
Copy link
Contributor

rr-it commented May 8, 2023

protected function getConfigurationFromPageId(?int $pid = null): ?TypoScriptConfiguration
{
if ($pid === null) {
return null;
}
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
$typoScript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
return GeneralUtility::makeInstance(TypoScriptConfiguration::class, $typoScript);
}

We are trying to make an instance of an Interface::class here. Not sure if this must be an instance of an actual implementation of this interface?

$configurationManager = GeneralUtility::makeInstance(\ApacheSolrForTypo3\Solr\System\Configuration\ConfigurationManager::class);
$configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
$configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);

And $pid is not used anymore to get the paged-based configuration. Is this expected behaviour?


Usually the ConfigurationManager is injected like:

    /**
     * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
     */
    protected $configurationManager;

    /**
     * Injects the Configuration Manager and loads the settings
     *
     * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager An instance of the Configuration Manager
     */
    public function injectConfigurationManager(
        \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
    ) {
        $this->configurationManager = $configurationManager;
    }

@rr-it
Copy link
Contributor

rr-it commented May 8, 2023

To Reproduce

1. Open Plugin Search: Form, Result, Additional Components
  1. In TYPO3 Backend go to the module "WEB" --> "Page"
  2. Edit a content element of type "Plugin Search"

@brandung-sjorek
Copy link
Contributor

brandung-sjorek commented May 8, 2023

@rr-it @dkd-kaehm The extbase extension's ConfigurationManager must be injected via the TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface , otherwise the DI is not able to resolve the correct implementation (TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager or TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager)

@dkd-kaehm
Copy link
Collaborator

@rr-it
Tried to reproduce this issue within https://github.com/TYPO3-Solr/solr-ddev-site 11.5.x and 11.2.x.


@brandung-sjorek Please kick the pull request for this issue.

@brandung-sjorek
Copy link
Contributor

@rr-it Forgot to say: Thanks for your investigation …

@dkd-kaehm Which pull-request? Maybe I get something wrong - do you want us to create a PR? No problem, but the colleague will need some time (the 14 days mentioned above)

@rr-it
Copy link
Contributor

rr-it commented May 8, 2023

Some points on the reproducibility of this bug:
There might be a "race condition" or similar introduced by the use of GeneralUtility::makeInstance().

If Solr getConfigurationFromPageId() is first to instantiate ConfigurationManagerInterface::class via direct call to GeneralUtility::makeInstance() it fails.

Assumption: In case an object matching ConfigurationManagerInterface::class has been successfully instantiated before by some other extension, this object is returned perfectly fine from GeneralUtility::makeInstance() to use by Solr getConfigurationFromPageId().

https://github.com/TYPO3/typo3/blob/808ef61a53bc1e7ef65b715c13727b0f2d086c24/typo3/sysext/core/Classes/Utility/GeneralUtility.php#L3465C1-L3489

dkd-kaehm pushed a commit to rr-it/ext-solr that referenced this issue May 22, 2023
Especially on TYPO3 10 the userfunction to load the flex form configuration produced an error.

Fixes: TYPO3-Solr#3622
dkd-kaehm pushed a commit to dkd-kaehm/ext-solr that referenced this issue May 22, 2023
Especially on TYPO3 10 the userfunction to load the flex form configuration produced an error.

Fixes: TYPO3-Solr#3622
Ports: TYPO3-Solr#3626
dkd-kaehm pushed a commit that referenced this issue May 24, 2023
Especially on TYPO3 10 the userfunction to load the flex form configuration produced an error.

Fixes: #3622
Ports: #3626
dkd-kaehm pushed a commit that referenced this issue May 24, 2023
Especially on TYPO3 10 the userfunction to load the flex form configuration produced an error.

Fixes: #3622
@dkd-kaehm
Copy link
Collaborator

Seems to be fixed for TYPO3 10 and 11 in #3626 and #3640.

@chroenmeister Please check latest state of release-11.2.x branch and close this issue if it is fixed.

@chroenmeister
Copy link
Author

@dkd-kaehm Yes the issue is solved in the latest release-11.2.x branch! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed Will close an Issue for lack of response for 28 days.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants