Skip to content

Commit cde53e7

Browse files
committed
fix different values of mysqli_stmt_affected_rows between libmysql
and mysqlnd (in favor of libmysql) before execute and after prepare()
1 parent f4142a9 commit cde53e7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Bug #23955: allow specifying Max-Age attribute in setcookie() (narfbg, Lars)
1111
. Bug #52126: timestamp for mail.log (Martin Jansen, Lars)
1212

13+
- mysqlnd
14+
. Fixed return value of mysqli_stmt_affected_rows() in the time after
15+
prepare() and before execute(). (Andrey)
16+
1317
- cURL:
1418
. Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
1519
curl_pause, curl_reset, curl_share_close, curl_share_init,

ext/mysqli/tests/057.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ require_once('skipifconnectfailure.inc');
3535
var_dump(mysqli_stmt_reset($stmt));
3636

3737
var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
38-
if ($IS_MYSQLND && $stmt->affected_rows !== -1)
39-
printf("[001] Expecting -1, got %d\n", $stmt->affected_rows);
38+
if ($stmt->affected_rows !== 0)
39+
printf("[001] Expecting 0, got %d\n", $stmt->affected_rows);
4040

4141
var_dump(mysqli_stmt_execute($stmt));
4242
var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));

ext/mysqlnd/mysqlnd_ps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ mysqlnd_stmt_read_prepare_response(MYSQLND_STMT * s TSRMLS_DC)
307307
stmt->warning_count = stmt->conn->upsert_status->warning_count = prepare_resp->warning_count;
308308
stmt->field_count = stmt->conn->field_count = prepare_resp->field_count;
309309
stmt->param_count = prepare_resp->param_count;
310+
stmt->upsert_status->affected_rows = 0; /* be like libmysql */
310311
done:
311312
PACKET_FREE(prepare_resp);
312313

0 commit comments

Comments
 (0)