Cacti: PHP 7.2 Compatibility Issues

Created on 28 Apr 2018  路  30Comments  路  Source: Cacti/cacti

After long post got wireless disco :(
So short now.
Getting error with 7.2.3-1ubuntu 7.2.4-1ubuntu PHP. Back to Ubuntu 16 :)
Cacti Log:

04/28/2018 03:00:40 - CMDPHP PHP ERROR WARNING Backtrace: (/graphs_new.php: 37 form_save)(/graphs_new.php: 123 host_new_graphs)(/graphs_new.php: 397 host_new_graphs_save)(/graphs_new.php: 250 push_out_host)(/lib/utility.php: 650 poller_update_poller_cache_from_buffer)(/lib/utility.php: 541 sizeof)(CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace)
04/28/2018 03:00:40 - ERROR PHP WARNING: sizeof(): Parameter must be an array or an object that implements Countable in file: /var/www/html/cacti/lib/utility.php on line: 541

Best regards
Spiro

3rd Party Bug help wanted

All 30 comments

I think there was a change for this in lib/utility.php file already very recently. Are you running the develop version or the 1.1.38 version?

No stable. They broke something in PHP.
PHP change from 7.2 [http://php.net/manual/en/migration72.incompatible.php]
Affected: Convert numeric keys in object and array casts 露 <=
Edit
Problem affects few more php projects. For example:
https://github.com/paypal/PayPal-PHP-SDK/issues/1014

I'll take a look now.

Yes, it looks like you can't use sizeof() on false value any more. Therefore, PHP 7.2 will generate warnings all over the place since db_execute, db_fetch_xxx all return either an empty arrray or false if the SQL fails.

The quick fix for the sizeof() issue would be to create our own sizeof function that handles this.

Having said that, this specific error we already fixed in the development branch:
https://github.com/Cacti/cacti/issues/1546

So you may want to look and see if that solves your production copy to. I would suggest manually editing the lines for now because if you try and use the latest development files, there may be other things that they rely on as part of 1.2 that wouldn't be in your production version.

@reboot1983, you up for a code sweep on this one? Your specialty...

@spirodj, just saw your update. Marked as 3rd party. No need to rush I would say.

Hi @netniV

I just stomped with this issue on a fresh install of ubuntu 18.04 + cacti 1.1.38 via apt-get.
I manually applied the fix you suggested on #1546 and it appears to have fixed the issue as the error is no longer showing in the log.

hi can someone send me step by step how to install cacti 1.1.38 on ubuntu 18.4 please. l have done the installation but can only see the loopback graphics and not the main interface

I'll have to throw a new linux VM together for 18.4 but it'll be a couple of days.

thanks l will be waiting and hope it works for me

Current stable version 1.1.38 running on Ubuntu 18.04 has this issue
You can apply manually this patch:
https://github.com/Cacti/cacti/issues/1546

Hope this fix will be added into stable release, because it is not good if half of you production network goes down after regular apt upgrade command

There are a few 1.1.x issues currently that have been patched post 1.1.38. Most have been more annoyances than proper fails but given that 1.2 is still being tested there could be a need to release some more patches back onto 1.1.38 to create 1.1.39. It's just going to be tricky to work out and then extract just the parts that affect 1.1.38 without inadvertently relying on something that is only in 1.2

If you open a bug on Debian, they can issue a Debian patch for this at any time.

@netniV is 1.1.39 planned?

We are currently discussing the merits of whether to lockdown 1.2 as it stands, verses trying to backport the various fixes and changes we have made into a branch for 1.1.39, then test 1.1.39 for potential bugs. The issues are that some of the changes may rely on 1.2 functionality indirectly.

I have estimated that there are:

  • Fixes for ~20+ issues, some of which range from minor to a major problem (like the Assert and poller re-caching)
  • Another ~10 functionality changes which could be included but are properly more for 1.2 than 1.1.x
  • Fixes for ~4 issues with new versions of PHP/MySQL
  • Another ~2 fixes which also require database updates during installation

Since there are a number of people already testing 1.2, the thought is that we could potentially start beta testing and lock down feature changes. Once we've decided on the best route, we will let you know.

undependable of which route you decide to take, when do you think we can expect a new version? Would be nice to have a version that is fully compatible with Ubuntu 18.04 (php7.2), so that I can shutdown my old cacti vm that is 17.04 and end of life. Is there a way to only include the php fixes into a 1.1.39 version?

To create a 1.1.39 version, you'd have to cherry pick them and then test them to ensure that the fixes really did fix things, not break something else.

I'm putting a 18.04 machine together that I will run with to check that we have the core covered for comparability.

@netniV I suggest to apply bug-fix only patches for release 1.1.39 and freeze 1.1.x development. I mean this part:

Fixes for ~4 issues with new versions of PHP/MySQL

The reason is very simple, it's not good idea to freeze on broken release. With good release you will have more time for development and testing 1.2 and people will not forced to make some downgrades in order to run stable but broken version.

Technically, our code wasn't broken. PHP/MySQL chose to break it ;-)

The 1.1.x branch is frozen for any active developments. Hence why there is only a develop branch right now, not a 1.1.x branch too. However, we will take on board the various comments made as it's always useful to know what our users are thinking.

@netniV
Is there any new information about a 1.1.39 version?

Unfortunately not yet. I did ask the question again though yesterday to keep it fresh so I'm hoping to have an answer soon. Schedules and illness have not been kind to the team though.

@netniV
Hey netniV, do you have pleasant news for me?

Can anyone give me infomation if there is a timetable for either a 1.1.39 version or the 1.2 version to appear in the cacti ppa?
This does have an impact to my business strategy, so I would be glad to get an answer. I would be satisfied with things like "we're planning to release a new version end of ..." or just some details about the current progress. Thanks in advance.

Hi @Axel577, I have been pushing to get 1.2 into a beta release and you may have noticed some issues crop up from our own internal testing as a result of those pushes. Once we have them nailed out we will hopefully be there.

We would then be wanting to get any assistance we can with the foreign language translation. Unfortunately, we don't have a stack of them on constant standby so there may be a lack of translations for some of the items.

When it comes to PPA's or Repo's, we don't really have control over those so we would be reliant on the appropriate third parties. They would probably use an "unstable" branch at this point if they were to use one.

okay I understand, thank you. Can you make a prediction how long it will approx. take to get 1.2 into a beta release? End of July, end of August?

My personal view is that 1.2 is ready for beta now, though beta does mean there will likely be issues found. At the moment, an upgrade that someone tested this morning has resulted in four new issues previously unseen which is part of what beta testing is about. None have been major issues and easily resolvable.

However, the group has yet to decide as a collective but I've already let them know you've asked the question again. 馃憤

I've been making a push to clear down any existing 1.2 Milestone tagged issues. Once these are done, I'll try and get a beta agreed (as long as there isn't any other undocumented functionality needed).

There are still some reports coming in, which need to be verified before being tagged, so this may increase the list and add a small delay.

That sounds great!

I'm going to close this now as we are getting close to the beta phase and the 7.2 work so far has been done. Any further issues can be raised and dealt with as part of the beta.

Was this page helpful?
0 / 5 - 0 ratings