# PHP 8.1 - error on form page

**URL:** <https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196>\
**Category:** Get Help\
**Tags:** chatgpt, php-81\
**Created:** [May 22, 2023, 10:34pm UTC](https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196 "2023-05-22T22:34:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![psolovyov](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@psolovyov](https://community.gravityforms.com/u/psolovyov)\
**Post date:** [May 22, 2023, 10:34pm UTC](https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196/1 "2023-05-22T22:34:14Z")

</div>

Howdy,

I recently migrated a site, but having issues when I enable error logging (need it for other issue)  
.

On the page with a gravity form I have this issue:

`str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated (View: /var/www/site/wp-content/themes/test-theme/theme/partials/pagebuilder.blade.php) (View: /var/www/site/wp-content/themes/test-theme/theme/partials/pagebuilder.blade.php)`

```auto
/var/www/site/wp-content/plugins/gravityforms/includes/fields/class-gf-field-list.php

                        if ( is_array( $choice ) ) {
                            $choice_value = $choice['value'];
                            $choice_text = $choice['text'];
                            $choice_selected = array_key_exists( 'isSelected', $choice ) ? $choice['isSelected'] : false;
                        } else {
                            $choice_value = $choice;
                            $choice_text = $choice;
                            $choice_selected = false;
                        }
                        $is_selected = empty( $value ) ? $choice_selected : $choice_value == $value;
                        $selected = $is_selected ? "selected='selected'" : '';
                        $input .= "<option value='" . esc_attr( $choice_value ) . "' {$selected}>" . esc_html( $choice_text ) . '</option>';
                    }
                    $input .= '</select>';
     
                    break;
     
                default :
                    // a11y: inputs without a label must have the aria-label attribute set.
                    $input = "<input {$invalid_attribute} {$required_attribute} {$aria_describedby} aria-label='" . esc_attr( str_replace( '{0}', $row, $aria_label_template ) ) . "' data-aria-label-template='" . esc_attr( $aria_label_template ) . "' type='text' name='input_{$this->id}[]' value='" . esc_attr( $value ) . "' {$tabindex} {$disabled} />";
                    break;
            }

```

the section it’s highlighting is:

`$input = "<input {$invalid_attribute} {$required_attribute} {$aria_describedby} aria-label='" . esc_attr( str_replace( '{0}', $row, $aria_label_template ) ) . "' data-aria-label-template='" . esc_attr( $aria_label_template ) . "' type='text' name='input_{$this->id}[]' value='" . esc_attr( $value ) . "' {$tabindex} {$disabled} />";`

Any ideas how I can fix it?

I’m running Gravity Forms: 2.7.6

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [May 23, 2023, 1:13pm UTC](https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196/2 "2023-05-23T13:13:33Z")

</div>

We’re aware of the issue. We’ll have it fixed in a future release. Thank you for the report.

---

<div class="post-metadata">

**Author:** ![psolovyov](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@psolovyov](https://community.gravityforms.com/u/psolovyov)\
**Post date:** [May 23, 2023, 4:59pm UTC](https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196/3 "2023-05-23T16:59:45Z")

</div>

Thanks!

There was another error:

/var/www/site/wp-content/plugins/gravityforms/includes/addon/class-gf-addon.php

```auto
$block_settings = isset( $all_block_settings[$form['id'] ][$form['page_instance'] ] ) ? $all_block_settings[$form['id'] ][$form['page_instance'] ] : array();

```

With help of the oh mighty lord ChatGPT this helped:

```auto
$page_instance = isset($form['page_instance']) ? $form['page_instance'] : 0;
$block_settings = isset($all_block_settings[$form['id']][$page_instance]) ? $all_block_settings[$form['id']][$page_instance] : array();

```

^^^ dont know if this is correct fix, just had to push through to another error.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [June 22, 2023, 4:59pm UTC](https://community.gravityforms.com/t/php-8-1-error-on-form-page/15196/4 "2023-06-22T16:59:54Z")

</div>

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