$kirby->option() in 3.4.0 splits item when it has a dot in text?

Just upgraded from 3.3.6 to 3.4.0 and I’m seeing a difference in the returned data from $kirby->options() pulling stuff from config when an item has a dot in the text.

Anyone else seeing this?

If we have a config like:

  'my_assets' => [
    'google-touch-icon.png'  => 'google-touch-icon.png',

Some code like:

define('ASSETS', $kirby->option('my_assets'));
  1. k v3.3.6 returns
    { ["google-touch-icon.png"]=> string(21) "google-touch-icon.png"...

  2. k v3.4.0
    { ["google-touch-icon"]=> array(1) { ["png"]=> string(21) "google-touch-icon.png" ...

See how v3.4.0 has split the item on the dot in the file name to create a second part as an array to the first item.

Any idea how to fix this?
PHP 7.4.8

The easiest way is to rename the key from google-touch-icon.png to google-touch-icon.

 'my_assets' => [
    'google-touch-icon'  => 'google-touch-icon.png',

Edit: Looks like the changes regarding dot notation will be rolled back in the next version, however, since there is not really a reason why your key should have the file extension, changing the option name now probably makes sense anyway.

Hi texnixe, thanks for the advice, but I am not sure I can have them without the extension. It an array of files (or directories) to copy from/ copy to. So the extensions will vary as do the paths and as mentioned sometimes they are folders.

'my_assets' => [
        'google-touch-icon.png'       => 'google-touch-icon.png',
        'favicon.svg'                          => 'favicon.svg',
        'mask-icon.svg'                     => 'mask-icon.svg',
        'manifest.json'                       => 'manifest.json',
        'quotes.json'                          => 'quotes.json',
        'assets/js/lazyload.js'            => 'assets/js/lazyload.js',
        'some/folder/'                        => 'some/folder/'

Any suggestions, when is the next version?

Ah, ok, yes, then it won’t work.

The pre-release is scheduled for tomorrow, final release one week later.

Background: https://github.com/getkirby/kirby/issues/2697#issuecomment-663969201

As ever texnixe, awesome support! Read the linked post and I understand the reasons for the change, but of course would still like a step back :wink:
I’ll download the next version when I get the chance.

This is fixed (reverted) in the beta 3.4.1-rc.1

1 Like