#45075 [Opn]: mssql_bind $var must be passed by reference, not by value
| From: | vrana@php.net | Date: | Wed, 05 Nov 2008 16:47:27 +0000 |
| Subject: | #45075 [Opn]: mssql_bind $var must be passed by reference, not by value | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1378@lists.php.net to get a copy of this message | ||
ID: 45075
Updated by: vrana@php.net
Reported By: geoff at ivent dot com dot au
Status: Open
Bug Type: Documentation problem
Operating System: Linux
PHP Version: Irrelevant
New Comment:
"It is passed by reference, to retrieve OUTPUT and RETVAL values after
the procedure execution. "
Previous Comments:
------------------------------------------------------------------------
[2008-05-23 05:44:56] geoff at ivent dot com dot au
Description:
------------
The mssql_bind function documentation states:
===
$var - The PHP variable you'll bind the MSSQL parameter to. You can
pass it by value, or by reference, to retrieve OUTPUT and RETVAL values
after the procedure execution.
===
If the value is bound by value, it a random chunk of memory to be bound
as the value.
I am using the latest TDS stable, using TDS version 8.0 talking to a
Microsoft SQL 2000 Server.
Reproduce code:
---------------
$value = 'Test';
$proc = mssql_init('myProc');
mssql_bind($proc, '@myVal', $value, SQLVARCHAR, false, false, 50);
var_dump(mssql_execute($proc));
Expected result:
----------------
The database should receive the following command:
exec myProc @myVal = 'Test'
Actual result:
--------------
The database server receives the following command:
exec myProc @myVal = ';Àe
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45075&edit=1