ID:               21791
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         MSSQL related
 Operating System: windows
 PHP Version:      4.3.0
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

the 3rd argument to mssql_bind() is forced to be passed by ref.

This is not a problem with mssql_bind() but with a change to the way
parameters are returned from stored procedures. In php 4.3.0 the
support for multiple results in stored procedures was added. If you are
using 4.3.0 you need to call mssql_next_result() at least once before
getting the return and output values.

IN 4.3.1 (and current CVS) this has been fixed so as long as your SP is
not returning any results you will get return and output values right
after the call to mssql_exec(). If you are getting one or more results
you need to call mssql_next_result() or use the new optional parameter
to mssql_exec() to skip all results.


Previous Comments:
------------------------------------------------------------------------

[2003-01-23 18:16:12] [EMAIL PROTECTED]

changed spBindOutputParam to feed mssql_bind() the variable sans
ampersand ('$outref', versus '&$outref', as it was) and no go.
reference passing still busted. sorry.

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

[2003-01-22 23:51:35] [EMAIL PROTECTED]

ok, I will try this tomorrow in the AM, but I have to ask: what has
changed from 4.2.3 to 4.3.0 to make this type of implicit
pass-by-reference thing happen? why does it work perfectly normally in
4.2.3? I could find nothing in the changelog that referred to this
issue.

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

[2003-01-22 22:04:54] [EMAIL PROTECTED]

About this:

function spBindOutputParam($stmt, $name, &$outref, $type) { 
   return mssql_bind($stmt, $name, &$outref, $type, true, false); 
}

Have you tried adding 'error_reporting(E_ALL);' in the beginning of the
script? You propably get some warnings?

Try changing the call to:

return mssql_bind($stmt,$name,$outref,$type, true,false); 

ie. don't pass $outref by reference, it's done internally..


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

[2003-01-21 14:54:03] [EMAIL PROTECTED]

under PHP 4.3.0 in IIS5/sapi, the mssql_bind() function does not modify
variables passed in for output parameters.

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

[2003-01-21 14:52:37] [EMAIL PROTECTED]

the following test script:

function inner2(&$val) {
        $val = "Changed!";
}

function inner(&$val) {
        inner2(&$val);
}

function outer(&$val) {
        inner(&$val);
}

$val = "The same.";
outer(&$val);

echo("val = ".$val."\n");


... actually executes as it should on both 4.2.3 and 4.3.0 in my
environment. I therefore would like to reopen the bug as one in the
MSSQL extension on windows.

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

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
    http://bugs.php.net/21791

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

Reply via email to