Bug #50555 [Com]: PDO_DBLIB: Cannot retrieve output parameter from stored procedure

From: Date: Tue, 13 Jun 2023 17:57:39 +0000
Subject: Bug #50555 [Com]: PDO_DBLIB: Cannot retrieve output parameter from stored procedure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244688@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50555&edit=1

 ID:                 50555
 Comment by:         diogotbrito at gmail dot com
 Reported by:        david dot wright at opticsplanet dot com
 Summary:            PDO_DBLIB: Cannot retrieve output parameter from
                     stored procedure
 Status:             Open
 Type:               Bug
 Package:            PDO DBlib
 Operating System:   2.6.24-24-server
 PHP Version:        5.3.1
 Block user comment: N
 Private report:     N

 New Comment:

Expected result:
----------------
Array
(
    [] => Diogo Toscano
    [0] => Diogo Toscano
)


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


Previous Comments:
------------------------------------------------------------------------
[2023-06-13 13:04:48] diogotbrito at gmail dot com

DBLIB on unix cant accesses variables. Changing to windows or sqlsrv with the same code, works. I
have a big client running procedure and i need to ge the return LOL

<?php

$database = "";
$server = "";
$user = "";
$pass="";


$str_host  = "dblib:host=" . $server;
$str_host .= ";dbname=" . $database;

try {
    $con = new PDO($str_host, $user, $pass);
    $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $con->exec("SET NOCOUNT ON");
} catch (Exception $ex) {
    print_r('Error: ' . $ex->getMessage());
    exit;
}

$comando = "DECLARE @mensagem varchar(20); SET @mensagem = 'Diogo Toscano'; SELECT
@mensagem;";
$sth = $con->query($comando);
foreach ($sth as $row) {
    echo "<pre>";
    print_r ($row);
}

------------------------------------------------------------------------
[2022-02-23 06:50:17] karannegi0321 at gmail dot com

Nice article, Thanks for sharing..!!

------------------------------------------------------------------------
[2019-02-08 08:03:52] php dot net at itsacon dot net

...and PHP 5 has gone end-of-life with still no updates on this bug...

Which means that everyone using Microsoft SQL server on a *n*x system is either running an
unsupported version, or unable to use most of the functionality of his database.

------------------------------------------------------------------------
[2018-11-20 13:41:20] jeremy dot hise at gmail dot com

Ubuntu, PHP 7, mySQL, still a problem. I'm sure other stacks (.NET/SQL Server/Java/Oracle)
don't have this problem. This is now been around for almost 10 years? 

Please please, fix this.

------------------------------------------------------------------------
[2017-10-06 07:34:26] php dot net at itsacon dot net

That might work, but only if you're willing to rewrite an entire application with an ugly hack
in order to upgrade to PHP 7.x

I really hope this gets fixed before 5.6 End-Of-Life.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=50555


--
Edit this bug report at https://bugs.php.net/bug.php?id=50555&edit=1


Thread (15 messages)

« previous php.bugs (#244688) next »