kitodo / kitodo-presentation

Kitodo.Presentation is a feature-rich framework for building a METS- or IIIF-based digital library. It is part of the Kitodo Digital Library Suite.
https://kitodo.github.io/kitodo-presentation/
GNU General Public License v3.0
39 stars 45 forks source link

[BUG] PHP Warning: Undefined array key "multipleSource". #1298

Open beatrycze-volk opened 3 months ago

beatrycze-volk commented 3 months ago

Description

The usage of array in newly inserted code is throwing errors in PHP 8:

Wed, 14 Aug 2024 15:01:20 +0000 [CRITICAL] request="774b121ecf4f4" component="TYPO3.CMS.Core.Error.DebugExceptionHandler": Core: Exception handler (WEB: FE): TYPO3\CMS\Core\Error\Exception, code #1476107295, file /var/www/html/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php, line 137: PHP Warning: Undefined array key "multipleSource" in /var/www/extensions/kitodo-presentation/Classes/Controller/AbstractController.php line 512- Exception: PHP Warning: Undefined array key "multipleSource" in /var/www/extensions/kitodo-presentation/Classes/Controller/AbstractController.php line 512, in file /var/www/html/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php:137 - {"mode":"WEB","application_mode":"FE","exception_class":"TYPO3\\CMS\\Core\\Error\\Exception","exception_code":1476107295,"file":"/var/www/html/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php","line":137,"message":"PHP Warning: Undefined array key \"multipleSource\" in /var/www/extensions/kitodo-presentation/Classes/Controller/AbstractController.php line 512","request_url":"https://sachsendigital.ddev.site/werkansicht?tx_dlf%5Bid%5D=https://digital.slub-dresden.de/data/kitodo/TheDarea_416971482-19060203/TheDarea_416971482-19060203_mets.xml","exception":"TYPO3\\CMS\\Core\\Error\\Exception: PHP Warning: Undefined array key \"multipleSource\" in /var/www/extensions/kitodo-presentation/Classes/Controller/AbstractController.php line 512 in /var/www/html/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php:137\nStack trace:\n#0 /var/www/extensions/kitodo-presentation/Classes/Controller/AbstractController.php(512)

Reproduction

Steps to reproduce the behaviour:

  1. Install TYPO3 11.x with PHP 8.x
  2. Click on link to display document page e.g. https://sachsendigital.ddev.site/werkansicht?tx_dlf[id]=https://digital.slub-dresden.de/data/kitodo/TheDarea_416971482-19060203/TheDarea_416971482-19060203_mets.xml
  3. See error

Expected Behavior

This kind of errors should not happen as Kitodo.Presentation provides support up to PHP 8.3. The handling of nonexistent array keys should be made appropriately.

Screenshots and Examples

phperror

Environment

sebastian-meyer commented 3 months ago

Tagging @chrizzor, because this was introduced with the MultiView feature in #1281.

csidirop commented 2 months ago

Not sure if this is the same error source but I'm getting a lot of similar Undefined array key warnings:

Tue, 03 Sep 2024 09:36:38 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "targetUid" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/TableOfContentsController.php line 134
Tue, 03 Sep 2024 09:36:38 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "targetUid" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/TableOfContentsController.php line 134
Tue, 03 Sep 2024 09:36:39 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "storagePid" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/AbstractController.php line 495
Tue, 03 Sep 2024 09:36:39 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "DOWNLOAD" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/ToolboxController.php line 330
Tue, 03 Sep 2024 09:36:39 +0000 [WARNING] request="aee72cc5a76fe" component="Kitodo.Dlf.Controller.ToolboxController": File not found in fileGrps "DOWNLOAD"
Tue, 03 Sep 2024 09:36:39 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "DOWNLOAD" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/ToolboxController.php line 374
Tue, 03 Sep 2024 09:36:40 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "useInternalProxy" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/PageViewController.php line 238
Tue, 03 Sep 2024 09:36:40 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "progressElementId" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/PageViewController.php line 146
Tue, 03 Sep 2024 09:36:40 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "useInternalProxy" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/PageViewController.php line 150
Tue, 03 Sep 2024 09:36:40 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "AUDIO" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/AudioPlayerController.php line 91
Tue, 03 Sep 2024 09:36:40 +0000 [WARNING] request="aee72cc5a76fe" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Undefined array key "pageStep" in /var/www/typo3/public/typo3conf/ext/dlf/Classes/Controller/NavigationController.php line 81

This is after (hard-)reloading a document page.

Environment:

beatrycze-volk commented 2 months ago

It is the same error which is visible for PHP 8.x. PHP 7.x is not displaying this warning.

The two fixes can be found here https://github.com/kitodo/kitodo-presentation/pull/1322 and here https://github.com/kitodo/kitodo-presentation/pull/1324.

The main cause for the problems is missing configuration from FlexForms. During the upgrade to TYPO3 11.x the FlexForms were also updated and since that time they are not read anymore. Some of the settings are read from TS config, but not all of them are configured there so those are missing.

Fixes mentioned above are helping by adding the default values but are not fixing the root cause.