maplefu0602 / spyc

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

exception parsing a yaml hash #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

$t0 = array("titel"=> array("0" => "", 1 => "Dr.", 5 => "Prof.", 6 =>
"Prof. Dr."));
Spyc::YAMLDump($t0);

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

titel:
  0: 
  1: Dr.
  5: Prof.
  6: Prof. Dr.

spyck throws an exception: Keys are all screwy.  The first one
    was zero, now it's "5"

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

0.4.5 from svn

Please provide any additional information below.

there should be only *one single* case where a list is dumped as a yaml
array. that is when every key is the next incremented value (+1) starting
from 0 (vektor). every other array should be dumped as yaml hash.

$is_vektor = (array_keys($arr) === range(0, count($arr) - 1))

Original issue reported on code.google.com by robbie.w...@gmail.com on 21 Sep 2009 at 1:33

GoogleCodeExporter commented 8 years ago
Thanks, it's fixed in the SVN trunk.

Original comment by vlad.and...@gmail.com on 31 May 2010 at 10:36