Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sat May 25, 2019 8:23 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: PHP warnings
PostPosted: Mon Jan 15, 2018 12:04 pm 
Offline
Cacti User

Joined: Mon Feb 05, 2007 3:57 am
Posts: 135
Location: Munich, Germany
Hello,

running Cacti 1.1.30 on FreeBSD with PHP7 I get some warnings clicking on graph details

Warning: numfmt_set_attribute() expects parameter 1 to be NumberFormatter, null given in /var/www/cacti/include/global_languages.php on line 579
Warning: numfmt_format() expects parameter 1 to be NumberFormatter, null given in /var/www/cacti/include/global_languages.php on line 581

Anything to worry?

Thanks!


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Mon Jan 15, 2018 1:41 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2474
This would suggest that the numfmt_create() function returned a null value since that is the value used as paramter 1 on the lines in question. Do you know what your $cacti_locale and $cacti_country are currently set to?

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Mon Jan 15, 2018 1:52 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2474
Looking at the code, it should check that the $fmt is FALSE and if so, try the older methods of working numbers out.

So I filed a bug:
https://github.com/Cacti/cacti/issues/1206

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Mon Jan 15, 2018 3:13 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2474
This will be corrected in the v1.0.31 release. Note, it doesn't fix the actual problem, but if you set your logging level to HIGH it will show an entry stating that it had to revert the number format back to the original methods. It will show the key used in quotes so if you could get that once you have a chance to update, that may help identify the issue.

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Tue Jan 16, 2018 3:49 am 
Offline
Cacti User

Joined: Mon Feb 05, 2007 3:57 am
Posts: 135
Location: Munich, Germany
[quote="netniV"]This would suggest that the numfmt_create() function returned a null value since that is the value used as paramter 1 on the lines in question. Do you know what your $cacti_locale and $cacti_country are currently set to?[/quote]

/* default localization of Cacti */
$cacti_locale = 'en';
$cacti_country = 'us';


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Tue Jan 16, 2018 6:04 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2474
Hmm, that is the default values, but that gets overridden by your Browser Settings, Cacti User settings, Cacti System Settings and finally default settings. If it does end up being 'en' and 'us' that should result in a number format of en-US which is valid according to the example at http://php.net/manual/en/class.numberformatter.php
Code:
$adminFormatter = new \NumberFormatter("en-US", \NumberFormatter::CURRENCY);


I'll see if I can throw a test file together to proof the format.

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Sun Jan 21, 2018 5:37 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2474
Add the attached file to your base cacti folder and then change the .txt to .php. Ensure you are logged in, then browse to <cacti site>/test_lang.php

This should give you some debug information about the language settings being used and the number formatter that was being picked if any.

The first textarea that appears will be the languages that cacti knows about. You can ignore this, but if you copy and paste the rest of the contents, I can see whether that has any bearing on the issue you've had.


Attachments:
File comment: Rename to .php
test_lang.txt [5.84 KiB]
Downloaded 66 times

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8
Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Fri Apr 19, 2019 3:26 am 
Offline

Joined: Wed Oct 14, 2015 8:20 pm
Posts: 4
array (
'sq-AL' =>
array (
'language' => 'Albanian',
'direction' => 'ltr',
'country' => 'al',
'filename' => 'albanian_albania',
),
'ar-SA' =>
array (
'language' => 'Arabic',
'direction' => 'rtl',
'country' => 'sa',
'filename' => 'arabic_saudi_arabia',
),
'hy-AM' =>
array (
'language' => 'Armenian',
'direction' => 'ltr',
'country' => 'am',
'filename' => 'armenian_armenia',
),
'be-BY' =>
array (
'language' => 'Belarusian',
'direction' => 'ltr',
'country' => 'by',
'filename' => 'belarusian_belarus',
),
'bg-BG' =>
array (
'language' => 'Bulgarian',
'direction' => 'ltr',
'country' => 'bg',
'filename' => 'bulgarian_bulgaria',
),
'zh-CN' =>
array (
'language' => 'Chinese (China)',
'direction' => 'ltr',
'country' => 'cn',
'filename' => 'chinese_china_simplified',
),
'zh-HK' =>
array (
'language' => 'Chinese (Hong Kong)',
'direction' => 'ltr',
'country' => 'hk',
'filename' => 'chinese_hong_kong',
),
'zh-SG' =>
array (
'language' => 'Chinese (Singapore)',
'direction' => 'ltr',
'country' => 'sg',
'filename' => 'chinese_singapore',
),
'zh-TW' =>
array (
'language' => 'Chinese (Taiwan)',
'direction' => 'ltr',
'country' => 'tw',
'filename' => 'chinese_taiwan',
),
'hr-HR' =>
array (
'language' => 'Croatian',
'direction' => 'ltr',
'country' => 'hr',
'filename' => 'croatian_croatia',
),
'cs-GZ' =>
array (
'language' => 'Czech',
'direction' => 'ltr',
'country' => 'cz',
'filename' => 'czech_czech_republic',
),
'da-DK' =>
array (
'language' => 'Danish',
'direction' => 'ltr',
'country' => 'dk',
'filename' => 'danish_denmark',
),
'nl-NL' =>
array (
'language' => 'Dutch',
'direction' => 'ltr',
'country' => 'nl',
'filename' => 'dutch_netherlands',
),
'en-US' =>
array (
'language' => 'English',
'direction' => 'ltr',
'country' => 'us',
'filename' => 'english_usa',
),
'en-GB' =>
array (
'language' => 'English (Britain)',
'direction' => 'ltr',
'country' => 'gb',
'filename' => 'english_gb',
),
'et-EE' =>
array (
'language' => 'Estonian',
'direction' => 'ltr',
'country' => 'ee',
'filename' => 'estonian_estonia',
),
'fi-FI' =>
array (
'language' => 'Finnish',
'direction' => 'ltr',
'country' => 'fi',
'filename' => 'finnish_finland',
),
'fr-FR' =>
array (
'language' => 'French',
'direction' => 'ltr',
'country' => 'fr',
'filename' => 'french_france',
),
'de-DE' =>
array (
'language' => 'German',
'direction' => 'ltr',
'country' => 'de',
'filename' => 'german_germany',
),
'el-GR' =>
array (
'language' => 'Greek',
'direction' => 'ltr',
'country' => 'gr',
'filename' => 'greek_greece',
),
'he-IL' =>
array (
'language' => 'Hebrew',
'direction' => 'rtl',
'country' => 'il',
'filename' => 'hebrew_israel',
),
'hi-IN' =>
array (
'language' => 'Hindi',
'direction' => 'ltr',
'country' => 'in',
'filename' => 'hindi_india',
),
'hu-HU' =>
array (
'language' => 'Hungarian',
'direction' => 'ltr',
'country' => 'hu',
'filename' => 'hungarian_hungary',
),
'is-IS' =>
array (
'language' => 'Icelandic',
'direction' => 'ltr',
'country' => 'is',
'filename' => 'icelandic_iceland',
),
'id-ID' =>
array (
'language' => 'Indonesian',
'direction' => 'ltr',
'country' => 'id',
'filename' => 'indonesian_indonesia',
),
'ga-IE' =>
array (
'language' => 'Irish',
'direction' => 'ltr',
'country' => 'ie',
'filename' => 'irish_ireland',
),
'it-IT' =>
array (
'language' => 'Italian',
'direction' => 'ltr',
'country' => 'it',
'filename' => 'italian_italy',
),
'ja-JP' =>
array (
'language' => 'Japanese',
'direction' => 'ltr',
'country' => 'jp',
'filename' => 'japanese_japan',
),
'ko-KR' =>
array (
'language' => 'Korean',
'direction' => 'ltr',
'country' => 'kr',
'filename' => 'korean_korea',
),
'lv-LV' =>
array (
'language' => 'Lativan',
'direction' => 'ltr',
'country' => 'lv',
'filename' => 'latvian_latvia',
),
'lt-LT' =>
array (
'language' => 'Lithuanian',
'direction' => 'ltr',
'country' => 'lt',
'filename' => 'lithuanian_lithuania',
),
'mk-MK' =>
array (
'language' => 'Macedonian',
'direction' => 'ltr',
'country' => 'mk',
'filename' => 'macedonian_macedonia',
),
'ms-MY' =>
array (
'language' => 'Malay',
'direction' => 'ltr',
'country' => 'my',
'filename' => 'malay_malaysia',
),
'mt-LT' =>
array (
'language' => 'Maltese',
'direction' => 'ltr',
'country' => 'lt',
'filename' => 'maltese_malta',
),
'no-NO' =>
array (
'language' => 'Norwegian',
'direction' => 'ltr',
'country' => 'no',
'filename' => 'norwegian_norway',
),
'pl-PL' =>
array (
'language' => 'Polish',
'direction' => 'ltr',
'country' => 'pl',
'filename' => 'polish_poland',
),
'pt-PT' =>
array (
'language' => 'Portuguese',
'direction' => 'ltr',
'country' => 'pt',
'filename' => 'portuguese_portugal',
),
'pt-BR' =>
array (
'language' => 'Portuguese (Brazil)',
'direction' => 'ltr',
'country' => 'br',
'filename' => 'portuguese_brazil',
),
'ro-RO' =>
array (
'language' => 'Romanian',
'direction' => 'ltr',
'country' => 'ro',
'filename' => 'romanian_romania',
),
'ru-RU' =>
array (
'language' => 'Russian',
'direction' => 'ltr',
'country' => 'ru',
'filename' => 'russian_russia',
),
'sr-RS' =>
array (
'language' => 'Serbian',
'direction' => 'ltr',
'country' => 'rs',
'filename' => 'serbian_serbia',
),
'sk-SK' =>
array (
'language' => 'Slovak',
'direction' => 'ltr',
'country' => 'sk',
'filename' => 'slovak_slovakia',
),
'sl-SI' =>
array (
'language' => 'Slovenian',
'direction' => 'ltr',
'country' => 'si',
'filename' => 'slovenian_slovenia',
),
'es-ES' =>
array (
'language' => 'Spanish',
'direction' => 'ltr',
'country' => 'es',
'filename' => 'spanish_spain',
),
'sv-SE' =>
array (
'language' => 'Swedish',
'direction' => 'ltr',
'country' => 'se',
'filename' => 'swedish_sweden',
),
'th-TH' =>
array (
'language' => 'Thai',
'direction' => 'ltr',
'country' => 'th',
'filename' => 'thai_thailand',
),
'tr-TR' =>
array (
'language' => 'Turkish',
'direction' => 'ltr',
'country' => 'tr',
'filename' => 'turkish_turkey',
),
'vi-VN' =>
array (
'language' => 'Vietnamese',
'direction' => 'ltr',
'country' => 'vn',
'filename' => 'vietnamese_vietnam',
),
)


Using USER, locale = en-US, country = us

path2locales = /var/www/monitoring/locales
x path2catalogue = /var/www/monitoring/locales/LC_MESSAGES/english_usa.mo
x path2calendar = /var/www/monitoring/include/js/LC_MESSAGES/jquery.ui.datepicker-english_usa.js

Using FALLBACK
+ Using NumberFormatter()


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Fri Apr 19, 2019 3:29 am 
Offline

Joined: Wed Oct 14, 2015 8:20 pm
Posts: 4
Cacti Version 1.2.3
What to do next? How to fix this error?


Top
 Profile  
 
 Post subject: Re: PHP warnings
PostPosted: Fri Apr 19, 2019 4:12 am 
Offline

Joined: Wed Oct 14, 2015 8:20 pm
Posts: 4
Error in log


Attachments:
File comment: 2019/04/19 06:06:32 - CMDPHP PHP ERROR WARNING Backtrace: (/graph_json.php[158]:rrdtool_function_graph(), /lib/rrd.php[1548]:variable_bandwidth_summation(), /lib/graph_variables.php[674]:number_format_i18n(), /include/global_languages.php[651]:numfmt_set_attribute(), CactiErrorHandler())
2019/04/19 06:06:32 - ERROR PHP WARNING: numfmt_set_attribute() expects parameter 1 to be NumberFormatter, null given in file: /var/www/monitoring/include/global_languages.php on line: 651

error.PNG
error.PNG [ 140.94 KiB | Viewed 56 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group