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] Error Message SC_OPTIONS does not exist in array after commit #1258 #1273

Closed
BFallert opened this issue Jul 11, 2024 · 7 comments · Fixed by #1274
Closed

[BUG] Error Message SC_OPTIONS does not exist in array after commit #1258 #1273

BFallert opened this issue Jul 11, 2024 · 7 comments · Fixed by #1274
Assignees
Labels
🐛 bug A non-security related bug.

Comments

@BFallert
Copy link
Collaborator

Description

When I edit a document in the list view in the Typo3 backend and then click on "Save", I get the following error message:

Fatal error: Uncaught TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException: Segment SC_OPTIONS of path SC_OPTIONS does not exist in array in /var/www/typo3/public/typo3/sysext/core/Classes/Utility/ArrayUtility.php:201 Stack trace: #0 /var/www/typo3/public/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php(216): TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath() #1 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(945): TYPO3\CMS\Core\Configuration\ConfigurationManager->getLocalConfigurationValueByPath() #2 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(911): Kitodo\Dlf\Common\Helper::getLocalConfigurationByPath() #3 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(401): Kitodo\Dlf\Common\Helper::getOptions() #4 /var/www/typo3/packages/bfallert/presentation/Classes/Common/MetsDocument.php(178): Kitodo\Dlf\Common\Helper::getHookObjects() #5 /var/www/typo3/packages/bfallert/presentation/Classes/Common/AbstractDocument.php(1262): Kito in /var/www/typo3/public/typo3/sysext/core/Classes/Utility/ArrayUtility.php on line 201

The same error occurs when a document page is to be displayed in the DFG viewer, where the error message "Oops, an error occurred! Code: ..." is displayed. The following entry can then be found in the error log:

Thu, 11 Jul 2024 10:05:51 +0200 [ALERT] request="07944f3da5c1e" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 202407111005502f92c6c8 - {"exception":"TYPO3\\CMS\\Core\\Utility\\Exception\\MissingArrayPathException: Segment SC_OPTIONS of path SC_OPTIONS does not exist in array in /var/www/typo3/public/typo3/sysext/core/Classes/Utility/ArrayUtility.php:201\nStack trace:\n#0 /var/www/typo3/public/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php(216): TYPO3\\CMS\\Core\\Utility\\ArrayUtility::getValueByPath()\n#1 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(945): TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager->getLocalConfigurationValueByPath()\n#2 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(911): Kitodo\\Dlf\\Common\\Helper::getLocalConfigurationByPath()\n#3 /var/www/typo3/packages/bfallert/presentation/Classes/Common/Helper.php(401): Kitodo\\Dlf\\Common\\Helper::getOptions()\n#4 /var/www/typo3/packages/bfallert/presentation/Classes/Common/MetsDocument.php(178): Kitodo\\Dlf\\Common\\Helper::getHookObjects()\n#5 /var/www/typo3/packages/bfallert/presentation/Classes/Common/AbstractDocument.php(1262): Kitodo\\Dlf\\Common\\MetsDocument->establishRecordId()\n#6 /var/www/typo3/packages/bfallert/presentation/Classes/Common/AbstractDocument.php(579): Kitodo\\Dlf\\Common\\AbstractDocument->__construct()\n#7 /var/www/typo3/packages/bfallert/presentation/Classes/Domain/Repository/DocumentRepository.php(94): Kitodo\\Dlf\\Common\\AbstractDocument::getInstance()\n#8 /var/www/typo3/packages/bfallert/slub_digitalcollections/Classes/ViewHelpers/XpathViewHelper.php(102): Kitodo\\Dlf\\Domain\\Repository\\DocumentRepository->findOneByParameters()\n#9 /var/www/typo3/var/cache/code/fluid_template/layout_KitodoPage_html_9843fa3684ebef8b3c7bd16fbd64afad0881680b.php(63): Slub\\SlubDigitalcollections\\ViewHelpers\\XpathViewHelper::renderStatic()\n#10 /var/www/typo3/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php(200): layout_KitodoPage_html_9843fa3684ebef8b3c7bd16fbd64afad0881680b->render()\n#11 /var/www/typo3/public/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php(358): TYPO3Fluid\\Fluid\\View\\AbstractTemplateView->render()\n#12 /var/www/typo3/public/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php(108): TYPO3\\CMS\\Frontend\\ContentObject\\FluidTemplateContentObject->renderFluidView()\n#13 /var/www/typo3/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(829): TYPO3\\CMS\\Frontend\\ContentObject\\FluidTemplateContentObject->render()\n#14 /var/www/typo3/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(743): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->render()\n#15 /var/www/typo3/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(688): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->cObjGetSingle()\n#16 /var/www/typo3/public/typo3/sysext/frontend/Classes/Http/RequestHandler.php(232): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->cObjGet()\n#17 /var/www/typo3/public/typo3/sysext/frontend/Classes/Http/RequestHandler.php(198): TYPO3\\CMS\\Frontend\\Http\\RequestHandler->generatePageBodyContent()\n#18 /var/www/typo3/public/typo3/sysext/frontend/Classes/Http/RequestHandler.php(134): TYPO3\\CMS\\Frontend\\Http\\RequestHandler->generatePageContent()\n#19 /var/www/typo3/packages/uma_site/Classes/Middleware/SecureDownloadHandler.php(116): TYPO3\\CMS\\Frontend\\Http\\RequestHandler->handle()\n#20 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): UMA\\UmaSite\\Middleware\\SecureDownloadHandler->process()\n#21 /var/www/typo3/packages/uma_site/Classes/Middleware/PostProcessing.php(20): class@anonymous->handle()\n#22 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): UMA\\UmaSite\\Middleware\\PostProcessing->process()\n#23 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/OutputCompression.php(48): class@anonymous->handle()\n#24 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\OutputCompression->process()\n#25 /var/www/typo3/public/typo3conf/ext/vhs/Classes/Middleware/AssetInclusion.php(20): class@anonymous->handle()\n#26 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): FluidTYPO3\\Vhs\\Middleware\\AssetInclusion->process()\n#27 /var/www/typo3/packages/bfallert/presentation/Classes/Middleware/SearchSuggest.php(47): class@anonymous->handle()\n#28 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): Kitodo\\Dlf\\Middleware\\SearchSuggest->process()\n#29 /var/www/typo3/packages/bfallert/presentation/Classes/Middleware/SearchInDocument.php(64): class@anonymous->handle()\n#30 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): Kitodo\\Dlf\\Middleware\\SearchInDocument->process()\n#31 /var/www/typo3/packages/bfallert/dfg-viewer/Classes/Middleware/SruMiddleware.php(58): class@anonymous->handle()\n#32 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): Slub\\Dfgviewer\\Middleware\\SruMiddleware->process()\n#33 /var/www/typo3/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelDataPersister.php(45): class@anonymous->handle()\n#34 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelDataPersister->process()\n#35 /var/www/typo3/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelRenderer.php(47): class@anonymous->handle()\n#36 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelRenderer->process()\n#37 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/ContentLengthResponseHeader.php(47): class@anonymous->handle()\n#38 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\ContentLengthResponseHeader->process()\n#39 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/ShortcutAndMountPointRedirect.php(69): class@anonymous->handle()\n#40 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\ShortcutAndMountPointRedirect->process()\n#41 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php(86): class@anonymous->handle()\n#42 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\PrepareTypoScriptFrontendRendering->process()\n#43 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php(108): class@anonymous->handle()\n#44 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\TypoScriptFrontendInitialization->process()\n#45 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php(131): class@anonymous->handle()\n#46 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\PageArgumentValidator->process()\n#47 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php(66): class@anonymous->handle()\n#48 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\PreviewSimulator->process()\n#49 /var/www/typo3/public/typo3/sysext/adminpanel/Classes/Middleware/SqlLogging.php(58): class@anonymous->handle()\n#50 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Adminpanel\\Middleware\\SqlLogging->process()\n#51 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/PageResolver.php(106): class@anonymous->handle()\n#52 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\PageResolver->process()\n#53 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/StaticRouteResolver.php(80): class@anonymous->handle()\n#54 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\StaticRouteResolver->process()\n#55 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/SiteBaseRedirectResolver.php(94): class@anonymous->handle()\n#56 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\SiteBaseRedirectResolver->process()\n#57 /var/www/typo3/public/typo3/sysext/redirects/Classes/Http/Middleware/RedirectHandler.php(102): class@anonymous->handle()\n#58 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Redirects\\Http\\Middleware\\RedirectHandler->process()\n#59 /var/www/typo3/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelInitiator.php(55): class@anonymous->handle()\n#60 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelInitiator->process()\n#61 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/FrontendUserAuthenticator.php(83): class@anonymous->handle()\n#62 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\FrontendUserAuthenticator->process()\n#63 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/BackendUserAuthenticator.php(66): class@anonymous->handle()\n#64 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\BackendUserAuthenticator->process()\n#65 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/MaintenanceMode.php(55): class@anonymous->handle()\n#66 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\MaintenanceMode->process()\n#67 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/SiteResolver.php(65): class@anonymous->handle()\n#68 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\SiteResolver->process()\n#69 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/EidHandler.php(64): class@anonymous->handle()\n#70 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\EidHandler->process()\n#71 /var/www/typo3/public/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php(45): class@anonymous->handle()\n#72 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Core\\Middleware\\NormalizedParamsAttribute->process()\n#73 /var/www/typo3/public/typo3/sysext/frontend/Classes/Middleware/TimeTrackerInitialization.php(58): class@anonymous->handle()\n#74 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(172): TYPO3\\CMS\\Frontend\\Middleware\\TimeTrackerInitialization->process()\n#75 /var/www/typo3/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(78): class@anonymous->handle()\n#76 /var/www/typo3/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(85): TYPO3\\CMS\\Core\\Http\\MiddlewareDispatcher->handle()\n#77 /var/www/typo3/public/typo3/sysext/frontend/Classes/Http/Application.php(69): TYPO3\\CMS\\Core\\Http\\AbstractApplication->handle()\n#78 /var/www/typo3/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(97): TYPO3\\CMS\\Frontend\\Http\\Application->handle()\n#79 /var/www/typo3/public/index.php(25): TYPO3\\CMS\\Core\\Http\\AbstractApplication->run()\n#80 /var/www/typo3/public/index.php(26): {closure}()\n#81 {main}"}

If I change the file
Classes/Common/Helper.php the adjustments made by commit #1258 in lines 416-417, the error no longer occurs.

Would I have to adjust something in a configuration so that this error does not occur?

Reproduction

Steps to reproduce the behaviour:

  1. open Typo3-Backend
  2. Open your data folder with "List"
  3. Scroll down to "documents"
  4. select a document and click on "edit record"
  5. click on "Save"
  6. See error

Screenshots and Examples

image

Environment

  • OS version: Debian GNU/Linux 11 (bullseye)
  • RDBMS version: MySQL 5.5.5-10.5.23-MariaDB-0+deb11u1
  • Apache Solr version: 8.11.2
  • TYPO3 version: 10.4.38
  • PHP version: 7.4.33

Additional Context

DFG Viewer is used in my installation to display documents

@sebastian-meyer sebastian-meyer added the 🐛 bug A non-security related bug. label Jul 11, 2024
@sebastian-meyer
Copy link
Member

@beatrycze-volk Since you made the change in #1258, could you please have a look at this bug report? @chrizzor also reported the same issue.

@beatrycze-volk
Copy link
Collaborator

@beatrycze-volk Since you made the change in #1258, could you please have a look at this bug report? @chrizzor also reported the same issue.

Yes, I will look into it.

@beatrycze-volk
Copy link
Collaborator

I have found explanation why SC_OPTIONS key is not present in the local configuration array:

Registering hooks, XCLASSes or any simple array assignments to $GLOBALS['TYPO3_CONF_VARS'] options will not work for the following:

...
configuration manager

https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ExtensionArchitecture/FileStructure/ExtLocalconf.html

So basically reading with ConfigurationManager class works if the TYPO3_CONF_VARS is filled inside LocalConfiguration.php or AdditionalConfiguration.php files. As those hooks are defined in ext_localconf.php file. That one is invisible for configuration manager.

Here relevant part of the documentation:

This would not work because the extension files ext_localconf.php are included (loadTypo3LoadedExtAndExtLocalconf) after the creation of the mentioned objects in the Bootstrap class.

In most cases, these assignments should be placed in typo3conf/AdditionalConfiguration.php.

In my DDEV I had all configurations duplicated in LocalConfiguration.php, so it worked while I was testing my changes.

@sebastian-meyer should I reverse to GLOBAL access for SC_OPTIONS or should be hooks moved to the LocalConfigration.php?

@sebastian-meyer
Copy link
Member

I'd prefer reverting to global access, because otherwise installing Kitodo.Presentation gets more complicated. Or is there an automated way of adding settings to LocalConfiguration.php during extension installation/activation?

@beatrycze-volk
Copy link
Collaborator

Eventually instead deciding for one way, we could add fallback for missing SC_OPTIONS in local config array. If this key is not found then fallback to GLOBAL. What about that?

@beatrycze-volk
Copy link
Collaborator

Something like that:

    private static function getLocalConfigurationByPath(string $path)
    {
        $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
        if (array_key_exists($path, $configurationManager->getLocalConfiguration())); {
            return $configurationManager->getLocalConfigurationValueByPath($path);
        }
        return $GLOBALS['TYPO3_CONF_VARS'][$path];
    }

@sebastian-meyer
Copy link
Member

Yes, that's a good compromise until we find a way to eventually get rid of accessing global variables!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug A non-security related bug.
Projects
None yet
3 participants