selectall_arrayref returns ref to DBI and not an array ref
[email protected] (Peter Gordon)
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <1282038448.2850.137.camel@qed> |
I am trying to fix a problem in Bugzilla which has been open for more
than a year, and which seems to be related to DBI, and I was hoping
that you could give me some direction in trying to solve the problem. On
my site the problem is totally repeatable. I am using Perl 5.8.8,
DBI-1.613_71.
In short: on one line a variable is a reference to an array, and,
directly after a return statement, the value is no longer an array, but
a scalar
having a reference to DBI. So it looks like something is
changing/corrupting the Perl stack. Since Driver.xst and Perl.xsi change
the stack it seems
that that are likely to be causing the problem.
The bug in Bugzilla is:
https://bugzilla.mozilla.org/show_bug.cgi?id=481459
The code that seems to be causing the problem is:
my $objects = $dbh->selectall_arrayref($sql, {Slice=>{}}, @untainted);
For a given $sql and a given @untainted, the $objects returned is not
an array but a reference to DBI::db=HASH
When I step through the code, selectall_arrayref works correctly until
the final return statement. Before the return statement, the type is an
array, and directly afterwards, it is a DBI::db=HASH.
The sql statement is:
SELECT id,value,product_id FROM versions WHERE id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ORDER BY id
and the @untainted array is an equivalent number of small integers.
For a smaller or larger number of variables selectall_arrayref is working correctly.
I changed the calling routine so that when an error was detected, the code was run again. On second and consecutive times the
code worked correctly.
I am prepared to debug the problem if someone could help.
Peter