forward port Product JSON collateral wide character fix

This commit is contained in:
Colin Kuskie 2008-12-01 19:29:45 +00:00
parent 23f8e48f6d
commit e961bb6f26
3 changed files with 12 additions and 6 deletions

View file

@ -15,6 +15,7 @@
- fixed #9155: purpose of "headblock" duplicates "extra head tags"
- fixed: Improve Thingy navigation.
- fixed #9126: UserList is completely broken in 7.6.4 (Yung Han Khoe)
- fixed #9177: Wide-characters break product varients
7.6.4
- Survey now will show progress and time limit.

View file

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

View file

@ -19,6 +19,7 @@ use lib "$FindBin::Bin/../../lib";
use Test::More;
use Test::Deep;
use Test::Exception;
use JSON;
use Data::Dumper;
@ -35,7 +36,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 33; # Increment this number for each test you create
plan tests => 34; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -291,16 +292,20 @@ is( $product5->getCollateral('variantsJSON', 'vid', $newVid)->{check}, 'no leaks
$product5->purge;
##Handle wide characters
my $product6 = $root->addChild({
className => "WebGUI::Asset::Sku::Product",
title => "Wide character attempt",
});
$newVid = $product6->setCollateral('variantsJSON', 'vid', 'new', { wideChar => q!“I hope this has a smart quote in it.”!
$newVid = $product6->setCollateral('variantsJSON', 'vid', 'new', { wideChar => qq!on 16\x{201d} hand-crocheted Cord!
, vid => 'new' });
use Data::Dumper;
diag Dumper $product6->getCollateral('variantsJSON', 'vid', $newVid);
my $product6a = WebGUI::Asset->newByDynamicClass($session, $product6->getId);
lives_ok { $product6a->getAllCollateral('variantsJSON', 'vid', $newVid); }, 'Product collateral handles wide-character encodings okay';
$product6->purge;
#----------------------------------------------------------------------------
# Cleanup