Hi -- bind_param error under -T and patch

Andy Turner turner at mikomi.org
Sun Jan 18 08:22:36 PST 2004


I was getting the following error but only when taint checking was turned
on.  With taint checking turned off it works fine.

hemlock:~$ sudo -u freeside perl -T /tmp/genbill.pl 3 4 5
Looking up 3
DBI::st=HASH(0x911eb20)->bind_param(...): attribute parameter '4' is not a hash ref at /usr/local/share/perl/5.6.1/FS/Record.pm line 316.

If the bind_param call is changed to use a hash instead of a scalar it works
either way.  So that's what the patch does.

-- 
Andy <turner at mikomi.org>
-------------- next part --------------
--- /usr/local/share/perl/5.6.1/FS/Record.pm~   Tue Dec 30 01:02:17 2003
+++ /usr/local/share/perl/5.6.1/FS/Record.pm    Sun Jan 18 11:15:09 2004
@@ -313,9 +313,9 @@
     if ( $record->{$field} =~ /^\d+(\.\d+)?$/
          && $dbdef->table($table)->column($field)->type =~ /(int|serial)/i
     ) {
-      $sth->bind_param($bind++, $record->{$field}, SQL_INTEGER);
+      $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_INTEGER } );
     } else {
-      $sth->bind_param($bind++, $record->{$field}, SQL_VARCHAR);
+      $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_VARCHAR } );
     }
   }


More information about the freeside-devel mailing list