php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #45075 mssql_bind $var must be passed by reference, not by value
Submitted: 2008-05-23 05:44 UTC Modified: 2008-11-05 16:47 UTC
From: geoff at ivent dot com dot au Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: geoff at ivent dot com dot au
New email:
PHP Version: OS:

 

 [2008-05-23 05:44 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-05 16:47 UTC] vrana@php.net
"It is passed by reference, to retrieve OUTPUT and RETVAL values after the procedure execution. "
 [2008-11-05 16:47 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 09:00:02 2026 UTC