com php-src: Merge branch 'PHP-7.4' into PHP-8.0: NEWS ext/mysqli/tests/mysqli_stmt_get_result.phpt ext/mysq lnd/mysqlnd_ps.c

From: Date: Fri, 18 Dec 2020 09:20:13 +0000
Subject: com php-src: Merge branch 'PHP-7.4' into PHP-8.0: NEWS ext/mysqli/tests/mysqli_stmt_get_result.phpt ext/mysq lnd/mysqlnd_ps.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-114496@lists.php.net to get a copy of this message
Commit: ab846231088d9e2d6a2354b52386e48037e95eb5 Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 18 Dec 2020 10:20:13 +0100 Parents: 1860ef22eba4fed1e360482cfde32b3bfa16fcc5 bc166844e37a6e1531a18dc0916fbe508152fc6c Branches: PHP-8.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ab846231088d9e2d6a2354b52386e48037e95eb5 Log: Merge branch 'PHP-7.4' into PHP-8.0 * PHP-7.4: MySQLnd: Support cursors in store/get result Changed paths: MM NEWS MM ext/mysqli/tests/mysqli_stmt_get_result.phpt MM ext/mysqlnd/mysqlnd_ps.c Diff: diff --cc NEWS index 8b0ce956009,6d4b264c7e8..6226586aba1 --- a/NEWS +++ b/NEWS @@@ -8,14 -8,18 +8,20 @@@ PH - MySQLi: . Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to interpret bit columns). (Nikita) + . Fixed bug #64638 (Fetching resultsets from stored procedure with cursor + fails). (Nikita) + . Fixed bug #72862 (segfault using prepared statements on stored procedures + that use a cursor). (Nikita) + . Fixed bug #77935 (Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP + with a cursor). (Nikita) -07 Jan 2021, PHP 7.4.14 +- PDO_Firebird: + . Fixed bug #80521 (Parameters with underscores no longer recognized). (cmb, + Simonov Denis) + +07 Jan 2021, PHP 8.0.1 - Core: - . Fixed bug #74558 (Can't rebind closure returned by Closure::fromCallable()). - (cmb) . Fixed bug #80345 (PHPIZE configuration has outdated PHP_RELEASE_VERSION). (cmb) . Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb) diff --cc ext/mysqli/tests/mysqli_stmt_get_result.phpt index 74b15dfae3b,fc07a1d2a26..0f98217d598 --- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt @@@ -193,11 -178,26 +180,21 @@@ if (!function_exists('mysqli_stmt_get_r require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_get_result(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized - mysqli_stmt_get_result() cannot be used with cursors - get_result() cannot be used with cursors + array(2) { + ["id"]=> + int(1) + ["label"]=> + string(1) "a" + } + array(2) { + ["id"]=> + int(2) + ["label"]=> + string(1) "b" + } [040] [2014] [Commands out of sync; you can't run this command now] [041] [0] [] array(2) { diff --cc ext/mysqlnd/mysqlnd_ps.c index d2ec46e8da1,12aace6ec27..deaf52de622 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@@ -36,7 -38,38 +36,37 @@@ enum_func_status mysqlnd_stmt_execute_g enum_func_status mysqlnd_stmt_execute_batch_generate_request(MYSQLND_STMT * const s, zend_uchar ** request, size_t *request_len, zend_bool * free_buffer); static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt); -static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, const unsigned int param_no); + static enum_func_status mysqlnd_stmt_send_cursor_fetch_command( + const MYSQLND_STMT_DATA *stmt, unsigned max_rows) + { + MYSQLND_CONN_DATA *conn = stmt->conn; + zend_uchar buf[MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */]; + const MYSQLND_CSTRING payload = {(const char*) buf, sizeof(buf)}; + + int4store(buf, stmt->stmt_id); + int4store(buf + MYSQLND_STMT_ID_LENGTH, max_rows); + + if (conn->command->stmt_fetch(conn, payload) == FAIL) { + COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info); + return FAIL; + } + return PASS; + } + + static zend_bool mysqlnd_stmt_check_state(const MYSQLND_STMT_DATA *stmt) + { + const MYSQLND_CONN_DATA *conn = stmt->conn; + if (stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) { + return 0; + } + if (stmt->cursor_exists) { + return GET_CONNECTION_STATE(&conn->state) == CONN_READY; + } else { + return GET_CONNECTION_STATE(&conn->state) == CONN_FETCHING_DATA; + } + } + /* {{{ mysqlnd_stmt::store_result */ static MYSQLND_RES * MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)

« previous php.cvs (#114496) next »