Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations on debian 'bookworm' systems may cause server errors #5160

Closed
paulgevers opened this issue Jan 13, 2023 · 9 comments
Closed

Translations on debian 'bookworm' systems may cause server errors #5160

paulgevers opened this issue Jan 13, 2023 · 9 comments
Assignees
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team core/config A core feature either system level or config translation Translation issue
Milestone

Comments

@paulgevers
Copy link
Contributor

Describe the bug

This is a follow up of issue #5147. With the patch train provided by @netniV on top of the #5147 commits, the error message is still the same. I verified that /usr/share/php is in the include_path according to the cacti viewtech phpinfo page (although I couldn't find where it set).

[Thu Jan 12 15:27:31.996663 2023] [php:error] [pid 1005126] [client 127.0.0.1:38190] PHP Fatal error:  Uncaught Error: Class "PhpMyAdmin\\MoTranslator\\Cache\\InMemoryCache" not found in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php:115\nStack trace:\n#0 /usr/share/cacti/site/include/global_languages.php(379): PhpMyAdmin\\MoTranslator\\Translator->__construct()\n#1 /usr/share/cacti/site/include/global_languages.php(190): load_gettext_motranslator()\n#2 /usr/share/cacti/site/include/global.php(539): include_once('...')\n#3 /usr/share/cacti/site/include/auth.php(27): require_once('...')\n#4 /usr/share/cacti/site/settings.php(25): include('...')\n#5 {main}\n  thrown in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line 115

In Debian, the version in stable (bullseye) seems to work as expected. The php-phpmyadmin-motranslator package has changed since bullseye, the caching is new.

Although I believe this is a problem that mostly lies with Debian, I'm glad with the help offered by @netniV. I hope we can improve the code to help debugging, even if I need to fix the issue in the end in Debian.

@paulgevers paulgevers added bug Undesired behaviour unverified Some days we don't have a clue labels Jan 13, 2023
@paulgevers
Copy link
Contributor Author

With the $i18n_log set, I get the following log:

get_language_file(".mo", "/locales/LC_MESSAGES/", "/usr/share/cacti/site"): Yes - "/usr/share/cacti/site/locales/LC_MESSAGES/nl-NL.mo"
get_language_file(".js", "jquery-ui-datepicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-datepicker-nl-NL.js"
get_language_file(".js", "jquery-ui-datepicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-datepicker-nl.js"
get_language_file(".js", "jquery-ui-timepicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-timepicker-nl-NL.js"
get_language_file(".js", "jquery-ui-timepicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-timepicker-nl.js"
get_language_file(".js", "jquery-ui-colorpicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-colorpicker-nl-NL.js"
get_language_file(".js", "jquery-ui-colorpicker-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-colorpicker-nl.js"
get_language_file(".js", "jquery-ui-multiselect-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-multiselect-nl-NL.js"
get_language_file(".js", "jquery-ui-multiselect-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-multiselect-nl.js"
get_language_file(".js", "jquery-ui-multiselect-filter-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-multiselect-filter-nl-NL.js"
get_language_file(".js", "jquery-ui-multiselect-filter-", "/usr/share/cacti/site/include"): No - "/usr/share/cacti/site/includejquery-ui-multiselect-filter-nl.js"
Attempt to find the handler
require(1): Defined handler 0
get_src_language_provider(null) : 1 - No  - /usr/share/cacti/site/include/vendor/phpgettext/streams.php
get_src_language_provider(null) : 3 - No  - /usr/share/cacti/site/include/vendor/MoTranslator/Translator.php
get_src_language_provider(null) : 3 - No  - /usr/share/cacti/site/include/vendor/motranslator/Translator.php
get_src_language_provider(null) : 3 - Yes - /usr/share/cacti/site/include/vendor/motranslator/src/Translator.php
get_src_language_provider(null) : 3 - Selecting with 1 paths
require(1): Selected handler 3
require(1): Requiring /usr/share/cacti/site/include/vendor/motranslator/src/Translator.php
require(1): Requiring /usr/share/cacti/site/include/vendor/motranslator/src/StringReader.php
require(2): Final handler 3
load_language(cacti): /usr/share/cacti/site/locales/LC_MESSAGES/nl-NL.mo
load_gettext_mostranslator(cacti): /usr/share/cacti/site/locales/LC_MESSAGES/nl-NL.mo

@netniV
Copy link
Member

netniV commented Jan 13, 2023

Those logs look good. I'm going to commit the patch we have, and then if we need to adjust that, there'll be a follow-up commit.

@netniV
Copy link
Member

netniV commented Jan 13, 2023

There does seem to be a problem with the javascript includes though... need to check that.

@netniV netniV added this to the v1.2.24 milestone Jan 13, 2023
@netniV netniV self-assigned this Jan 13, 2023
@netniV netniV added translation Translation issue confirmed Bug is confirm by dev team core/config A core feature either system level or config and removed unverified Some days we don't have a clue labels Jan 13, 2023
@netniV
Copy link
Member

netniV commented Jan 13, 2023

Hi @paulgevers,

Unfortunately, I don't have those packages. My system works with the current MoTranslator.

Can you possibly zip up the /usr/share/php folder to send over those packages installed for me? I can then replace my local version and see what's going on (after backing mine up first of course!). Otherwise, I'd need a bullseye system to properly test on.

One thing you could try and do is replace the use of Translator.php and StreamReader.php with autoload.php alone. That may make things work properly.

@paulgevers
Copy link
Contributor Author

https://packages.debian.org/sid/all/php-phpmyadmin-motranslator/download has links to the Debian packages that you can use to get the files (obviously in a tiny bit weird container, but alas). Let me know if that works for you.

@paulgevers
Copy link
Contributor Author

paulgevers commented Jan 13, 2023

And replacing

			'files' => ['Translator.php', 'StringReader.php' ],

with

			'files' => ['autoload.php' ],

seems to work.

@netniV
Copy link
Member

netniV commented Jan 13, 2023

OK, so I think we will update with that and I will test if with works with the current environment, since I have that installed.

@paulgevers
Copy link
Contributor Author

By the way (maybe worth a different report) after switching the language in the settings, you need to clear your session cookie to make it active.

@netniV
Copy link
Member

netniV commented Jan 13, 2023

Yes, please create a separate issue for that. I thought that had been handled previously though.

@netniV netniV closed this as completed in aacf0ec Jan 13, 2023
@netniV netniV changed the title [Debian] translations cause server error and blank pages Translations on debian 'bookworm' systems may cause server errors Jan 14, 2023
TheWitness added a commit that referenced this issue Jan 22, 2023
Host table status_fail_date and Status_rec_date can appear wrong
TheWitness added a commit that referenced this issue Jan 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team core/config A core feature either system level or config translation Translation issue
Projects
None yet
Development

No branches or pull requests

2 participants