maplefu0602 / spyc

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

Bad load of string. #53

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Steps to reproduce the problem :

<?php
require_once "spyc.php";
$test = "default: \"''::character varying\"";
echo $test . PHP_EOL;
$a = Spyc::YAMLLoadString($test);
var_dump($a);
?>

Expected output :
default: "''::character varying"
array(1) {
  ["default"]=>
  string(20) "''::character varying"
}

What I see instead (note the missing single quote in the array) :
default: "''::character varying"
array(1) {
  ["default"]=>
  string(20) "'::character varying"
}

Spyc version 0.5 on Win7.

Temp workaround:
Line 535 :
- return strtr(substr ($value, 1, -1), array ('\\"' => '"', '\'\'' => '\'', 
'\\\'' => '\''));
+ return strtr(substr ($value, 1, -1), array ('\\"' => '"', '\\\'' => '\''));

Original issue reported on code.google.com by utopic....@gmail.com on 9 Dec 2011 at 9:48