Config syntax: dots VS nested arrays

I’m trying to split my very long config file into multiple subfiles. I’ve seen how it’s supposed to be done in the docs but it doesn’t seem to work how I expect it to.

I expected this code:

['plugin.namespace.option'] => 'value'

To behave the same as:

['plugin' => [
  'namespace' => [
    'option' => value
  ]
]

But it’s not, right?

I use one base config file as well as one per environment and the merge seems to create duplicates or loose some values depending on how you set the options.

unrolling the dot-notion seems to work only when retrieving the value. not when setting the value in the config.

1 Like

This is known issue:

Ha! Thanks for your answers.

I have two questions to this issue:


1. In which Kirby version this error will be solved?


2. The plugin Kirby log plugin encodes as follows:

  $logroot = kirby()->roots()->site() . DS . kirby()->option("bvdputte.kirbylog.logfolder");

What must the line in the config file site\config\config.php look like until the error was gone?

This …

    'bvdputte.kirbylog.logfolder' => 'logs',

… does not work for me in Kirby 3.3.2 running on Win10 – XAMPP 7.2.15 – Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.2.15.


Many thanks for your help!

This is correct and works.

Where are you using the code to log something? In a cached page, maybe?

I run an extended Starterkit 3.3.2.
In the login controller and in the logout route I added the code to log every login and logout.

The code of the plugin runs, but the log file is not saved in the directory site\logs like my config file, but in the default directory site\kirbylogs.

It is the default directory, if I add ‘ . kirby()->option("bvdputte.kirbylog.logfolder")’ to the logged text.

The code in the controller then looks like

      $kirbyLogger = kirbyLog("kirbylogin_log.log");
      $kirbyLogger->log("'" . $kirby->user()->username() . "' has logged in. | "  . kirby()->option("bvdputte.kirbylog.logfolder"));

Well, maybe there’s something wrong in your config. It works for me.

1 Like

@texnixe:
Oh, as usual you’re right. Thank you.
I checked and corrected my config file. Now everything is as it should be.