function YamlTest::testDecodeObjectSupportDisabled
Same name in other branches
- 11.x core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest::testDecodeObjectSupportDisabled()
Ensures that decoding PHP objects does not work in Symfony.
@covers ::decode
File
-
core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php, line 88
Class
- YamlTest
- Tests the Yaml serialization implementation.
Namespace
Drupal\Tests\Component\SerializationCode
public function testDecodeObjectSupportDisabled() : void {
$this->expectException(InvalidDataTypeException::class);
$this->expectExceptionMessageMatches('/^Object support when parsing a YAML file has been disabled/');
$yaml = <<<YAML
obj: !php/object "O:8:\\"stdClass\\":1:{s:3:\\"foo\\";s:3:\\"bar\\";}"
YAML;
Yaml::decode($yaml);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.