Kirby (v1) contact form not working after upgrade to php 7

Hello guys,

a client just updated his server to php7. Kirby v1 is still working beautifully, but the contact form plugin now throws 2 php notices after submitting a new contact-form-request.

(1) Array to string conversion on line 56 in uri.php
(2) Indirect modification of overloaded property uriParams::$Array has no effect on line 56 in uri.php

Is there any way to fix that or do I have to upgrade to Kirby 2?

Here is the relevant code snippet from kirby/uri.php

// parse params
52  foreach($path AS $p) {
53      if(str::contains($p, c::get('uri.param.separator'))) {
54        $parts = explode(c::get('uri.param.separator'), $p);
55    if(count($parts) < 2) continue;
56        $this->params->$parts[0] = $parts[1];
57      } else {
58        $this->path->_[] = $p;
59      }
60    }

The message is being sent correctly to the specified adress, however the php-notices kind of destroy the website layout.

I would appreciate any help! Thanks in advance!

Kirby 1 is no longer supported and developed, so it might make sense to upgrade to get the latest updates and fixes. Most Kirby 1 code is still compatible with Kirby 2 and the upgrade is free.

Regarding your issue: PHP 7 changed the syntax for this kind of indirect variable access and requires the user to be more explicit there. It should work if you replace line 56 with the following:

$this->params->{$parts[0]} = $parts[1];

Thank you very much, that was a way easier solution than I expected. Awesome!

It definitely makes sense to upgrade to Kirby 2 and the upgrade is already scheduled for later this year. Thanks again for your help. :slightly_smiling: