Skip to content

Commit 18517e7

Browse files
committed
Fix stmt_free_result implementation and usage
Two bugs both affecting the bug_pecl_7976.phpt test ("works with mysqlnd" haha): * We should not change the connection state in stmt_free_result. This makes mysql_stmt_free_result usable under mysqlnd and not just libmysqlclient. * If we call mysql_stmt_free_result, we still need to consume any outstanding result sets.
1 parent 9c0712d commit 18517e7

File tree

3 files changed

+1
-9
lines changed

3 files changed

+1
-9
lines changed

ext/mysqlnd/mysqlnd_ps.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,10 +1931,6 @@ MYSQLND_METHOD(mysqlnd_stmt, free_result)(MYSQLND_STMT * const s)
19311931
stmt->state = MYSQLND_STMT_PREPARED;
19321932
}
19331933

1934-
if (GET_CONNECTION_STATE(&conn->state) != CONN_QUIT_SENT) {
1935-
SET_CONNECTION_STATE(&conn->state, CONN_READY);
1936-
}
1937-
19381934
DBG_RETURN(PASS);
19391935
}
19401936
/* }}} */

ext/pdo_mysql/mysql_statement.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,7 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt) /* {{{ */
893893
S->result = NULL;
894894
}
895895
if (S->stmt) {
896-
int retval;
897-
retval = mysql_stmt_free_result(S->stmt);
898-
PDO_DBG_RETURN(retval ? 0 : 1);
896+
mysql_stmt_free_result(S->stmt);
899897
}
900898

901899
while (mysql_more_results(S->H->server)) {

ext/pdo_mysql/tests/bug_pecl_7976.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ require __DIR__ . '/mysql_pdo_test.inc';
5656
$db = MySQLPDOTest::factory();
5757
$db->exec('DROP PROCEDURE IF EXISTS p');
5858
?>
59-
--XFAIL--
60-
Works with mysqlnd. It is not supported by libmysql. For libmysql is good enough to see no crash.
6159
--EXPECT--
6260
Emulated...
6361
array(1) {

0 commit comments

Comments
 (0)