backdrop-contrib / l10n_server

Provides a generic translation database backend with a community localization user interface, which allows people to collaborate on translating projects to different languages.
0 stars 5 forks source link

TypeError ksort with PHP 8.1 #25

Open olafgrabienski opened 8 months ago

olafgrabienski commented 8 months ago

On a test site running on PHP 8.1, with Localization Server I get no content but the following error on the page example.com/translate:

TypeError: ksort(): Argument #1 ($array) must be of type array, null given in ksort() (line 862 of .../modules/l10n_server/l10n_community/pages.inc).

When I switch to PHP 7.4, I can visit the page without problems.

argiepiano commented 6 months ago

I'm unable to reproduce this. I just did a clean Backdrop installation using 8.1, and enabled :

And all their dependencies. Visiting example.com/translate shows:

Screen Shot 2024-03-25 at 9 46 04 PM

Is there perhaps some missing step?

olafgrabienski commented 6 months ago

Is there perhaps some missing step?

Thanks for trying to reproduce the issue! I'll have another look, hopefully next week, and will try to provide more detailed steps.

robertgarrigos commented 1 month ago

I'm having this error in https://traduccio.backdrop.cat/translate/projects/usertabs

the problem is here:

if (empty($rid)) {
    $rid = db_query("SELECT pf.rid FROM {l10n_server_release} sr INNER JOIN {l10n_packager_file} pf ON sr.rid = pf.rid WHERE pid = :pid ORDER BY pf.rid DESC LIMIT 0, 1", array(':pid' => $pid))->fetchField();
  }

which returns null because, in my case, there is no entry in the l10n_packager_file table. I had to go to https://traduccio.backdrop.cat/admin/l10n_server/packagerand repackage all the translations for the usertabs module. That fixed the problem. It might be a good idea to show a message with an explanation and a link to the repackage page instead of having a php error.