]> granicus.if.org Git - php/commitdiff
Fixed #37209 (mssql_execute with non fatal errors)
authorKalle Sommer Nielsen <kalle@php.net>
Mon, 23 Feb 2009 21:21:23 +0000 (21:21 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Mon, 23 Feb 2009 21:21:23 +0000 (21:21 +0000)
NEWS
ext/mssql/php_mssql.c

diff --git a/NEWS b/NEWS
index 1e9fe82b127e20f768298212f2eba6159399c092..2356b12725ab5fc0f0da36d498b1c6f9c5041148 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Feb 2009, PHP 5.2.9RC4
+- Fixed bug #37209 (mssql_execute with non fatal errors). (Kalle)
 
 19 Feb 2009, PHP 5.2.9RC3
 - Fixed bug #47422 (modulus operator returns incorrect results on 64 bit linux).
index b65aefc7c57ceef6e34ad0ee489d6ab193e6198f..95d62cead17e04eacdfb76e99d5333356a4b24b1 100644 (file)
@@ -2158,11 +2158,12 @@ PHP_FUNCTION(mssql_execute)
        int num_fields;
        int batchsize;
        int ac = ZEND_NUM_ARGS();
+       int exec_retval;
 
        batchsize = MS_SQL_G(batchsize);
        if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &stmt, &skip)==FAILURE) {
-        WRONG_PARAM_COUNT;
-    }
+               WRONG_PARAM_COUNT;
+       }
        if (ac == 2) {
                skip_results = Z_BVAL_PP(skip);
        }
@@ -2170,10 +2171,15 @@ PHP_FUNCTION(mssql_execute)
        ZEND_FETCH_RESOURCE(statement, mssql_statement *, stmt, -1, "MS SQL-Statement", le_statement);
 
        mssql_ptr=statement->link;
+       exec_retval = dbrpcexec(mssql_ptr->link);
 
-       if (dbrpcexec(mssql_ptr->link)==FAIL || dbsqlok(mssql_ptr->link)==FAIL) {
+       if (exec_retval == FAIL || dbsqlok(mssql_ptr->link) == FAIL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure execution failed");
-               dbcancel(mssql_ptr->link);
+
+               if (exec_retval == FAIL) {
+                       dbcancel(mssql_ptr->link);
+               }
+
                RETURN_FALSE;
        }