Problem/Motivation

A Depecated function error is thrown for the file WebFormHtmlEditor.php

Deprecated function: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\webform\Element\WebformHtmlEditor::getAllowedTags() (line 203 of modules/contrib/webform/src/Element/WebformHtmlEditor.php).

Steps to reproduce

Go to the webform and try and add content using the gutenberg editor

Proposed resolution

To fix the issue you need to create a patch on line 203

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 pregmatch-webformHtmlEditor.patch486 bytesalexdrupaldev

Issue fork webform-3445749

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

alexdrupaldev created an issue. See original summary.

alexdrupaldev’s picture

StatusFileSize
new486 bytes
cilefen’s picture

Status: Active » Needs work

Can you get us the stack trace do we can better understand why Gutenberg doesn’t send the proper type?

jacqui1811’s picture

The patch (#2) worked and removed the Deprecated function alert for me.
Don't know if any unforeseen issues will come out of it but all working okay for now.

chaitanyadessai made their first commit to this issue’s fork.

berdir’s picture

Got a similar error in webform/src/Element/WebformElementAttributes.php:117

jrockowitz made their first commit to this issue’s fork.

jrockowitz’s picture

Status: Needs work » Fixed

This seem safe to merge

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

thhomas’s picture

There is still some places where the `preg_split` function is triggering an error in the Webform module because 2nd parameter is not of type string.

https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Plugin/Webfo...
https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Element/Webf...