PHP warnings
Moderators: Developers, Moderators
-
- Cacti User
- Posts: 151
- Joined: Mon Feb 05, 2007 3:57 am
- Location: Munich, Germany
PHP warnings
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!
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!
Re: PHP warnings
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?
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: PHP warnings
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
So I filed a bug:
https://github.com/Cacti/cacti/issues/1206
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: PHP warnings
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.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
-
- Cacti User
- Posts: 151
- Joined: Mon Feb 05, 2007 3:57 am
- Location: Munich, Germany
Re: PHP warnings
[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';
/* default localization of Cacti */
$cacti_locale = 'en';
$cacti_country = 'us';
Re: PHP warnings
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
I'll see if I can throw a test file together to proof the format.
Code: Select all
$adminFormatter = new \NumberFormatter("en-US", \NumberFormatter::CURRENCY);
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: PHP warnings
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.
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
-
- test_lang.txt
- Rename to .php
- (5.84 KiB) Downloaded 109 times
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: PHP warnings
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()
'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()
Re: PHP warnings
Cacti Version 1.2.3
What to do next? How to fix this error?
What to do next? How to fix this error?
Re: PHP warnings
Error in log
- Attachments
-
- 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 (140.94 KiB) Viewed 1563 times
- 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())
Re: PHP warnings
If you can trace down the Graph Template that is causing this issue, we need to see a screen grab of the Graph Template showing all the summation data. Thanks.
Before history, there was a paradise, now dust.
Re: PHP warnings
Looks like this should be fixed in Cacti 1.2.5.
Before history, there was a paradise, now dust.
Who is online
Users browsing this forum: No registered users and 2 guests