In my Drupal project I have a yaml configuration file which contains an id with the value 16_9 (more precisely it is part of the Crop module configuration). When checking differences between the active Drupal configuration and this staged one, Drupal lists this config, although it should be identical:


As you can see, the YAML parser processes the id as an integer and stripes out the underscore.

This problem only exists in my Drupal-VM. In our testing and production environment (non Drupal-VM) with the identical code and data base the config sync is fine. It does not show any differences.

There might be different YAML parser (and/or extensions) in use which behave not the same way. But I don't know if this is a Drupal or VM issue. I don't think that it is specific to the Crop Module.

My Environment

Vagrant 1.9.2
VirtualBox .1.18 r114002 (Qt5.6.2)
Drupal VM 4.5.0 (with Ubuntu)

1 Answer 1


It's actually a native YAML issue. As Saltstack's YAML Inconsistencies page observes:

If a definition only includes numbers and underscores, it is parsed by YAML as an integer and all underscores are stripped. To ensure the object becomes a string, it should be surrounded by quotes.

It's fairly common practice; Java does it too, for example

So wrap your ID in quotes and it should be fine.

  • 1
    Oh, good to know! But the config files are generated by Drupal and the id is just the machine name. Of course I could wrap it with quotes afterwards but shouldn't this be done by Drupal automatically? And I'm still wondering why this is an environment specific issue. Jun 16, 2017 at 11:59
  • Yes, Drupal should ideally ensure that strings are wrapped in quotes when writing yaml files itself. That'll be a bug, the config scheme provides the type info so it can definitely be done. The behaviour itself might be configurable in YAML and different from one environment to the other (I'm guessing though)
    – Clive
    Jun 16, 2017 at 12:25
  • 1
    It could well be your vendor library versions actually, Symfony YAML added support for this in 3.2. Maybe the environment that it works on has an older version
    – Clive
    Jun 16, 2017 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.