|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46657 MySQL PDO bindParam on Stored Procedure with INOUT fails to bind returned value
Submitted: 2008-11-24 04:28 UTC Modified: 2009-05-03 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:1 (16.7%)
From: aventurella at gmail dot com Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.6 OS: OS X 10.5.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: aventurella at gmail dot com
New email:
PHP Version: OS:


 [2008-11-24 04:28 UTC] aventurella at gmail dot com
Using the example in the PHP docs for binding an INOUT in a stored 
procedure, the process appears to fail

see example 5

The principle difference between this and Bug #35935 is that 

$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 10); 

In the code was not presented, which should address the issue.

Reproduce code:
MySQL 5.0.67
CREATE PROCEDURE `tablename`.`sp_takes_string_returns_string`(INOUT str VARCHAR(10))
SELECT 'world' INTO str;

CREATE PROCEDURE `tablename`.`sp_takes_string_returns_string`(INOUT str VARCHAR(10))
SET str = 'world'

$dbh = new PDO($server.':host='.$host.';dbname='.$catalog, $username, $password, array(PDO::ATTR_PERSISTENT => true));
$stmt = $dbh->prepare("CALL sp_takes_string_returns_string(?)");
$value = 'hello';
$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 10); 

// call the stored procedure

print "procedure returned $value\n";

Expected result:
procedure returned world

Actual result:
procedure returned hello


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-26 22:33 UTC] aventurella at gmail dot com
This also happens with PostgreSQL and MSSQL
 [2008-11-27 00:38 UTC] aventurella at gmail dot com
I guess this is the root of the problem for MySQL:
 [2009-04-25 15:21 UTC]
Please try using this CVS snapshot:
For Windows:

 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Oct 07 03:05:56 2022 UTC