From c10b5b4fec4d13478d60d1e70b8bf9b9ae1ba6cf Mon Sep 17 00:00:00 2001 From: Drake Date: Wed, 22 Nov 2006 15:52:32 +0000 Subject: [PATCH] Make handling of invalid values for "possible values" for list-based profile fields slightly more robust. It's still not ideal---the error goes to the WebGUI error log, but the user should be given some indication that the profile field is broken. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/ProfileField.pm | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ab4e2a8fc..ce975aa5c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -14,6 +14,7 @@ - fix: op=viewPurchaseHistory prices are now formatted correctly - fix: A minor bug in the default viewPurchaseHistory template - fix: Thread determination of "current" Post, and shortcuts to non-Thread Posts + - fix: make handling of profile field possible values slightly more robust 7.2.1 - Made a change to version tag commits to deal with unusually long commit diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index cc7d242b9..e8d0a75bb 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -131,7 +131,13 @@ sub _formProperties { $properties->{label} = $self->getLabel unless $properties->{label}; $properties->{fieldType} = $self->get("fieldType"); $properties->{name} = $self->getId; - my $values = WebGUI::Operation::Shared::secureEval($self->session,$self->get("possibleValues")) || {}; + my $values = WebGUI::Operation::Shared::secureEval($self->session,$self->get("possibleValues")); + unless (ref $values eq 'HASH') { + if ($self->get('possibleValues') =~ /\S/) { + $self->session->errorHandler->warn("Could not get a hash out of possible values for profile field ".$self->getId); + } + $values = {}; + } my $orderedValues = {}; tie %{$orderedValues}, 'Tie::IxHash'; foreach my $ov (sort keys %{$values}) {