Bug 6253 followup: explicitly check ref value for ARRAY before casting

in C4::SQLHelper::_Process_Operands, $operand has been modified to be cast as an array ref
if the incoming $operand is not a ref.  However, the incoming $operand could be some other
kind of ref (hashref for example), which would case the dereferencing in line 419 to fail and exit.

Adding an explicit test for whether the ref is ARRAY seems to clear up this issue.

To test, run t/db_dependent/Members.t.  Before, it fails after test 3.  After, it completes all tests.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit d80cf35e9b)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Ian Walls 2011-10-19 11:46:21 -04:00 committed by Chris Nighswonger
parent ecf41dd5ad
commit ecb4cd1782
1 changed files with 1 additions and 1 deletions

View File

@ -415,7 +415,7 @@ sub _Process_Operands{
my @tmpkeys;
my @localkeys;
$operand = [$operand] unless ref $operand;
$operand = [$operand] unless ref $operand eq 'ARRAY';
foreach (@$operand) {
push @tmpkeys, " $field = ? ";
push @values, $_;