Fix potential JSON/UTF8 encoding issues in Asset/Sku/Product.pm

This commit is contained in:
Colin Kuskie 2008-07-08 21:23:45 +00:00
parent b02bc68215
commit 91317dfdd7
2 changed files with 3 additions and 3 deletions

View file

@ -246,7 +246,7 @@ sub getAllCollateral {
my $json = $self->get($tableName);
my $table;
if ($json) {
$table = from_json($json);
$table = decode_json($json);
}
else {
$table = [];
@ -774,7 +774,7 @@ The name of the table to insert the data.
sub setAllCollateral {
my $self = shift;
my $tableName = shift;
my $json = to_json($self->{_collateral}->{$tableName});
my $json = encode_json($self->{_collateral}->{$tableName});
$self->update({ $tableName => $json });
return;
}

View file

@ -55,7 +55,7 @@ ok($session->id->valid($vid), 'a valid id was generated for the new collateral e
my $json;
$json = $product->get('variantsJSON');
my $jsonData = from_json($json);
my $jsonData = decode_json($json);
cmp_deeply(
$jsonData,
[ {a => 'aye', b => 'bee', vid => $vid } ],