retour-for-kirby icon indicating copy to clipboard operation
retour-for-kirby copied to clipboard

Version 4.0.0 causes error when opening redirects page in panel

Open timluigjes opened this issue 2 years ago • 7 comments

Describe the bug

When I install Retour for Kirby 4.0.0 on a site with Kirby version 3.6.2, I can't open the redirects page in the panel. It's giving me the following error in a popup: Call to a member function toArray() on bool

Also request to the redirects page fails and gives a 500 status code without any specific error.

Steps to reproduce

  1. Install Retour for Kirby using Composer
  2. Go to the panel and click on the Redirects button

Expected behavior

That the redirects page will show.

Additional context

  • The Kirby CMS uses the Dutch language as the default language.

E.g. screenshots Screenshot 2022-03-03 at 13 54 39 Screenshot 2022-03-03 at 13 47 46

Context

  • Browser: Chrome 98
  • Kirby version: 3.6.2
  • Retour version: 4.0.0
  • Retour config: /

timluigjes avatar Mar 03 '22 12:03 timluigjes

Any retour specific config set? Can you check if site/config/retour.yml exists when the error appears?

distantnative avatar Mar 03 '22 13:03 distantnative

@distantnative, I didn't add any specific retour to the config file, It's a clean install. The retour.yml didn't exist after installation, I hoped adding it would solve the error. But sadly not. (I tried an empty retour.yml file and one with a redirect set manually)

timluigjes avatar Mar 03 '22 13:03 timluigjes

After some digging I found out that de dates table doesn't exist in the log.sqlite, which makes the database query in the stats function in src/classes/Log.php fail. When I disable the log feature, the page is working again.

timluigjes avatar Mar 04 '22 09:03 timluigjes

@timluigjes do you know if the log.sqlite file was there before? or did Retour create it from scratch with that flaw?

distantnative avatar Mar 04 '22 10:03 distantnative

@distantnative, It was created from scratch. This morning I tried it with a fresh Kirby CMS install and I got the same error.

timluigjes avatar Mar 04 '22 10:03 timluigjes

I'm sorry that this hasn't been fixed yet but still haven't been able to reproduce it on my end

distantnative avatar Jun 25 '22 11:06 distantnative

I am getting this error too. Locally everything works.

Apache server production and localhost, PHP 8.0.24, Kirby 3.7.3, Retour 4.2.0

All the same, as @timluigjes noted.

mynameisfreedom avatar Oct 18 '22 15:10 mynameisfreedom

Updated a client's website earlier this week to the latest version of Kirby 3.7 with Retour 4.2.0. Sadly the error still occurs, When the logging functionality is disabled, the panel is viewable.

@mynameisfreedom if you add the following to the Kirby config, it will work again: 'distantnative.retour' => ['logs' => false]

I was quite busy the last couple of months, but later this week I'll try to resolve this error and provide a PR if I found a solution.

timluigjes avatar Oct 26 '22 08:10 timluigjes

I'm digging into this error now... as far is I could get, there is an issue with the SQL here. The error is Error: near "with": syntax error

The reason is, that the ability for "recursive-select" was introduced in sqlite 3.34.0. The host I'm running is only capable of sqlite 3.7... I'm not able to get an update for that so I guess one needs to alter the query...?

gerricom avatar Jan 20 '23 16:01 gerricom

@gerricom first of all thanks a lot for getting to the bottom of this. I think this explains it!

I'd need help to see if there is a different sql statement that achieves the same.

Or if there is a way I can check the SQLite version in PHP and throw an error if it doesn't support the required functions.

distantnative avatar Jan 20 '23 21:01 distantnative

I run into the same issue. It works fine on my localhost. On my production server it creates the database in the logs folder, but I get the error Call to a member function toArray() on bool I have Kirby 3.9.4 and retour 4.4.2 installed. I can't figure out which sqlite version is running on my production sever. How can i get this to work?

movingwater avatar Jun 12 '23 21:06 movingwater

@movingwater As you probably read this seems to be really about the SQLite version, so probably getting in touch with your provider and figuring out if you/they can update it

distantnative avatar Jun 12 '23 21:06 distantnative