Oops, something went wrong

Created on 4 December 2024, 3 months ago

Problem/Motivation

When an AJAX request is executed while filling in the form during the creation of a new server, the following error is displayed:

In the browser console the an error is logged:

Warning: Uninitialized string offset 0 in /var/www/html/drupal/docroot/modules/contrib/graphql/src/Form/ServerForm.php on line 271

Steps to reproduce

  1. Add a new server at /admin/config/graphql/servers/create
  2. In the dropdown, switch from the default option "Composable schema" to "Alterable composable schema"

Result: the error is popping up.

Proposed resolution

This happens when the value is left empty. The validate handler is using a string offset to check if the endpoint URI starts with a slash, but since the string is empty this is emitting a warning in PHP 8.0 and above.

  1. The easiest solution would be to skip this validation when the endpoint is left empty. A user can fill in the form from top to bottom without getting unexpected validation errors during AJAX requests such as "The endpoint path has to start with a forward slash.". This is a one line fix.
  2. Alternatively we can switch to element validation for the field. This is a bit more complex and would require a small refactoring of the form validation handlers.
🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇬Bulgaria pfrenssen Sofia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024