Problem/Motivation

Deprecated function: str_ends_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\autosave_form\Form\AutosaveEntityFormHandler->isAutosaveEnabled() (line 304 of modules/contrib/autosave_form/src/Form/AutosaveEntityFormHandler.php).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ankitv18 created an issue. See original summary.

ankitv18’s picture

Status: Active » Needs review

MR!31 ready for a review.

shubham_pareek_19’s picture

Reviewing it.

shubham_pareek_19’s picture

Status: Needs review » Needs work

The current logic works, but it doesn't fully prevent deprecation warning. We should add an is_string() check to ensure $baseFormId is a string before calling str_ends_with():

$baseFormId = $form_object->getBaseFormId();
if (is_string($baseFormId) && str_ends_with($baseFormId, '_layout_builder_form')) {
  return FALSE;
}

vishal.kadam made their first commit to this issue’s fork.

vishal.kadam’s picture

Status: Needs work » Needs review
shubham_pareek_19’s picture

Status: Needs review » Reviewed & tested by the community