Plugin: Gravity Forms Survey Add-On
Version: (included in gravityformssurvey.zip)
PHP Version: 8.3.24
WordPress Version: 6.7.1
Issue Description: When using Gravity Forms with Survey features on PHP 8.2+, forms crash with a fatal error when attempting to display. The error occurs because $this is being used in a static method context.
Error Message:
Fatal error: Uncaught Error: Using $this when not in object context in /var/www/html/wp-content/plugins/gravityformssurvey/includes/class-gf-survey-utils.php:52
Root Cause: In /wp-content/plugins/gravityformssurvey/includes/class-gf-survey-utils.php, the static method get_requested_slug() attempts to access $this->query_var on line 52:
php
public static function get_requested_slug() {
global $wp;
if ( self::is_plain_permalinks() && isset( $wp->query_vars[ $this->query_var ] ) ) {
return strtolower( $wp->query_vars[ $this->query_var ] );
} else {
return strtolower( $wp->request );
}
}
Temporary Fix Applied (tested): Replaced $this->query_var with the hardcoded string 'gf_theme_layers'.
Suggested Permanent Fix: one of:
-
Make the method non-static and update all callers
-
Replace
$this->query_varwith the appropriate constant or class property access -
Pass the query_var as a parameter to the method