maplefu0602 / spyc

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

322 Fatal error: Uncaught exception #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
<?php

#
#    S P Y C
#      a simple php yaml class
#
# Feel free to dump an array to YAML, and then to load that YAML back into an
# array.  This is a good way to test the limitations of the parser and maybe
# learn some basic YAML.
#

include('../spyc.php');

$array[] = 'Sequence item';
$array['The Key'] = 'Mapped value';
$array[] = array('A sequence','of a sequence');
$array[] = array('first' => 'A sequence','second' => 'of mapped values');
$array['Mapped'] = array('A sequence','which is mapped');
$array['A Note'] = 'What if your text is too long?';
$array['Another Note'] = 'If that is the case, the dumper will probably fold 
your text by using a block.  Kinda like this.';
$array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 
4 and the default wordwrap, 40, to 60.';
$array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!";
$array['key:withcolon'] = "Should support this to";

$yaml = Spyc::YAMLDump($array,4,60);

------------------------------- 
Logic is the example, clear that other script works fine ... This is what led 
to ...
-------------------------------

Fatal error: Uncaught exception 'Exception' with message 'Keys are all screwy. 
The first one was zero, now it's "The Key"' in 
D:\xampp\htdocs\prueba\yaml\spyc\spyc.php:322 
Stack trace: #0 
D:\xampp\htdocs\prueba\yaml\spyc\spyc.php(266): Spyc->_dumpNode('The Key', 
'Mapped value', 0, 0, 0) #1
D:\xampp\htdocs\prueba\yaml\spyc\spyc.php(238): Spyc->_yamlize('The Key', 
'Mapped value', 0, 0, 0) #2
D:\xampp\htdocs\prueba\yaml\spyc\spyc.php(187): Spyc->dump(Array, 4, 60) #3
D:\xampp\htdocs\prueba\yaml\spyc\examples\yaml-dump.php(25): 
Spyc::YAMLDump(Array, 4, 60) #4
{main} thrown in D:\xampp\htdocs\prueba\yaml\spyc\spyc.php on line 322

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

Please provide any additional information below.

Server XAMPP 1.7.4
Windows xp
Quad core 3.016
4MB ram...
hdisk 2tb

Original issue reported on code.google.com by sychowa...@gmail.com on 5 May 2011 at 7:29

GoogleCodeExporter commented 8 years ago
Hi, I was not able to reproduce the bug in the latest version of Spyc. Please 
grap the latest version from SVN and try running your code, it should work with 
mixed keys just nicely.

Original comment by vlad.and...@gmail.com on 2 Jun 2011 at 10:45