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

Kaos 55.1 - E_WARNING: Undefined array key 0 #4252

Closed
Zweihorn opened this issue Mar 29, 2024 · 6 comments
Closed

Kaos 55.1 - E_WARNING: Undefined array key 0 #4252

Zweihorn opened this issue Mar 29, 2024 · 6 comments
Labels

Comments

@Zweihorn
Copy link
Contributor

Zweihorn commented Mar 29, 2024

The problem

Browser accessing the "Configuration Settings" page from the "Administration" page as admin. However, the "Configuration Settings" page is displayed without further issue.

Version of DokuWiki

2024-02-06a "Kaos" [55.1]

PHP Version

8.2.7

Webserver and version of webserver

Apache 2.4.57-2 on Debian Linux 12.5 Bookworm

Browser and version of browser, operating system running browser

Firefox 115.9.1esr (64-Bit) on macOS 10.5.7

Additional environment information

Freshly installed 2024-02-06a "Kaos" [55.1] instance. De-installing all three uploaded extensions apparently not compatible with "Kaos" did not help.

sprintDoc Template
Installed version:
2024-03-12

Relevant logs and/or error messages

2024-03-29 19:31:15  E_WARNING: Undefined array key 0/var/www/html/dokuwiki/lib/plugins/config/core/Loader.php(216)
    #0 /var/www/html/dokuwiki/lib/plugins/config/core/Loader.php(216): dokuwiki\ErrorHandler::errorHandler()
    #1 /var/www/html/dokuwiki/lib/plugins/config/core/Loader.php(66): dokuwiki\plugin\config\core\Loader->loadExtensionMeta()
    #2 /var/www/html/dokuwiki/lib/plugins/config/core/Configuration.php(52): dokuwiki\plugin\config\core\Loader->loadMeta()
    #3 /var/www/html/dokuwiki/lib/plugins/config/admin.php(43): dokuwiki\plugin\config\core\Configuration->__construct()
    #4 /var/www/html/dokuwiki/inc/Action/Admin.php(35): admin_plugin_config->handle()
    #5 /var/www/html/dokuwiki/inc/ActionRouter.php(86): dokuwiki\Action\Admin->preProcess()
    #6 /var/www/html/dokuwiki/inc/ActionRouter.php(49): dokuwiki\ActionRouter->setupAction()
    #7 /var/www/html/dokuwiki/inc/ActionRouter.php(62): dokuwiki\ActionRouter->__construct()
    #8 /var/www/html/dokuwiki/inc/actions.php(19): dokuwiki\ActionRouter::getInstance()
    #9 /var/www/html/dokuwiki/doku.php(131): act_dispatch()
    #10 {main}
@Zweihorn Zweihorn added the Bug label Mar 29, 2024
@Zweihorn
Copy link
Contributor Author

May be linked to #4193 (comment)

@fiwswe
Copy link
Collaborator

fiwswe commented Mar 30, 2024

The root cause seems to be that some plugin apparently has some weird/illegal data in its …/conf/metadata.php file.

$meta is assumed to be an array of key => value tuples with each value being an array with at least one element. See Configuration Metadata

Which plugins do you have installed?
And which one does not conform to the defined standard?

However

if ($value[0] == 'fieldset') continue; //plugins only get one fieldset
could be more tolerant here. For example like this:

            if (($value[0] ?? null) == 'fieldset') continue; //plugins only get one fieldset

@fiwswe
Copy link
Collaborator

fiwswe commented Mar 30, 2024

PS. It could also be an installed template, not a plugin.

@Zweihorn
Copy link
Contributor Author

THX @fiwswe

Culprit found as the template sprintdoc in lib/tpl/sprintdoc/conf/metadata.php last line as follows:

<?php

$meta['sidebar_sections'] = array(
                                'multichoice',
                                '_choices' => array(
                                    'h1',
                                    'h1,h2',
                                    'h1,h2,h3,h4,h5',
                                    'li.level1 > .li',
                                ),
                            );

$meta['header_layout'] = array(
                            'multichoice',
                            '_choices' => array(
                                'header-default',
                                'header-compact',
                            ),
                        );

$meta['autocollapse'] = array('onoff');
$meta['closedwiki'] = array('onoff');
$meta['copyright'] = [];

After changing the last line to $meta['copyright'] = array(''); there is no warning in the log file. The "Configuration Settings" page works without issue and shows the intended behaviour with the "tpl»sprintdoc»copyright" setting.

The a.m. syntax change is in accordance with https://www.dokuwiki.org/devel:configuration#classes and provides a "Default class ('setting'), textarea" definition. This avoids the 'null' reference and should meet the expectations.

Voila.

@Zweihorn
Copy link
Contributor Author

NB

A change to $meta['copyright'] = ['']; could be sufficient but I prefer a syntax in accordance with the https://www.dokuwiki.org/devel:configuration#classes definitions. Thus $meta['copyright'] = array(''); as above.

@Zweihorn
Copy link
Contributor Author

This is a bug of the a.m. template and this PR can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants