php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48877 "bindValue" and "bindParam" do not work for PDO Firebird
Submitted: 2009-07-10 02:35 UTC Modified: 2011-12-10 22:20 UTC
Votes:7
Avg. Score:4.9 ± 0.3
Reproduced:7 of 7 (100.0%)
Same Version:3 (42.9%)
Same OS:4 (57.1%)
From: siegmar at siegmar dot com dot br Assigned: mariuz (profile)
Status: Closed Package: PDO related
PHP Version: 5.2.10 OS: Windows
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: siegmar at siegmar dot com dot br
New email:
PHP Version: OS:

 

 [2009-07-10 02:35 UTC] siegmar at siegmar dot com dot br
Description:
------------
The "bindValue" and "bindParam" do not work for PDO Firebird if we use named parameters (:parameter) but do work for question marks parameters (?).






Reproduce code:
---------------
<?php
$connection = new PDO('firebird:dbname=localhost:C:\Firebird\EMPLOYEE.FDB', 'SYSDBA', 'masterkey');

$value = '2';

//$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NO = :empno');
//$command->bindParam(':empno', $value, PDO::PARAM_STR); // does not work
//$command->bindValue(':empno', $value, PDO::PARAM_STR); // does not work

$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NO = ?');
$command->bindParam('1', $value, PDO::PARAM_STR); // works
//$command->bindValue('1', $value, PDO::PARAM_STR); // works

$command->execute();
$dataset = $command->fetchAll();
foreach($dataset as $record)
  echo $record[0] . "<br />";
?>

The same code works perfectly for MySQL.

Expected result:
----------------
Using the example database "EMPLOYEE.FDB" you sould see:

2




Actual result:
--------------
nothing

Patches

Bug-48877-pdo-firebird_driver.c (last revision 2011-12-09 19:02 UTC by dabramov at american-appraisal dot com)
Bug-48877-firebird_driver (last revision 2011-12-09 10:51 UTC by dabramov at american-appraisal dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-04 05:14 UTC] ssufficool at gmail dot com
Try changing the :empno to just empno in bind* it is not expected or needed:

$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NO = :empno');
$command->bindParam('empno', $value, PDO::PARAM_STR); // does not work
$command->bindValue('empno', $value, PDO::PARAM_STR); // does not work
 [2011-06-02 13:46 UTC] mariuz@php.net
-Assigned To: +Assigned To: mariuz
 [2011-12-10 22:04 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=320854
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2011-12-10 22:08 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=320855
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2011-12-10 22:09 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=320856
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2011-12-10 22:20 UTC] mariuz@php.net
-Status: Assigned +Status: Closed
 [2011-12-10 22:20 UTC] mariuz@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2011-12-10 22:25 UTC] mariuz@php.net
tested and result was 2


cat test.php 
<?php
$connection = new 
PDO('firebird:dbname=localhost:/var/lib/firebird/2.5/data/employee.fdb', 
'SYSDBA', 'masterkey');

$value = '2';

$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NO = 
:empno');
$command->bindParam(':empno', $value, PDO::PARAM_STR); // does not work
$command->bindValue(':empno', $value, PDO::PARAM_STR); // does not work

#$command = $connection->prepare('SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NO = 
?');
#$command->bindParam('1', $value, PDO::PARAM_STR); // works
//$command->bindValue('1', $value, PDO::PARAM_STR); // works

$command->execute();
$dataset = $command->fetchAll();
foreach($dataset as $record)
  echo $record[0] . "<br />";
?>
 [2011-12-12 06:33 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=320877
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2011-12-27 10:48 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321432
Log: added test for PDO_Firebird: bug 48877
 [2011-12-27 10:54 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321433
Log: PDO_Firebird: bug 48877 test
 [2011-12-28 09:40 UTC] mariuz@php.net
Automatic comment from SVN on behalf of mariuz
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321461
Log: cleanup for bug 48877 test, add description
 [2011-12-28 17:38 UTC] janis dot volbergs at gmail dot com
FYI. This issue exists in 5.3.6 as well.


PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep  8 2011 19:34:00) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of mariuz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1754e163359e9c14219fd478215b959635820a31
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of mariuz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1754e163359e9c14219fd478215b959635820a31
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of mariuz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1754e163359e9c14219fd478215b959635820a31
Log: bug fixed #48877 - bindValue and bindParam do not work for PDO Firebird
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC