Problem/Motivation

After running a D7 to D9 webform migration, a few webforms were corrupted: no elements were shown and when I tried viewing the YML structure I got this error

Drupal\Component\Serialization\Exception\InvalidDataTypeException: The reserved indicator "%" cannot start a plain scalar; you need to quote the scalar at line 117 (near "'#field_suffix': %"). in Drupal\Component\Serialization\YamlSymfony::decode() (line 40 of core/lib/Drupal/Component/Serialization/YamlSymfony.php).

Seems like "field_suffix" value wasn't escaped correctly.

Steps to reproduce

- Create a D7 webform, with at least one text field that has only '%' as field suffix
- MIgrate the webform using this module's approach
- Try editing the elements structure in the new form

Proposed resolution

I think we can have 2 approaches:
- Wrap every YML value in single quotes => this will generate some slightly excessive YML files
- Escape every value specifically, checking against a vocabulary of reserved keywords/chars

Remaining tasks

- Decide which approach fits better
- Implement the value escaping inside the migration source plugin

User interface changes

No

API changes

No

Data model changes

No

Comments

andrea.cividini created an issue.