DivisionByZero Error on System Settings Page - get_upgrade_percent_complete() [RESOLVED]

Getting a fatal error when visiting the System Setting page, originating from the get_upgrade_percent_complete function inside maybe_process_action called in system_report in class-gf-system-report.php

The issue seems to be the system is getting a count of legacy table entries from the tables with the rg_ prefix and using that count as a divisor, since we do not have any legacy tables or entries that number is 0

Any help would be greatly appreciated

Gravity Forms Version: 2.8.9
Wordpress Version: 6.5.4
PHP Version: 8.2

Error Details

An error of type E_ERROR was caused in line 1600 of the file /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-report.php. Error message: Uncaught DivisionByZeroError: Division by zero in /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-report.php:1600
Stack trace:
#0 /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-report.php(1012): GF_System_Report::get_upgrade_percent_complete()
#1 /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-report.php(376): GF_System_Report::get_database()
#2 /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-report.php(63): GF_System_Report::get_system_report()
#3 /var/www/landingpages/wp-content/plugins/gravityforms/includes/system-status/class-gf-system-status.php(28): GF_System_Report::system_report()
#4 /var/www/landingpages/wp-content/plugins/gravityforms/gravityforms.php(3445): GF_System_Status::system_status_page()
#5 /var/www/landingpages/wp-includes/class-wp-hook.php(324): GFForms::system_status()
#6 /var/www/landingpages/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#7 /var/www/landingpages/wp-includes/plugin.php(517): WP_Hook->do_action()
#8 /var/www/landingpages/wp-admin/admin.php(259): do_action()
#9 {main}
thrown

Was able to resolve this by running the GF Update Database function outside of the System Status page by calling:

$versions = gf_upgrade()->get_versions();
$previous_db_version = $versions[ā€˜previous_db_versionā€™];
gf_upgrade()->upgrade( $previous_db_version, true );

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.