Hello,
I got this error with PHP 7.2 testing cacti 1.1.26 on Fedora rawhide
PHP version: php-7.2.0~RC4-1.fc28.x86_64
2017/10/18 22:57:16 - ERROR PHP WARNING: sizeof(): Parameter must be an array or an object that implements Countable in file: /usr/share/cacti/lib/html.php on line: 1004
@cigamit
Thank you. Commit 7454361f2b06459c46b1947185e4939f80391b4e fixes it for me.
This might be related to the global_session.php bug that was reported today. I'll do a patch for this since it's PHP 7.2, and who know, it could be a change in behavior. But also update your include/global_session.php from the develop branch as well.
Sorry for the noise, but similar errors are being reported for both Debian and Ubuntu at
/usr/share/cacti/site/lib/functions.php on line: 1619
/usr/share/cacti/site/lib/api_automation.php on line: 1901
In my cursory debugging of the first, the deprecation warnings were due to NULL being passed. Adding a similar check as in this issue to those lines resolves the issue for me.
What version of cacti was this against?
@netniV, sorry I should obviously have provided that! Both Debian and Ubuntu have 1.1.31, but I didn't see any further changes to these files in latest.
OK, I see the problem with the first error because the function get_graph_group() which is probably hitting the following:
/* a parent must NOT be the following graph item types */
if (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types[$graph_item['graph_type_id']])) {
return;
}
This should be returning an empty array.
The next is several layers deep and resides in the get_data_query_array() function in lib/data_query.php:
if (!file_exists($xml_file_path)) {
query_debug_timer_offset('data_query', "Could not find data query XML file at '$xml_file_path'");
return false;
}
Again, this should be returning an array not false. However, I still need to check whether anything else is calling these functions and expecting false.
And I was right... there are functions looking for false rather than sizeof() so I'll create a fuller patch tomorrow.
Thanks for confirming! Once you have the fixes, I'll backport to Ubuntu.
Give this patch a try. I've not fully tested it yet but so far I've not seen any adverse results.
Will do -- I should be able to report back later today.
It looks to be resolved with your latest patch in my test build. I still am getting one error:
Unexpected output in /var/log/cacti/cacti.log:
02/02/2018 16:40:07 - AUTOM8 ERROR: The Network ID: 1 is disabled. You must use the 'force' option to force it's execution.
But it looks to be something that perhaps needs adjustment in the Debian/Ubuntu tests. Thanks!
That error is because within Automation you have a network defined, but you have set it to be not automatically polled (Enabled). As such, if you want to poll it, you can do so using the command line '-f' option to force it through otherwise it's ignored.
@paulgevers does work on backporting so may be able to offer insight on that.
This has now been merged into the main development code, please check this to make sure there are no issues post merge.
@netniV The Debian/Ubuntu tests don't "set" anything specific. What they do is a recursive crawl of the cacti web site and by doing so they may do anything blindly, including disabling polling. If the poll comes later, you apparently hit this. However, some releases ago, we weren't hitting this, so something has changed. That is OK, but if this is indeed explainable behavior, we'll need to add the error to the expected/accepted output in the cacti error log.
@nacc, thanks for working on this. I expect you did the Ubuntu work.
Not in front of my machine right now so I haven鈥檛 looked myself but i think it would be expected on the following conditions:
I am assuming the only data loaded during your test is from the SQL file. It may be worth noting there has been some work done to improve the differences found between an upgrade and a new install.
This is a standard way or running CI in Debian, I install the package (of course, automatically in a clean, bare and new environment). My flavor of testing is that the ONLY thing I do is making sure I can access the web pages, which I then "wget --recursive". And this of course may take long enough for the poller to come by, especially if the package was installed just before */5 and on slower architectures.
I don't know what you mean with "from the SQL file".
The cacti.sql file that is in the root folder. I assume that you have loaded that at some point or gone through the upgrade_database.php which runs through the install/upgrade/ PHP files.
@netniV that is correct, the cacti.sql is loaded as part of package installation.
I ran in this bug with 1.1.37 when rebuilding poller cache from cli
ERROR PHP WARNING: sizeof(): Parameter must be an array or an object that implements Countable in file: /usr/share/cacti/lib/utility.php on line: 541
Looking more into it
$ids = array();
(...)
$ids .= ', ' . $id;
(...)
if (sizeof($ids)) {
@belotn please create a new issue for this. It's a new bug.
@belotn as @paulgevers says, please open a new issue for that bug so it can be tracked separately. I will take a look at a fix for it in the mean time because it sounds like a simple one.
Yup, found the problem and already fixed it in my local copy. 馃憤
Just need that issue number to assign it all against if you could @belotn
sorry ! here : https://github.com/Cacti/cacti/issues/1546
Most helpful comment
sorry ! here : https://github.com/Cacti/cacti/issues/1546