Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293522

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\field_ui\Form\FieldStorageAddForm->buildForm()

$
0
0

Problem/Motivation

The following PHP error is presented every time the add field form is visited:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\field_ui\Form\FieldStorageAddForm->buildForm() (line 195 of /core/modules/field_ui/src/Form/FieldStorageAddForm.php)

Since PHP 8.1, the function strlen() doesn't allow a null parameter.

Steps to reproduce

Visit the add field form for any content type, for example a Basic page: /admin/structure/types/manage/basic_page/fields/add-field

You will see the PHP error if you have enabled error debugging. Otherwise you can see it in Recent log messages page: /admin/reports/dblog

Proposed resolution

Check if the variable is null before using the strlen() function. Attached a patch.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>