From: msisolak at yahoo dot com
Operating system: Windows 2000
PHP version: 5.0.3
PHP Bug Type: MSSQL related
Bug description: Executing stored procedure with no result set returns
incorrect FALSE response
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 bug report at http://bugs.php.net/?id=31135&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31135&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31135&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31135&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31135&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31135&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31135&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31135&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31135&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31135&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31135&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31135&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31135&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31135&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31135&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31135&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31135&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31135&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31135&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31135&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31135&r=mysqlcfg