Some cleanup in the monitor and updates for compliance with PHP7 and PHP8. Tested with PHP 7.4.13 and PHP5. Fixes BUGZ-3932.