From 83a3ed6983c07fda72e24b2b502ff5301064a876 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 3 Dec 2008 00:32:25 +0000 Subject: [PATCH] Make sure SQL parameters are stringified (for overloaded entries) before converting to json for debug output --- lib/WebGUI/Session/ErrorHandler.pm | 5 +++-- lib/WebGUI/Session/Form.pm | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm index 1e94545bf..c438feb59 100644 --- a/lib/WebGUI/Session/ErrorHandler.pm +++ b/lib/WebGUI/Session/ErrorHandler.pm @@ -330,8 +330,9 @@ sub query { my $placeholders = shift; $self->{_queryCount}++; my $plac; - if (defined $placeholders and ref $placeholders eq "ARRAY" && scalar(@{$placeholders})) { - $plac = "\n with placeholders: " . JSON->new->encode($placeholders); + if (defined $placeholders and ref $placeholders eq "ARRAY" && scalar(@$placeholders)) { + my @placeholders = map {ref $_ ? "$_" : $_} @$placeholders; # stringify objects + $plac = "\n with placeholders: " . JSON->new->encode(\@placeholders); } else { $plac = ''; diff --git a/lib/WebGUI/Session/Form.pm b/lib/WebGUI/Session/Form.pm index d837a371f..07c58d81c 100644 --- a/lib/WebGUI/Session/Form.pm +++ b/lib/WebGUI/Session/Form.pm @@ -16,7 +16,7 @@ package WebGUI::Session::Form; use strict qw(vars subs); use WebGUI::HTML; -use Encode; +use Encode (); use base 'WebGUI::FormValidator'; =head1 NAME