maplefu0602 / spyc

Automatically exported from code.google.com/p/spyc
MIT License
0 stars 0 forks source link

Quoted strings handled incorrectly when they are followed by a lin comment #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a yaml file with key/value mapping, where the value is a quoted 
string, and append a line comment, for example: key: "value" #comment
2. Parse the file with Spyc
3. Examine the results by echoing $results['key']

What is the expected output? What do you see instead?

The expected output is value (without quotes), but it prints "value".

What version of the product are you using? On what operating system?

0.5, PHP 5.2.x

Please provide any additional information below.

The bug is in the _toType method of the Spyc class. The determination whether a 
string is quoted or not, happend before stripping out comments.

This is good at first sight, because # may occur in quoted strings.

After stripping out comments, the parser should re-evaluate the string to see 
if it is quoted or not.

Original issue reported on code.google.com by contact....@gmail.com on 22 Jul 2011 at 8:54