Skip to content

Commit df940a6

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fixed bug #81494
2 parents b230593 + fcabe69 commit df940a6

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

ext/mysqli/mysqli.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,17 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
11311131
}
11321132
#else
11331133
mysqlnd_fetch_into(result, ((fetchtype & MYSQLI_NUM)? MYSQLND_FETCH_NUM:0) | ((fetchtype & MYSQLI_ASSOC)? MYSQLND_FETCH_ASSOC:0), return_value, MYSQLND_MYSQLI);
1134+
/* TODO: We don't have access to the connection object at this point, so we use low-level
1135+
* mysqlnd APIs to access the error information. We should try to pass through the connection
1136+
* object instead. */
1137+
if (MyG(report_mode) & MYSQLI_REPORT_ERROR) {
1138+
MYSQLND_CONN_DATA *conn = result->conn;
1139+
unsigned error_no = conn->m->get_error_no(conn);
1140+
if (error_no) {
1141+
php_mysqli_report_error(
1142+
conn->m->get_sqlstate(conn), error_no, conn->m->get_error_str(conn));
1143+
}
1144+
}
11341145
#endif
11351146
}
11361147
/* }}} */

ext/mysqli/tests/bug64726.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ require_once('skipifconnectfailure.inc');
1414
require 'connect.inc';
1515
$db = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
1616

17+
mysqli_report(MYSQLI_REPORT_ERROR);
1718
$result = $db->query('SELECT 1', MYSQLI_USE_RESULT);
1819
$db->close();
1920
var_dump($result->fetch_object());
2021
?>
2122
--EXPECTF--
22-
Warning: mysqli_result::fetch_object(): Error while reading a row in %sbug64726.php on line %d
23+
Warning: mysqli_result::fetch_object(): (HY000/2014): Commands out of sync; you can't run this command now in %s on line %d
2324
bool(false)

ext/mysqli/tests/bug79375.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,4 @@ Lock wait timeout exceeded; try restarting transaction
167167
Running query on first connection
168168
Got 1 for first connection
169169
Running query on second connection
170-
171-
Warning: mysqli_result::fetch_row(): Error while reading a row in %s on line %d
172-
Got 0 for second connection
170+
Lock wait timeout exceeded; try restarting transaction

ext/mysqlnd/mysqlnd_result.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,6 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int
17511751
}
17521752
array_init_size(return_value, array_size);
17531753
if (FAIL == result->m.fetch_row(result, (void *)return_value, flags, &fetched_anything)) {
1754-
php_error_docref(NULL, E_WARNING, "Error while reading a row");
17551754
zend_array_destroy(Z_ARR_P(return_value));
17561755
RETVAL_FALSE;
17571756
} else if (fetched_anything == FALSE) {

0 commit comments

Comments
 (0)