Problem/Motivation

Noticed that when adding textfield element and validation patterns to that in separate url (element/add) and not in the sidebar form, we get error:

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in _webform_entity_element_validate_rendering_error_handler() (line 638 of modules/contrib/webform/webform.module).
_webform_entity_element_validate_rendering_error_handler()
preg_match() (Line: 340)
Drupal\webform\Plugin\WebformElement\TextBase->validateConfigurationForm() (Line: 355)
Drupal\webform_ui\Form\WebformUiElementFormBase->validateForm() (Line: 87)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 123)
Drupal\Core\Form\FormValidator->validateForm() (Line: 611)
Drupal\Core\Form\FormBuilder->processForm() (Line: 347)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 634)
Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Pattern is saved correctly though, so it is not a blocker in actual use.

Steps to reproduce

  1. Install Drupal 11 along with Webform 6.3.x-dev
  2. Login as admin and go to /admin/structure/webform/manage/contact
  3. Go to /admin/structure/webform/manage/contact
  4. Edit `Your Name` regularly and enable pattern and add value to it for example; [a-zA-Z]+ and add some error message as well `test` save and notice that all is well, form is submitted.
  5. Next go to /admin/structure/webform/manage/contact/element/name/edit/
  6. Just scroll to the bottom and click `Save`, you are redirected to /admin/structure/webform/manage/contact?update=name and error message should be visible in top part of the page.

Proposed resolution

We could change preg_match to actually take in empty string as a second argument instead of NULL

Issue fork webform-3567894

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

konstara created an issue. See original summary.

konstara’s picture

Issue summary: View changes

liam morland’s picture

Status: Needs review » Fixed

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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