From 91317dfdd7b4e5614e74462d29a4b47065340e5f Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 8 Jul 2008 21:23:45 +0000 Subject: [PATCH] Fix potential JSON/UTF8 encoding issues in Asset/Sku/Product.pm --- lib/WebGUI/Asset/Sku/Product.pm | 4 ++-- t/Asset/Sku/ProductCollateral.t | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Asset/Sku/Product.pm b/lib/WebGUI/Asset/Sku/Product.pm index 782db2bdf..95e668bc1 100644 --- a/lib/WebGUI/Asset/Sku/Product.pm +++ b/lib/WebGUI/Asset/Sku/Product.pm @@ -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; } diff --git a/t/Asset/Sku/ProductCollateral.t b/t/Asset/Sku/ProductCollateral.t index 46f9508e1..d9bc039e7 100644 --- a/t/Asset/Sku/ProductCollateral.t +++ b/t/Asset/Sku/ProductCollateral.t @@ -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 } ],