Problem/Motivation

YAML can contain custom tags: https://symfony.com/doc/current/components/yaml.html#parsing-and-dumping...
I don't think it is useful in webform but it should not break forms.

If the webform YAML contains a custom tag, it triggers this error:

TypeError:
strlen(): Argument #1 ($string) must be of type string, Symfony\Component\Yaml\Tag\TaggedValue given

Steps to reproduce

Don't enable webform_ui.
Browse to /admin/structure/webform/manage/[webform_id].
Save this YAML:

foo:
  '#markup': !my_tag
    foo: bar

Display the form.

Proposed resolution

The error could be handled more gracefully.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork webform-3547520

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

prudloff created an issue. See original summary.

prudloff’s picture

Issue summary: View changes

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

jrockowitz’s picture

Status: Active » Needs review

To perform element render validation, we probably need to use functional testing.

The render validation via \Drupal\Tests\webform\Kernel\WebformEntityElementsValidationTest is commented out because it stopped working as Webforms became more complex.

prudloff’s picture

I think the root cause is #3108309: Support Yaml::PARSE_CUSTOM_TAGS in \Drupal\Component\Serialization\YamlSymfony::decode. Before that, Yaml::decode() was not parsing custom tags.

  • jrockowitz committed 88c0297e on 6.3.x
    [#3547520] feat: TypeError if YAML contains custom tag
    
    By: prudloff
    By...
jrockowitz’s picture

Status: Needs review » Fixed

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

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

Maintainers, please credit people who helped resolve this issue.

  • jrockowitz committed 88c0297e on 6.x
    [#3547520] feat: TypeError if YAML contains custom tag
    
    By: prudloff
    By...
abarrio’s picture

I am getting this same error using this:

confirmation_attributes:
   data-attend: 'attend-yes'

Even after applying patch.

Status: Fixed » Closed (fixed)

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