From: hans at velum dot net Operating system: Windows XP PHP version: 5.0.0b1 (beta1) PHP Bug Type: MSSQL related Bug description: Cannot bind output variables.
Description: ------------ When using mssql_bind() to bind an output variable, the variable is passed into the stored procedure but the modified value is not returned. (The variable is being passed by reference to mssql_bind()). Reproduce code: --------------- I used the following user-contributed example from mssql_execute manual page. if we have this procedure: CREATE PROCEDURE [procedure] ( @sval varchar(50) OUTPUT, @intval int OUTPUT, @floatval decimal(6,4) OUTPUT ) AS if @intval is null select '@intval is null' as answer else select '@intval is NOT null' as answer set @sval='Hello ' + @sval set @[EMAIL PROTECTED] set @[EMAIL PROTECTED] return 10 We can use this PHP code: <?php $conn=mssql_connect("myhost","user","pwd"); if ($conn) { mssql_select_db("mydb",$conn); $stmt=mssql_init("procedure",$conn); mssql_bind($stmt,"RETVAL",&$val,SQLINT4); $ival=11; $fval=2.1416; $sval="Frank"; mssql_bind($stmt,"@sval",&$sval,SQLVARCHAR,TRUE); mssql_bind($stmt,"@intval",&$ival,SQLINT4,TRUE); mssql_bind($stmt,"@floatval",&$fval,SQLFLT8,TRUE); $result=mssql_execute($stmt); $arr=mssql_fetch_row($result); print ("Answer: " . $arr[0] . " " ); print ("RETVAL = $val ; intval = $ival ; floatval = $fval ; string = $sval"); mssql_close($conn); } else print("ooops!"); Expected result: ---------------- Answer: @intval is NOT nullRETVAL = 10 ; intval = 12 ; floatval = 3.1416 ; string = Hello Frank Actual result: -------------- Answer: @intval is NOT nullRETVAL = 0 ; intval = 11 ; floatval = 2.1416 ; string = Frank -- Edit bug report at http://bugs.php.net/?id=24595&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24595&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24595&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24595&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24595&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24595&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24595&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24595&r=support Expected behavior: http://bugs.php.net/fix.php?id=24595&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24595&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24595&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24595&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24595&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24595&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24595&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24595&r=gnused