php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35671 Named parameters not working in PDO_ODBC
Submitted: 2005-12-14 21:04 UTC Modified: 2006-03-27 22:54 UTC
Votes:14
Avg. Score:4.8 ± 0.6
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:3 (60.0%)
From: mknobloch at midstate dot edu Assigned: wez (profile)
Status: Closed Package: PDO related
PHP Version: 5.1.2 OS: Windows 2003 SP1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mknobloch at midstate dot edu
New email:
PHP Version: OS:

 

 [2005-12-14 21:04 UTC] mknobloch at midstate dot edu
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-15 14:33 UTC] mknobloch at midstate dot edu
The problem still exists in the 200512151130 Win32 snapshot.
 [2005-12-16 11:43 UTC] tony2001@php.net
assigned to the maintainer.
 [2006-01-12 17:32 UTC] mknobloch at midstate dot edu
This bug still exists in 5.1.2.

It can be worked around by replacing php_pdo.dll and php_pdo_odbc.dll with their counterparts from 5.1.0, but it would be nice to have it fixed.
 [2006-02-16 00:20 UTC] stoens at activegrid dot com
I am seeing the same thing with the OCI and the ODBC drivers on Windows and Linux (FC4). Same PHP version.
 [2006-02-17 19:02 UTC] dkrook at hotmail dot com
I've encountered the same problem with DB2 and '?' parameter markers.

http://marc.theaimsgroup.com/?l=php-db&m=114014376609292&w=2
 [2006-03-02 18:32 UTC] bubblenut at gmail dot com
I'm getting this problem with all parameters (named and otherwise) with PDO_MYSQL 1.0.1 with both php-5.1.2 and php-5.1.3-dev on Linux (Kubuntu Breezy)
 [2006-03-09 09:54 UTC] alien at mosfasad dot ru
bug exists in snapshot of 09 Mar 2006 04:32:09 +0100
 [2006-03-09 10:09 UTC] alien at mosfasad dot ru
No bug in sqlite2 and sqlite Driver.
$oPdo = new PDO('sqlite:test.lite');
$oStat = $oPdo->prepare("INSERT INTO php_qqq (name, value) VALUES (?, ?)");
$oStat->execute(array('1','444'));
____
in table php_qqq have values (1 and 444);
 [2006-03-27 22:54 UTC] wez@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

See also http://pecl.php.net/bugs/bug.php?id=6504.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 07:01:30 2024 UTC