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

Language handlers may not always be loaded properly #5147

Closed
bmeirellesRJ opened this issue Jan 7, 2023 · 48 comments
Closed

Language handlers may not always be loaded properly #5147

bmeirellesRJ opened this issue Jan 7, 2023 · 48 comments
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue
Milestone

Comments

@bmeirellesRJ
Copy link

bmeirellesRJ commented Jan 7, 2023

I'm trying to install on debian bookworm
I'm installing using APT
the browser shows error 500
my apache is 2.4.54 and my php is 8.1.12

this appears in the apache log:

[Sat Jan 07 14:07:12.322217 2023] [php:error] [pid 55502] [client 192.168.254.100:57408] 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(312): PhpMyAdmin\MoTranslator\Translator->__construct()\n#1 /usr/share/cacti/site/include/global_languages.php(254): load_gettext_motranslator()\n#2 /usr/share/cacti/site/include/global.php(527): include_once('...')\n#3 /usr/share/cacti/site/include/auth.php(27): require_once('...')\n#4 /usr/share/cacti/site/index.php(25): include('...')\n#5 {main}\n thrown in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line 115
[Sat Jan 07 14:07:12.322446 2023] [php:warn] [pid 55502] [client 192.168.254.100:57408] PHP Warning: Trying to access array offset on value of type null in /usr/share/cacti/site/lib/functions.php on line 5866
[Sat Jan 07 14:07:12.326601 2023] [php:warn] [pid 55502] [client 192.168.254.100:57408] PHP Warning: Trying to access array offset on value of type null in /usr/share/cacti/site/lib/functions.php on line 5931

@bmeirellesRJ bmeirellesRJ added bug Undesired behaviour unverified Some days we don't have a clue labels Jan 7, 2023
@TheWitness
Copy link
Member

Is this a new install or upgrade?

@TheWitness
Copy link
Member

Also, what OS and was it installed via package or source?

@bmeirellesRJ
Copy link
Author

Is this a new install or upgrade?

new install

@bmeirellesRJ
Copy link
Author

Also, what OS and was it installed via package or source?

Installing package using apt

@TheWitness
Copy link
Member

Can you please open a debian bug before we go any further. It's a packaging issue and @paulgevers needs to know about it.

@bmeirellesRJ
Copy link
Author

Is this a new install or upgrade?

cacti (1.2.23+ds1-1)

@TheWitness
Copy link
Member

Let me know the ticket #.

@TheWitness
Copy link
Member

I won't write off a cacti issue too though. I just don't have this issue on RHEL, but it could be I'm using php's built in language processor vs. the one you are using.

@TheWitness
Copy link
Member

See if the php-gettext module is available. I'm thinking not for Debian/Ubuntu. If it is, you should install and then restart Apache + php-fpm.

@TheWitness
Copy link
Member

Looking at the error, it seems to be a dependency issue between PHP MyAdmin and cacti. So, definitely needs to be logged with Debian. If you uninstall php-myadmin, it might reconcile the issue though. I'm not sure.

@bmeirellesRJ
Copy link
Author

Can you please open a debian bug before we go any further. It's a packaging issue and @paulgevers needs to know about it.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1028141

@bmeirellesRJ
Copy link
Author

php-myadmin

php-phpmyadmin-motranslator is already the newest version (5.3.0-1).

if i try to remove, cacti is removed too

@TheWitness
Copy link
Member

Okay, so interesting.

TheWitness added a commit that referenced this issue Jan 7, 2023
@TheWitness
Copy link
Member

Okay, pull the lib/function.php that I just committed and replace yours and let's see how far you get... It'll be in the 1.2.x branch.

@bmeirellesRJ
Copy link
Author

Okay, pull the lib/function.php that I just committed and replace yours and let's see how far you get... It'll be in the 1.2.x branch.

I tested it in an English language virtual machine browser and it works. the error appears on a Brazilian Portuguese computer. computer with other languages should give error too

@TheWitness
Copy link
Member

Understood. Make sure you update the Debian ticket.

@bmeirellesRJ
Copy link
Author

Understood. Make sure you update the Debian ticket.

Updated. Thanks a lot for the help

@TheWitness
Copy link
Member

Okay, I think I found the solution. Some bad code in our language processor. Let me give you one more patch. You should be able to change languages freely then.

@TheWitness TheWitness added confirmed Bug is confirm by dev team and removed unverified Some days we don't have a clue labels Jan 7, 2023
@TheWitness TheWitness added this to the v1.2.24 milestone Jan 7, 2023
@TheWitness TheWitness changed the title Error 500 on apache. Can someone help me? 1.2.23 - Error 500 on apache. Can someone help me? Jan 7, 2023
@TheWitness TheWitness changed the title 1.2.23 - Error 500 on apache. Can someone help me? 1.2.23 - Error 500 on apache when changing languages Jan 7, 2023
TheWitness added a commit that referenced this issue Jan 7, 2023
Error 500 on apache when changing languages
@TheWitness
Copy link
Member

TheWitness commented Jan 7, 2023

If you pull the include/global_languages.php from the 1.2.x branch, this will be resolved for all languages. Thanks for reporting this!

TheWitness added a commit that referenced this issue Jan 7, 2023
Error 500 on apache when changing languages
@paulgevers
Copy link
Contributor

Thanks for the notification. Seems worth fixing :) .

@netniV, @TheWitness : for info, we're nearly starting the first freeze for Debian. I wouldn't be surprised if 1.2.23 would be the version we ship in bookworm.

Our release schedule: https://release.debian.org/testing/freeze_policy.html

@TheWitness
Copy link
Member

Cool. If you incorporate these changes, that would be good. I've asked Mark to wait a few more weeks and then push a 1.2.24. So, a quick release, but after we have another week or so for things to settle.

@TheWitness
Copy link
Member

@bmeirellesRJ, two options. Grab the two file, or grab the whole thing. We've done a few additional tweaks today, but our QA team gave it the final approval a few hours ago.

@netniV
Copy link
Member

netniV commented Jan 8, 2023

If we had any later dependencies these would have to be in and released in the next day or two. Otherwise, 1.2.x has another month before it needs a release.

We can certainly try to get another one done to tidy up a few bits at the beginning of feb which means internal code freeze on that branch a week before.

@paulgevers
Copy link
Contributor

If we had any later dependencies these would have to be in and released in the next day or two. Otherwise, 1.2.x has another month before it needs a release.

We can certainly try to get another one done to tidy up a few bits at the beginning of feb which means internal code freeze on that branch a week before.

Just for you info, I'm already building a fixed Debian version, so that's not the problem. I can easily pull in a new version of cacti until 2023-02-12. I also expect I can still pull in a new cacti version until 2023-03-12, depending on the size of the changes. After that, I think the window is starting to close.

@TheWitness
Copy link
Member

TheWitness commented Jan 8, 2023

@paulgevers we are hip deep in 1.3 now. So, you are safe to pull. Just check back about a week before the freeze to get any updates. Any 1.2.23 bugs will show with the 1.2.23 prefix in the issues database.

Amongst the Core team, we have an agreement that it's time to move on to 1.3 which should be evident by all the recent activity.

@paulgevers
Copy link
Contributor

@TheWitness just to check if I understand you correctly. You mean it's safe to pull from the 1.2 branch, or do you mean I can already pull from the 1.3 branch. I assume you meant the former and that you don't recommend me to put 1.3 in the upcoming stable.

@TheWitness
Copy link
Member

@paulgevers 1.2 is safe to pull. We are still working on several features for 1.3.

@bmeirellesRJ
Copy link
Author

@bmeirellesRJ, two options. Grab the two file, or grab the whole thing. We've done a few additional tweaks today, but our QA team gave it the final approval a few hours ago.

Good morning, apparently resolved. Other problems appeared but I believe it was my installation because it replaces the entire folder and as I installed it using the .deb package, the folder structure is different from what was created in the database. Confirm as soon as the update is available on debian. Thank you for helping me.

I also found a bug in a template and I have suggestions to improve others, where can I deal with this matter? Opening pull request?

@netniV
Copy link
Member

netniV commented Jan 9, 2023

You can should open an issue tracker, and then create a pull request for it. The main reason being, any updates should have a corresponding CHANGELOG entry so it gets you the number without needing a subsequent commit or review asking for that.

@netniV
Copy link
Member

netniV commented Jan 9, 2023

@paulgevers I would suggest, 2 weeks before any freeze preventing you from having 1.2.24, we prepare our release which will include a code freeze (except for critical bugs) for one week before we release. That should give you a week, would that be enough?

@paulgevers
Copy link
Contributor

Hmm, with all the changes applied to include/global_languages.php and lib/functions.php, I still get:

2023-01-09 21:50:01 - ERROR PHP Unknown Error: Uncaught Error: Class "PhpMyAdmin\MoTranslator\Cache\InMemoryCache" not found in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php:115 Stack trace: #0 /usr/share/cacti/site/include/global_languages.php(312): PhpMyAdmin\MoTranslator\Translator->__construct() #1 /usr/share/cacti/site/include/global_languages.php(254): load_gettext_motranslator() #2 /usr/share/cacti/site/include/global.php(527): include_once('...') #3 /usr/share/cacti/site/include/auth.php(27): require_once('...') #4 /usr/share/cacti/site/settings.php(25): include('...') #5 {main} thrown in file: /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line: 115
2023-01-09 21:50:01 - CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())

I'm going to check the delta of motranslator between the vendored version and the one shipped in Debian.

@paulgevers
Copy link
Contributor

paulgevers commented Jan 9, 2023

Hmm, can't find that, but my history links to commit 92aa644. Maybe that's relevant for context.

And some more humming, I wonder if this has been broken for a longer time. Maybe I should try an older version too.

@paulgevers
Copy link
Contributor

Seems like 1.2.21 was also broken, so at least cacti wise this isn't a recent regression. I tested with the deb from snapshots. Going back further is a bit more involved due to changes in the c3 javascript packages in Debian

@paulgevers
Copy link
Contributor

I wonder if this could be a problem in [php-phpmyadmin-motranslator](https://packages.debian.org/unstable/php-phpmyadmin-motranslator) but I don't know how to debug that.

@bmeirellesRJ
Copy link
Author

Hmm, with all the changes applied to include/global_languages.php and lib/functions.php, I still get:

2023-01-09 21:50:01 - ERROR PHP Unknown Error: Uncaught Error: Class "PhpMyAdmin\MoTranslator\Cache\InMemoryCache" not found in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php:115 Stack trace: #0 /usr/share/cacti/site/include/global_languages.php(312): PhpMyAdmin\MoTranslator\Translator->__construct() #1 /usr/share/cacti/site/include/global_languages.php(254): load_gettext_motranslator() #2 /usr/share/cacti/site/include/global.php(527): include_once('...') #3 /usr/share/cacti/site/include/auth.php(27): require_once('...') #4 /usr/share/cacti/site/settings.php(25): include('...') #5 {main} thrown in file: /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line: 115
2023-01-09 21:50:01 - CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())

I'm going to check the delta of motranslator between the vendored version and the one shipped in Debian.

it appeared with me too, I had to replace all files

@netniV
Copy link
Member

netniV commented Jan 9, 2023

I would say that's a PhpMyAdmin problem. Clearly, their constructor is trying to use a cache but fails to find the Class for it via their autoloader (or maybe by whatever autoloader is being introduced with the packaged version attached to cacti ?)

@netniV
Copy link
Member

netniV commented Jan 10, 2023

@paulgevers I assume in your package you are updating the global_languages.php with a patch to correct the localization of motranslator when CACTI_LANGUAGE_HANDLER_MOTRANSLATOR has been as the CACTI_LANGUAGE_HANDLER?

@netniV
Copy link
Member

netniV commented Jan 10, 2023

Are you including the autoload.php file at that point? Is the include_path set to be /usr/share/php so that it can be searched for the components?

TheWitness added a commit that referenced this issue Jan 10, 2023
This fix is from the result of an illegal format character in the auth_login.php page that was identified by virtue of the fix #5147
TheWitness added a commit that referenced this issue Jan 10, 2023
Regression from #5147 therefore no ChangeLog
@paulgevers
Copy link
Contributor

paulgevers commented Jan 10, 2023

@netniV all I do is create a symlink from the packaged motranslator (I honestly don't understand why PhpMyAdmin is in that name, it seems a separate project, but maybe it shares history) to the cacti folder:

/usr/share/php/PhpMyAdmin/MoTranslator      /usr/share/cacti/site/include/vendor/motranslator/src

I don't do anything else as far as I recall.

@netniV
Copy link
Member

netniV commented Jan 10, 2023

Ah, well that is likely the issue. The autoload.php isn't being included I reckon, and I also feel like if the include_path isn't set to /usr/share/php then it would also fail to load the symphony components too

@netniV
Copy link
Member

netniV commented Jan 10, 2023

With regards to the directory naming, PhpMyAdmin is the project owner. PhpMyAdmin project would presumably be PhpMyAdmin/PhpMyAdmin. I do have the MoTranslator package installed as I was looking at your problem. Let me see if I can get it working for you, but I do feel we should have a specific issue for this separate from what this issue tracker is about. You have a very specific Debian problem which may not be present on other systems.

@netniV
Copy link
Member

netniV commented Jan 11, 2023

@paulgevers Give the langauge branch a test, it's not complete as I want to improve the fallback through other processors if the selected one doesn't exist. It worked for me.

https://github.com/cacti/cacti/tree/language

@paulgevers
Copy link
Contributor

@netniV thanks a bunch for working on it. Given that motranslator is not the embedded cacti translator I totally agree that in essence this is a problem I'm responsible for. I appreciate you help with it.

I though that this issue started because the reporter was running a Debian system, but maybe I misunderstood and languages were also broken in non-Debian context.

I'll try your branch later tonight (CET) or tomorrow.

@netniV
Copy link
Member

netniV commented Jan 11, 2023

OK, thanks. Once you have the issue created and the branch tested, we can merge that.

@Cacti Cacti locked as resolved and limited conversation to collaborators Jan 11, 2023
@netniV netniV changed the title 1.2.23 - Error 500 on apache when changing languages Language handlers may not always be loaded properly Feb 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 resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

4 participants