howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
425 stars 94 forks source link

Remove usage of deprecated each() function #209

Closed mortenn closed 5 years ago

mortenn commented 5 years ago

After upgrading PHP, I got a lot of deprecation warnings. I upgraded my installation to 0.98 noting it removed such warnings, but I discovered there are a bunch of usages of the deprecated each() function in Weathermap.class.php:

PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /.../lib/Weathermap.class.php on line 778

howardjones commented 5 years ago

I still have never really got enough feedback to release this properly, but I think 0.98a resolves this: https://www.network-weathermap.com/files/php-weathermap-0.98a-test4.zip

netniV commented 5 years ago

PHP 7.2 introduced a couple of things that were breaking changes. One of which was the each() notice, another was the use of a non-array with count() or sizeof(). That means where many functions previously reported FALSE instead of ARRAY as a return value, it count() and sizeof() under 7.1 would silently returned 0 (FALSE) but until 7.2 will bitch and moan about it, worse than my wife about smelly socks.

If you are using Cacti with Weathermaps, you also need to make sure you have cacti 1.2 to be properly 7.2 compliant.

mortenn commented 5 years ago

I just run a Makefile to execute weathermap from cli, so no problem there :) Manually patched the each() calls I found in the core file and it seems to be running fine for the moment.

I'll test 0.98a soon, and if I find any issues, I'll probably send some PRs :)

mortenn commented 5 years ago

I jumped to 7.3 btw, and not noticed anything bad yet