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

Backtraces Logged in Cacti 1.2.x Branch - Gettext Translation #4521

Closed
reubenfarrelly opened this issue Jan 3, 2022 · 12 comments
Closed

Backtraces Logged in Cacti 1.2.x Branch - Gettext Translation #4521

reubenfarrelly opened this issue Jan 3, 2022 · 12 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@reubenfarrelly
Copy link

Unfortunately I don't know what the trigger is for this backtrace (it has occurred twice today, once at 5am and another after 10am) but this has been logged:

Gentoo Linux x86_64 with php-8.1.1 and cacti git 1.2.x branch.

03/Jan/2022 10:05:26 - SYSTEM STATS: Time:24.2499 Method:cmd.php Processes:1 Threads:1 Hosts:26 HostsPerProcess:26 DataSources:418 RRDsProcessed:249
03/Jan/2022 10:04:20 - CMDPHP PHP ERROR Backtrace: (/index.php[25]:include(), /include/auth.php[28]:require_once(), /include/global.php[510]:include_once(), /include/global_languages.php[230]:load_gettext_oscarotero(), /include/global_languages.php[278]:Gettext\Translations::__callStatic(), /include/vendor/gettext/src/Translations.php[153]:call_user_func_array(), Gettext\Translations->__call(), /include/vendor/gettext/src/Translations.php[174]:call_user_func(), Gettext\Extractors\Extractor::fromFile(), /include/vendor/gettext/src/Extractors/Extractor.php[18]:Gettext\Extractors\Mo::fromString(), /include/vendor/gettext/src/Extractors/Mo.php[24]:Gettext\Extractors\Mo::readInt(), /include/vendor/gettext/src/Extractors/Mo.php[110]:Gettext\Utils\StringReader->read(), /include/vendor/gettext/src/Utils/StringReader.php[31]:substr(), CactiErrorHandler())
03/Jan/2022 10:04:20 - ERROR PHP : substr(): Passing null to parameter #2 ($offset) of type int is deprecated in file: /var/www/cacti/htdocs/include/vendor/gettext/src/Utils/StringReader.php on line: 31
03/Jan/2022 10:04:20 - CMDPHP PHP ERROR WARNING Backtrace: (/index.php[25]:include(), /include/auth.php[28]:require_once(), /include/global.php[510]:include_once(), /include/global_languages.php[230]:load_gettext_oscarotero(), /include/global_languages.php[278]:{closure}(), /include/vendor/gettext/src/autoloader.php[11]:require_once(), /include/vendor/gettext/src/autoloader.php[11]:CactiErrorHandler())
03/Jan/2022 10:04:20 - ERROR PHP : Trying to access array offset on value of type null in file: /var/www/cacti/htdocs/lib/functions.php on line: 5426
03/Jan/2022 10:04:20 - CMDPHP PHP ERROR Backtrace: (/index.php[25]:include(), /include/auth.php[28]:require_once(), /include/global.php[510]:include_once(), /include/global_languages.php[230]:load_gettext_oscarotero(), /include/global_languages.php[278]:{closure}(), /include/vendor/gettext/src/autoloader.php[11]:require_once(), /include/vendor/gettext/src/autoloader.php[11]:CactiErrorHandler())
03/Jan/2022 10:04:20 - ERROR PHP : Return type of Gettext\Translations::offsetSet($index, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in file: /var/www/cacti/htdocs/include/vendor/gettext/src/Translations.php on line: 210
03/Jan/2022 10:00:28 - SYSTEM DSSTATS STATS: Type:HOURLY, Time:0.01

@reubenfarrelly reubenfarrelly added bug Undesired behaviour unverified Some days we don't have a clue labels Jan 3, 2022
@TheWitness
Copy link
Member

I have a hunch this is in the breadcrumb code. Booting my lab.

@TheWitness
Copy link
Member

@reubenfarrelly this does not appear to be the 1.2.x branch. There is no translation call on lib/functions.php:5426.

@TheWitness
Copy link
Member

@reubenfarrelly , can you install this version and let me know if the problem is resolved?

https://github.com/php-gettext/Gettext/releases/tag/v5.6.1

TheWitness added a commit that referenced this issue Jan 3, 2022
This changes is in an effort to address issue #4521
@TheWitness
Copy link
Member

@reubenfarrelly, I just updated the 1.2.x branch with the latest. Please test again.

@reubenfarrelly
Copy link
Author

So far - around 12 hours after re-updating again - I haven't seen the issue reoccur and haven't seen any regressions. Will continue to monitor for a bit longer but it seems likely this update may have fixed the problem (I see the latest version of php-gettext also adds support for php-8.1).

@TheWitness
Copy link
Member

Good. The changelog is updated to include this. When you are satisfied, just close.

@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Jan 4, 2022
@TheWitness TheWitness added this to the v1.2.20 milestone Jan 4, 2022
@reubenfarrelly
Copy link
Author

Ok I haven't seen that above error appear again. But this was logged this morning which also looks to be gettext related:

06/Jan/2022 07:05:18 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
06/Jan/2022 07:05:18 - ERROR PHP : Uncaught Error: Call to undefined method Gettext\Translations::fromMoFile() in /var/www/cacti/htdocs/include/global_languages.php:278 Stack trace: #0 /var/www/cacti/htdocs/include/global_languages.php(230): load_gettext_oscarotero() #1 /var/www/cacti/htdocs/include/global.php(510): include_once('...') #2 /var/www/cacti/htdocs/include/auth.php(28): require_once('...') #3 /var/www/cacti/htdocs/index.php(25): include('...') #4 {main} thrown in file: /var/www/cacti/htdocs/include/global_languages.php on line: 278
06/Jan/2022 07:05:18 - CMDPHP PHP ERROR WARNING Backtrace: (CactiShutdownHandler(), /lib/functions.php[5491]:CactiErrorHandler())
06/Jan/2022 07:05:18 - ERROR PHP : Trying to access array offset on value of type null in file: /var/www/cacti/htdocs/lib/functions.php on line: 5491
06/Jan/2022 07:05:16 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
06/Jan/2022 07:05:16 - ERROR PHP : Uncaught Error: Call to undefined method Gettext\Translations::fromMoFile() in /var/www/cacti/htdocs/include/global_languages.php:278 Stack trace: #0 /var/www/cacti/htdocs/include/global_languages.php(230): load_gettext_oscarotero() #1 /var/www/cacti/htdocs/include/global.php(510): include_once('...') #2 /var/www/cacti/htdocs/include/auth.php(28): require_once('...') #3 /var/www/cacti/htdocs/index.php(25): include('...') #4 {main} thrown in file: /var/www/cacti/htdocs/include/global_languages.php on line: 278
06/Jan/2022 07:05:16 - CMDPHP PHP ERROR WARNING Backtrace: (CactiShutdownHandler(), /lib/functions.php[5491]:CactiErrorHandler())
06/Jan/2022 07:05:16 - ERROR PHP : Trying to access array offset on value of type null in file: /var/www/cacti/htdocs/lib/functions.php on line: 5491

netniV added a commit that referenced this issue Jan 8, 2022
@netniV
Copy link
Member

netniV commented Jan 8, 2022

Unfortunately, I've had to revert the commit that updated gettext (not php-gettext). This is because it has a 7.2+ limitation that we simply can't apply to the 1.2.x branch at this point. You may need to force the translation code to use one of the other libraries.

@TheWitness
Copy link
Member

@reubenfarrelly, I've introduced a 'public' setting to force the preferred language processor. Take a snapshot of the latest update and then see what shows up under Language Support at Console > Settings > Configuration > General. Then exercise the various options. You may have to exclude the gettext module from the distribution until such time as we get to Cacti 1.3 where we will be upping the minimum version of PHP to 7.2.

@TheWitness
Copy link
Member

This setting was previously hidden. I exposed it to remove any confusion.

@reubenfarrelly
Copy link
Author

Ok I updated a couple of days ago, and I've tested it out and haven't noticed any warnings or errors logged. I've tried all the options and it passes the "seems to be ok" test for me.

@TheWitness
Copy link
Member

Cool thanks!

@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants