ID:               31135
 Updated by:       [EMAIL PROTECTED]
 Reported By:      msisolak at yahoo dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         MSSQL related
 Operating System: Windows 2000
 PHP Version:      5.0.3
-Assigned To:      
+Assigned To:      fmk


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

[2004-12-16 21:26:57] msisolak at yahoo dot com

Description:
------------
As of PHP 5.0.3 calling a SQL Server stored procedure that returns no
result set incorrectly returns FALSE (to indicate an error condition)
when it should return TRUE.

I believe the problem was introduced with patch 1.137.2.3 to
ext/mssql/php_mssql.c with this change:

@@ -1184,6 +1196,9 @@ PHP_FUNCTION(mssql_query)
        while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue ==
SUCCEED) {
                retvalue = dbresults(mssql_ptr->link);
        }
+       if (retvalue != SUCCEED) {
+               RETURN_FALSE;
+       }
        if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) {
                RETURN_TRUE;
        }

In the case of a stored procedure that returns no result set retvalue
== NO_MORE_RESULTS.  This change now equates NO_MORE_RESULTS with a
FALSE result, but that is incorrect.  It should return TRUE as it does
in PHP 5.0.2 to indicate a successful execution.

Reproduce code:
---------------
- Create an empty stored procedure.

- Reproduce code:

<?php

$link = mssql_connect("localhost", "sa", "<<password>>");
mssql_select_db("<<database>>", $link);
echo mssql_query("EXEC <<storedproc>>") ? "true" : "false";
mssql_close($link);

?>

Expected result:
----------------
true

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


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


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

Reply via email to