From:             mknobloch at midstate dot edu
Operating system: Windows 2003 SP1
PHP version:      5.1.1
PHP Bug Type:     PDO related
Bug description:  Named parameters not working in PDO_ODBC

Description:
------------
When using a named parameters array, PDO_ODBC substitutes the last value
in the array for each named parameter.

This code works fine in 5.1.0.  The bug first appeared in 5.1.1.  I can
also confirm that this bug does not affect PDO_SQLITE.

Reproduce code:
---------------
$dbh = new PDO("odbc:testdb");
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

$sql = "INSERT INTO testtable (field1, field2, field3) VALUES (:value1,
:value2, :value3)";

$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY));

$parm = array(
   ":value1" => 15,
   ":value2" => 20,
   ":value3" => 25
);

$sth->execute($parm);


Expected result:
----------------
I expect a new record to be inserted into the table with field1 = 15,
field2 = 20, and field3 = 25

Actual result:
--------------
A new record is created, but 25 is inserted into all three fields.

-- 
Edit bug report at http://bugs.php.net/?id=35671&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35671&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35671&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35671&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35671&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35671&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35671&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35671&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35671&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35671&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35671&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35671&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35671&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35671&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35671&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35671&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35671&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35671&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35671&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35671&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35671&r=mysqlcfg

Reply via email to