diff --git a/core/lib/Drupal/Component/Serialization/YamlPecl.php b/core/lib/Drupal/Component/Serialization/YamlPecl.php index fcc5f80..ec48a29 100644 --- a/core/lib/Drupal/Component/Serialization/YamlPecl.php +++ b/core/lib/Drupal/Component/Serialization/YamlPecl.php @@ -18,9 +18,6 @@ public static function encode($data) { ini_set('yaml.output_indent', 2); // Do not break lines at 80 characters. ini_set('yaml.output_width', -1); - // Decode binary, since Symfony YAML parser encodes binary from 3.1 - // onwards. - ini_set('yaml.decode_binary', 1); $init = TRUE; } return yaml_emit($data, YAML_UTF8_ENCODING, YAML_LN_BREAK); @@ -30,6 +27,13 @@ public static function encode($data) { * {@inheritdoc} */ public static function decode($raw) { + static $init; + if (!isset($init)) { + // Decode binary, since Symfony YAML parser encodes binary from 3.1 + // onwards. + ini_set('yaml.decode_binary', 1); + $init = TRUE; + } // yaml_parse() will error with an empty value. if (!trim($raw)) { return NULL;