maplefu0602 / spyc

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

Data Merges and References aren't working #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using the example from wikipedia,
http://en.wikipedia.org/wiki/Yaml#Data_merge_and_references, the second 
step should be populated with the first step data, then change/overwrite 
the hash values.  

Instead, it's creating an array value of '>>' and populating that.

<? // test_yaml.php

require_once 'spyc.php';

$yaml_data = <<< HERE_DOC
# sequencer protocols for Laser eye surgery

---
- step:  &id001                  # defines anchor label &id001
    instrument:      Lasik 2000
    pulseEnergy:     5.4
    pulseDuration:   12
    repetition:      1000
    spotSize:        1mm

- step:
     <<: *id001                  # merges key:value pairs defined in step1 
anchor
     spotSize:       2mm         # overrides "spotSize" key's value

- step:
     <<: *id001                  # merges key:value pairs defined in step1 
anchor
     pulseEnergy:    500.0       # overrides key
     alert: >                    # adds additional key
           warn patient of
           audible pop
HERE_DOC;

print "<pre>";
var_dump(Spyc::YAMLLoad($yaml_data));

Original issue reported on code.google.com by tac...@gmail.com on 20 Jul 2009 at 11:33

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by vlad.and...@gmail.com on 3 Aug 2009 at 10:30

GoogleCodeExporter commented 8 years ago
Thanks for the bug report, fixed in the SVN version.

Original comment by vlad.and...@gmail.com on 3 Aug 2009 at 11:43