689cf99c4e
This PR was merged into the 2.3 branch. Discussion ---------- [Yaml] Improve YAML boolean escaping | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13209 | License | MIT | Doc PR | None This PR ensures that PHP [values which would be interpreted as booleans][1] in older versions of the YAML spec are escaped with single quotes when dumped by the Dumper. For example, dumping this: ```php array( 'country_code' => 'no', 'speaks_norwegian' => 'y', 'heating' => 'on', ) ``` Will produce this YAML: ```yaml country_code: 'no' speaks_norwegian: 'y' heating: 'on' ``` [1]: http://yaml.org/type/bool.html Commits ------- |
||
---|---|---|
.. | ||
Exception | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
Dumper.php | ||
Escaper.php | ||
Inline.php | ||
LICENSE | ||
Parser.php | ||
phpunit.xml.dist | ||
README.md | ||
Unescaper.php | ||
Yaml.php |
Yaml Component
YAML implements most of the YAML 1.2 specification.
use Symfony\Component\Yaml\Yaml;
$array = Yaml::parse(file_get_contents(filename));
print Yaml::dump($array);
Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/Yaml/
$ composer.phar install
$ phpunit