Bug #70274 [Opn]: PDO Bind Param for INPUT_OUTPUT does not work

From: Date: Fri, 14 Aug 2015 22:16:13 +0000
Subject: Bug #70274 [Opn]: PDO Bind Param for INPUT_OUTPUT does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195218@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70274&edit=1 ID: 70274 User updated by: abarker at dandb dot com Reported by: abarker at dandb dot com Summary: PDO Bind Param for INPUT_OUTPUT does not work Status: Open Type: Bug Package: PDO DBlib Operating System: OS X / Linux PHP Version: 5.4.44 Block user comment: N Private report: N New Comment: Connection string in the example is different. I am using: $dsn = 'dblib:host=000.000.000.000:65535;dbname=test_db'; Previous Comments: ------------------------------------------------------------------------ [2015-08-14 22:11:32] abarker at dandb dot com 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 this bug report at https://bugs.php.net/bug.php?id=70274&edit=1

« previous php.bugs (#195218) next »