php - Symfony YAML parsing content with comma -


is there bug within symfony yaml component or intended behavior yaml standard? per understanding comma in scenario below should act regular content character.

\symfony\component\yaml\yaml::parse("test: 1,2"); 

actual result:

array("test" => 12) 

expected result:

array("test" => "1,2") 

this isn't bug within symfony - or @ least, it's symfony expected behavior. passed non-quoted value parser looks number, treats such , strips out non-numeric charcaters. symfony documentation talks numeric literals in yaml component, although in regards underscores. symfony yaml format documentation explicitly states:

finally, there other cases when strings must quoted, no matter if you're using single or double quotes:

  • when string looks number, such integers (e.g. 2, 14, etc.), floats (e.g. 2.6, 14.9) , exponential numbers (e.g. 12e7, etc.) (otherwise, treated numeric value);

if run following code expected result:

symfony\component\yaml\yaml::parse('test: "1,2"'); 

result:

["test" => "1,2"] 

notice how double-quotes indicating string value should not treated numeric literal.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -