Skip to content

Commit 1783db8

Browse files
committed
Fixed #37209 (mssql_execute with non fatal errors)
1 parent 0f3831a commit 1783db8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ext/mssql/php_mssql.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,7 @@ PHP_FUNCTION(mssql_execute)
21012101
mssql_result *result;
21022102
int num_fields;
21032103
int batchsize;
2104+
int exec_retval;
21042105

21052106
batchsize = MS_SQL_G(batchsize);
21062107

@@ -2111,10 +2112,15 @@ PHP_FUNCTION(mssql_execute)
21112112
ZEND_FETCH_RESOURCE(statement, mssql_statement *, &stmt, -1, "MS SQL-Statement", le_statement);
21122113

21132114
mssql_ptr=statement->link;
2115+
exec_retval = dbrpcexec(mssql_ptr->link);
21142116

2115-
if (dbrpcexec(mssql_ptr->link)==FAIL || dbsqlok(mssql_ptr->link)==FAIL) {
2117+
if (exec_retval == FAIL || dbsqlok(mssql_ptr->link) == FAIL) {
21162118
php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure execution failed");
2117-
dbcancel(mssql_ptr->link);
2119+
2120+
if (exec_retval == FAIL) {
2121+
dbcancel(mssql_ptr->link);
2122+
}
2123+
21182124
RETURN_FALSE;
21192125
}
21202126

0 commit comments

Comments
 (0)