Export to GitHub

spyc - issue #49

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


Posted on Jul 22, 2011 by Happy Giraffe

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.

Status: New

Labels:
Type-Defect Priority-Medium