PHP 8.2 fixes for: Using ${var} in strings is deprecated

Gravity Forms throws tons of warnings in PHP 8.2.x, here’s a quick way to fix it yourself to make theme development possible for sites running Gravity Forms. Without these fixes you can’t use WP_DEBUG since Gravity Forms throws so many errors and warnings.

Just update these core plugin files:

Deprecated : Using ${var} in strings is deprecated, use {$var} instead in /wp-content/plugins/gravityforms/includes/fields/class-gf-field-list.php on line 171

$list .= "<div class='ginput_container ginput_container_list ginput_list {$class_has_columns}'>" . "<div class='gfield_list gfield_list_container'>";

Deprecated : Using ${var} in strings is deprecated, use {$var} instead in /wp-content/plugins/gravityforms/includes/fields/class-gf-field-repeater.php on line 584

$input_id = str_replace( $match[1], $match[1] . "-{$index}", $match[0] );

I hope this helps until these this code is fixed in the core plugin.

In your development environment, you can also turn off deprecation notices if you don’t want to see them (works for any plugin/theme throwing these types of notices).

I’ve the following code added to an mu-plugin:

<?php

error_reporting(E_ALL & ~E_DEPRECATED);
1 Like

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