diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-12-10 10:31:43 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-12-10 10:31:43 +0100 |
| commit | 030845eb6810d1f49606b478051233965ec41d2b (patch) | |
| tree | 4934f7e75138f384b820aa136481491f3dec71d0 /ext | |
| parent | a38aaf6cbdd1d966c186318df063a103b7540db8 (diff) | |
| parent | 9b678bc4d5f56810e468bae7b6fdd9bd825b58ab (diff) | |
| download | php-git-030845eb6810d1f49606b478051233965ec41d2b.tar.gz | |
Merge branch 'PHP-8.0'
* PHP-8.0:
Fixed bug #71145
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/mysqlnd/mysqlnd_connection.c | 12 | ||||
| -rw-r--r-- | ext/pdo_mysql/tests/bug71145.phpt | 25 |
2 files changed, 32 insertions, 5 deletions
diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index 35cc3f55fc..d034fb0ca3 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -454,12 +454,14 @@ MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * con ret = FAIL; break; } - if (conn->last_query_type == QUERY_SELECT) { - MYSQLND_RES * result = conn->m->use_result(conn, 0); - if (result) { - result->m.free_result(result, TRUE); + do { + if (conn->last_query_type == QUERY_SELECT) { + MYSQLND_RES * result = conn->m->use_result(conn, 0); + if (result) { + result->m.free_result(result, TRUE); + } } - } + } while (conn->m->next_result(conn) != FAIL); } } } diff --git a/ext/pdo_mysql/tests/bug71145.phpt b/ext/pdo_mysql/tests/bug71145.phpt new file mode 100644 index 0000000000..b3f887d7c4 --- /dev/null +++ b/ext/pdo_mysql/tests/bug71145.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #71145: Multiple statements in init command triggers unbuffered query error +--SKIPIF-- +<?php +require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc'); +require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); +MySQLPDOTest::skip(); +?> +--FILE-- +<?php + +require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + +$attr = array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; SET SESSION sql_mode=traditional', +); +putenv('PDOTEST_ATTR=' . serialize($attr)); + +$pdo = MySQLPDOTest::factory(); +var_dump($pdo->query('SELECT 42')->fetchColumn(0)); + +?> +--EXPECT-- +string(2) "42" |
