Bug #70274 [NEW]: PDO Bind Param for INPUT_OUTPUT does not work
| From: | abarker at dandb dot com | Date: | Fri, 14 Aug 2015 22:11:34 +0000 |
| Subject: | Bug #70274 [NEW]: PDO Bind Param for INPUT_OUTPUT does not work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195217@lists.php.net to get a copy of this message | ||
From: abarker at dandb dot com
Operating system: OS X / Linux
PHP version: 5.4.44
Package: PDO DBlib
Bug Type: Bug
Bug description:PDO Bind Param for INPUT_OUTPUT does not work
Description:
------------
I have been trying to get the last example at
https://msdn.microsoft.com/en-us/library/ff628166(v=sql.105).aspx
to
work for the last two days. The bindParam INPUT_OUTPUT variable never
gets assigned when using the stored procedure. I have verified that the
stored procedure does indeed work when queried, PDO just fails to assign
the variable. Note this is an MsSQL server using dblib.
Test script:
---------------
<?php
$database = "AdventureWorks";
$server = "(local)";
$dbh = new PDO( "sqlsrv:server=$server ; Database = $database", "",
"");
$dbh->query("IF OBJECT_ID('dbo.sp_ReverseString', 'P') IS NOT NULL
DROP PROCEDURE dbo.sp_ReverseString");
$dbh->query("CREATE PROCEDURE dbo.sp_ReverseString @String as
VARCHAR(2048) OUTPUT as SELECT @String = REVERSE(@String)");
$stmt = $dbh->prepare("EXEC dbo.sp_ReverseString ?");
$string = "123456789";
$stmt->bindParam(1, $string, PDO::PARAM_STR |
PDO::PARAM_INPUT_OUTPUT, 2048);
$stmt->execute();
print $string; // Expect 987654321 but received 123456789
Expected result:
----------------
$string === "987654321"
Actual result:
--------------
$string === "123456789"
--
Edit bug report at https://bugs.php.net/bug.php?id=70274&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70274&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70274&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70274&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70274&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70274&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70274&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70274&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70274&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70274&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70274&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70274&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70274&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70274&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70274&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70274&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70274&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70274&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70274&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70274&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70274&r=mysqlcfg